Make transactions
Overview
A cheqd-node
instance can be controlled and configured using the cheqd Cosmos CLI.
This document contains the commands for reading and writing token transactions.
Querying and declaring fees in transactions
Our v3.x upgrade introduced EIP-1559 style burns, and our v3.1.x upgrade bumped minimum gas price to 5000ncheq. Therefore, all wallets and applications are recommended to query real-time gas prices from the chain to ensure that they succeed.
Querying real-time gas prices via CLI
Arguments
denom
: The denomination of the fee. For example,ncheq
--node
: IP address or URL of node to send the request to
Example
Note: Use
--output json
to get the output in JSON format.
Querying real-time gas prices via REST API
You can also query real-time gas prices on chain using the REST API, which can be useful for applications that do not use the node CLI. You can fetch this by initiating a GET reqeust to:
Mainnet:
https://api.cheqd.net/feemarket/v1/gas_price/ncheq
Testnet:
https://api.cheqd.network/feemarket/v1/gas_price/ncheq
Response format for gas prices from REST API
Interpreting the real-time gas prices API response
There are two ways of interpreting the CLI/API response:
If specifying fees as
gas x gas prices
withauto
gas calculation (recommended): Multiply theprice.amount
by 10^4 to derive the gas price inncheq
. In the example above, this results in gas price0.5ncheq * (10^4) = 5000ncheq
Note: Consider
10^4
the fee offset multiplier for gas prices. This is because cheqd network usesncheq
as the base denomination for gas prices, whereas Cosmos SDK usesuatom
for this feemarket implementation. The offset factor is not related to the conversion fromncheq
touatom
, but rather to the way the gas prices are calculated in Cosmos SDK.If specifying fixed fees as
--fees
: Theprice.amount
value represents the exact fee to pay in CHEQ, whereas theprice.denom
gives the units it should be expressed in. If the network is congested, the fee may be higher than the example value shown. Therefore, it is recommended to multiply by a factor of 2 or more to ensure the transaction is processed when using--fees
, as this method does not have the benefit of auto gas calculation. In the example above, this becomes0.5 CHEQ * 2 * 10^9 = 1,000,000,000ncheq
(1 CHEQ).
The Submitting transactions section below explains further how fees can be specified with transactions.
Suggested static gas price values
The most fool-proof method of ensuring your transaction succeeds is by querying the on-chain gas prices as described above. This fetches the real-time gas prices on the network, based on current congestion.
If, however, your application is unable to query on-chain prices for some reason, you may be able to use the following static gas price values:
Low (minimum gas price):
5000ncheq
Medium:
7500ncheq
High:
10000ncheq
Please note that without querying the real-time prices, these ranges might not satisfy requirements during periods of peak congestion, but will likely meet the required gas prices in 90% of scenarios at the peak.
Submitting transactions
In our documentation, you will come across terms like gas and gas prices. Fees are calculated as follows:
fees = gas x gas-adjustment x gas-prices
There are important changes to particular values for gas adjustment and gas prices since the v3.x and v3.1.x upgrade, which are reflected below.
Generic transaction command
Arguments
--chain-id
: E.g.,cheqd-mainnet-1
(for mainnet),cheqd-testnet-6
(for testnet). This parameter is typically mandatory--gas
: Either a specific value, orauto
(recommended)--gas-adjustment
: Usually, the auto-calculated gas value fluctuates, so you're recommended to boost the gas value by this multiplication factor. Since our v3.x upgrade, the recommended value is 1.7 or more.--gas-prices
: From v3.1.x upgrade onwards, the minimum gas price is 5000ncheq. Recommendation is to either query real-time gas prices, or use the static values.--node
(optional): IP address or URL of node's RPC endpoint to send request to, e.g.,https://rpc.cheqd.net
,http:localhost:26657
. This is not necessary when executing on a node itself.
Alternative method for setting fees
Instead of using --gas
, --gas-adjustment
, and --gas-prices
, you can also specify fixed fees for a transaction using the --fees
flag, which is the maximum fee limit that is allowed for the transaction.
--fees
needs to be specified in ncheq
units or 10^-9 CHEQ. For example, 5000ncheq
is 0.000005 CHEQ. The fee is in ncheq
units. Refer to the section above for obtaining gas prices that help determine the fee amount.
Status codes
Pay attention at return status code. It should be 0 if a transaction is submitted successfully. Otherwise, an error message may be returned.
Example
General ledger queries
For most general ledger queries, use the --help
flag for any command/sub-command to understand the possible parameters and values.
Command
Arguments
--node
: IP address or URL of node to send the request to
Example
Last updated
Was this helpful?