CLI Commands
The software to run the Network, the Platform, and the command-line client used to interact with them are all currently distributed in the akash Command Line Interface (CLI) application.

The Akash CLI

The Akash command line utility
1
-h, --help help for akash
Copied!

Akash Commands

Below are links to the top level commands. Click one of the links to see the available commands.

Send Tokens

Sign and send tokens to other account.
Usage
1
akash tx bank send [from_key_or_address] [to_address] [amount] [flags]
Copied!
Example
1
$ akash tx bank send bob akash12wlzqjelrt87r3u56ps4m8lk7wavx5m5jg9cax 10000000uakt --chain-id devnet -y
2
3
{"height":"0","txhash":"116ED246AFF9F9B58036AECAA5EFE81AA7A788CC625CC2A4ADAFC68378834413","raw_log":"[]"}
Copied!
More Info
1
$ akash tx send -h
2
Send funds from one account to another. Note, the'--from' flag is
3
ignored as it is implied from [from_key_or_address].
4
5
Usage:
6
akash tx bank send [from_key_or_address] [to_address] [amount] [flags]
7
8
Flags:
9
-a, --account-number uint The account number of the signing account (offline mode only)
10
-b, --broadcast-mode string Transaction broadcasting mode (sync|async|block) (default "sync")
11
--dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it
12
--fees string Fees to pay along with transaction; eg: 10uatom
13
--from string Name or address of private key with which to sign
14
--gas string gas limit to set per-transaction; set to "auto" to calculate sufficient gas automatically (default 200000)
15
--gas-adjustment float adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored (default 1)
16
--gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom)
17
--generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase is not accessible)
18
-h, --help help for send
19
--keyring-backend string Select keyring's backend (os|file|kwallet|pass|test) (default "os")
20
--keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used
21
--ledger Use a connected Ledger device
22
--memo string Memo to send along with transaction
23
--node string <host>:<port> to tendermint rpc interface for this chain (default "tcp://localhost:26657")
24
--offline Offline mode (does not allow any online functionality
25
-s, --sequence uint The sequence number of the signing account (offline mode only)
26
--sign-mode string Choose sign mode (direct|amino-json), this is an advanced feature
27
--timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height
28
-y, --yes Skip tx broadcasting prompt confirmation
29
30
Global Flags:
31
--chain-id string The network chain ID
32
--home string directory for config and data (default "/home/vitwit/.akash")
33
--log_format string The logging format (json|plain) (default "plain")
34
--log_level string The logging level (trace|debug|info|warn|error|fatal|panic) (default "info")
35
--trace print out full stack trace on errors
Copied!

Query Transaction

Query for a transaction by hash in a committed block.
Usage
1
$ akash query tx <txhash> -o json
Copied!
Examples
1
$ akash query tx BCAB9AAC8C4F920218757A0C4461AF6C380A2144B4762B4DE1CE014BE2714DA5 -o json
2
3
{"height":"36","txhash":"BCAB9AAC8C4F920218757A0C4461AF6C380A2144B4762B4DE1CE014BE2714DA5","codespace":"","code":0,"data":"0A060A0473656E64","raw_log":"[{\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"send\"},{\"key\":\"sender\",\"value\":\"akash16q6s0tauc3cks5us7f57wds8c8lqg4jqs0qtaf\"},{\"key\":\"module\",\"value\":\"bank\"}]},{\"type\":\"transfer\",\"attributes\":[{\"key\":\"recipient\",\"value\":\"akash1zsgzee6vvx942c4c69vl859w9azn77j8uhduug\"},{\"key\":\"sender\",\"value\":\"akash16q6s0tauc3cks5us7f57wds8c8lqg4jqs0qtaf\"},{\"key\":\"amount\",\"value\":\"100000stake\"}]}]}]","logs":[{"msg_index":0,"log":"","events":[{"type":"message","attributes":[{"key":"action","value":"send"},{"key":"sender","value":"akash16q6s0tauc3cks5us7f57wds8c8lqg4jqs0qtaf"},{"key":"module","value":"bank"}]},{"type":"transfer","attributes":[{"key":"recipient","value":"akash1zsgzee6vvx942c4c69vl859w9azn77j8uhduug"},{"key":"sender","value":"akash16q6s0tauc3cks5us7f57wds8c8lqg4jqs0qtaf"},{"key":"amount","value":"100000stake"}]}]}],"info":"","gas_wanted":"200000","gas_used":"57508","tx":{"@type":"/cosmos.tx.v1beta1.Tx","body":{"messages":[{"@type":"/cosmos.bank.v1beta1.MsgSend","from_address":"akash16q6s0tauc3cks5us7f57wds8c8lqg4jqs0qtaf","to_address":"akash1zsgzee6vvx942c4c69vl859w9azn77j8uhduug","amount":[{"denom":"stake","amount":"100000"}]}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[{"public_key":{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A+hCkyWd4cWG0KD+GgCxHEOUzll1cl5VvoGgDvVIwF3E"},"mode_info":{"single":{"mode":"SIGN_MODE_DIRECT"}},"sequence":"1"}],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""}},"signatures":["q3XqohxwkgaT0nLusXLaZ5aRGrcxbTUGS2pYN+tSPtkk10Ij+2YXs3LhXUxhcSNnTMABq4bIhJ3L/QDoz8Xp+w=="]},"timestamp":"2021-02-10T10:08:40Z"}
Copied!
More info
1
$ akash query tx -h
2
3
Usage:
4
akash query tx [hash] [flags]
5
6
Flags:
7
--height int Use a specific height to query state at (this can error if the node is pruning state)
8
-h, --help help for tx
9
--node string <host>:<port> to Tendermint RPC interface for this chain (default "tcp://localhost:26657")
10
-o, --output string Output format (text|json) (default "text")
11
12
Global Flags:
13
--chain-id string The network chain ID
14
--home string directory for config and data (default "/home/vitwit/.akash")
15
--log_format string The logging format (json|plain) (default "plain")
16
--log_level string The logging level (trace|debug|info|warn|error|fatal|panic) (default "info")
17
--trace print out full stack trace on errors
Copied!

Bond(Stake) Tokens

Delegate some tokens to validator i.e., bonding tokens.
Usage
1
$ akash tx staking delegate <validator-address> <amount-with-denom> --from <from-account> -y
Copied!
Example
1
$ akash tx staking delegate akashvaloper1qgjla78dk2yk2eh6dmjeejz6m374ykdtpgp92s 1000000uakt --chain-id devnet --from alice -y
2
3
{"height":"0","txhash":"F48C925F2F37766660D044DCAD0DC9A4CF51E454E184BC817EFD32ADA501ADD7","raw_log":"[]"}
Copied!
More info
1
$ akash tx staking delegate -h
2
Delegate an amount of liquid coins to a validator from your wallet.
3
4
Usage:
5
akash tx staking delegate [validator-addr] [amount] [flags]
6
7
Flags:
8
-a, --account-number uint The account number of the signing account (offline mode only)
9
-b, --broadcast-mode string Transaction broadcasting mode (sync|async|block) (default "sync")
10
--dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it
11
--fees string Fees to pay along with transaction; eg: 10uatom
12
--from string Name or address of private key with which to sign
13
--gas string gas limit to set per-transaction; set to "auto" to calculate sufficient gas automatically (default 200000)
14
--gas-adjustment float adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored (default 1)
15
--gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom)
16
--generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase is not accessible)
17
-h, --help help for delegate
18
--keyring-backend string Select keyring's backend (os|file|kwallet|pass|test) (default "os")
19
--keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used
20
--ledger Use a connected Ledger device
21
--memo string Memo to send along with transaction
22
--node string <host>:<port> to tendermint rpc interface for this chain (default "tcp://localhost:26657")
23
--offline Offline mode (does not allow any online functionality
24
-s, --sequence uint The sequence number of the signing account (offline mode only)
25
--sign-mode string Choose sign mode (direct|amino-json), this is an advanced feature
26
--timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height
27
-y, --yes Skip tx broadcasting prompt confirmation
28
29
Global Flags:
30
--chain-id string The network chain ID
31
--home string directory for config and data (default "/home/vitwit/.akash")
32
--log_format string The logging format (json|plain) (default "plain")
33
--log_level string The logging level (trace|debug|info|warn|error|fatal|panic) (default "info")
34
--trace print out full stack trace on errors
Copied!

Redelegate Tokens

Redelegate some tokens from one validator to another.
Usage
1
$ akash tx staking redelegate <src-validator-address> <dest-validator-address> <amount-with-denom> --from <from-account> -y -o json
Copied!
Example
1
$ akash tx staking redelegate akashvaloper1qgjla78dk2yk2eh6dmjeejz6m374ykdtpgp92s akashvaloper16q6s0tauc3cks5us7f57wds8c8lqg4jq6dwddr 1000000uakt --chain-id devnet --from alice -y -o json
2
3
{"height":"0","txhash":"295A56A7B4DA7DE3266329981945307FF73ACFF1CCD319D1E1AE53DF16E0125E","raw_log":"[]"}
Copied!
More info
1
$ akash tx staking redelegate -h
2
Redelegate an amount of illiquid staking tokens from one validator to another.
3
4
Example:
5
$ akash tx staking redelegate akashvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj akashvaloper1l2rsakp388kuv9k8qzq6lrm9taddae7fpx59wm 100stake --from mykey
6
7
Usage:
8
akash tx staking redelegate [src-validator-addr] [dst-validator-addr] [amount] [flags]
9
10
Flags:
11
-a, --account-number uint The account number of the signing account (offline mode only)
12
-b, --broadcast-mode string Transaction broadcasting mode (sync|async|block) (default "sync")
13
--dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it
14
--fees string Fees to pay along with transaction; eg: 10uatom
15
--from string Name or address of private key with which to sign
16
--gas string gas limit to set per-transaction; set to "auto" to calculate sufficient gas automatically (default 200000)
17
--gas-adjustment float adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored (default 1)
18
--gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom)
19
--generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase is not accessible)
20
-h, --help help for redelegate
21
--keyring-backend string Select keyring's backend (os|file|kwallet|pass|test) (default "os")
22
--keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used
23
--ledger Use a connected Ledger device
24
--memo string Memo to send along with transaction
25
--node string <host>:<port> to tendermint rpc interface for this chain (default "tcp://localhost:26657")
26
--offline Offline mode (does not allow any online functionality
27
-s, --sequence uint The sequence number of the signing account (offline mode only)
28
--sign-mode string Choose sign mode (direct|amino-json), this is an advanced feature
29
--timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height
30
-y, --yes Skip tx broadcasting prompt confirmation
31
32
Global Flags:
33
--chain-id string The network chain ID
34
--home string directory for config and data (default "/home/vitwit/.akash")
35
--log_format string The logging format (json|plain) (default "plain")
36
--log_level string The logging level (trace|debug|info|warn|error|fatal|panic) (default "info")
37
--trace print out full stack trace on errors
Copied!

Undelegate(unbond) Tokens

Undelegate some tokens from validator i.e., unbonding tokens.
Usage
1
$ akash tx staking unbond <validator-address> <amount-with-denom> --from <from-account> -y -o json
Copied!
Example
1
$ akash tx staking unbond akashvaloper1qgjla78dk2yk2eh6dmjeejz6m374ykdtpgp92s 1000000uakt --chain-id devnet --from alice -y -o json
2
3
{"height":"0","txhash":"F48C925F2F37766660D044DCAD0DC9A4CF51E454E184BC817EFD32ADA501ADD7","raw_log":"[]"}
Copied!
More info
1
$ akash tx staking unbond -h
2
Unbond an amount of bonded shares from a validator.
3
4
Example:
5
$ akash tx staking unbond akashvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj 100uakt --from mykey
6
7
Usage:
8
akash tx staking unbond [validator-addr] [amount] [flags]
9
10
Flags:
11
-a, --account-number uint The account number of the signing account (offline mode only)
12
-b, --broadcast-mode string Transaction broadcasting mode (sync|async|block) (default "sync")
13
--dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it
14
--fees string Fees to pay along with transaction; eg: 10uatom
15
--from string Name or address of private key with which to sign
16
--gas string gas limit to set per-transaction; set to "auto" to calculate sufficient gas automatically (default 200000)
17
--gas-adjustment float adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored (default 1)
18
--gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom)
19
--generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase is not accessible)
20
-h, --help help for unbond
21
--keyring-backend string Select keyring's backend (os|file|kwallet|pass|test) (default "os")
22
--keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used
23
--ledger Use a connected Ledger device
24
--memo string Memo to send along with transaction
25
--node string <host>:<port> to tendermint rpc interface for this chain (default "tcp://localhost:26657")
26
--offline Offline mode (does not allow any online functionality
27
-s, --sequence uint The sequence number of the signing account (offline mode only)
28
--sign-mode string Choose sign mode (direct|amino-json), this is an advanced feature
29
--timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height
30
-y, --yes Skip tx broadcasting prompt confirmation
31
32
Global Flags:
33
--chain-id string The network chain ID
34
--home string directory for config and data (default "/home/vitwit/.akash")
35
--log_format string The logging format (json|plain) (default "plain")
36
--log_level string The logging level (trace|debug|info|warn|error|fatal|panic) (default "info")
37
--trace print out full stack trace on errors
Copied!

Withdraw Rewards

Withdraw rewards from validator
Usage
1
$ akash tx distribution withdraw-rewards <validator-address> <amount-with-denom> --from <from-account> -y -o json
Copied!
Example
1
$ akash tx distribution withdraw-rewards akashvaloper16q6s0tauc3cks5us7f57wds8c8lqg4jq6dwddr --chain-id devnet --from alice -y
2
3
{"height":"0","txhash":"1BBB4A7A4D245C7534F366BABCE5BDD73776FB0430B3A241BFEEEF99445C52C3","raw_log":"[]"}
Copied!
More info
1
$ akash tx distribution withdraw-rewards -h
2
Withdraw rewards from a given delegation address,
3
and optionally withdraw validator commission if the delegation address given is a validator operator.
4
5
Example:
6
$ akash tx distribution withdraw-rewards akashvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj --from mykey
7
8
### Withdraw commission
9
$ akash tx distribution withdraw-rewards akashvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhffj --from mykey --commission
10
11
Usage:
12
akash tx distribution withdraw-rewards [validator-addr] [flags]
13
14
Flags:
15
-a, --account-number uint The account number of the signing account (offline mode only)
16
-b, --broadcast-mode string Transaction broadcasting mode (sync|async|block) (default "sync")
17
--commission Withdraw the validator's commission in addition to the rewards
18
--dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it
19
--fees string Fees to pay along with transaction; eg: 10uatom
20
--from string Name or address of private key with which to sign
21
--gas string gas limit to set per-transaction; set to "auto" to calculate sufficient gas automatically (default 200000)
22
--gas-adjustment float adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored (default 1)
23
--gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom)
24
--generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase is not accessible)
25
-h, --help help for withdraw-rewards
26
--keyring-backend string Select keyring's backend (os|file|kwallet|pass|test) (default "os")
27
--keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used
28
--ledger Use a connected Ledger device
29
--memo string Memo to send along with transaction
30
--node string <host>:<port> to tendermint rpc interface for this chain (default "tcp://localhost:26657")
31
--offline Offline mode (does not allow any online functionality
32
-s, --sequence uint The sequence number of the signing account (offline mode only)
33
--sign-mode string Choose sign mode (direct|amino-json), this is an advanced feature
34
--timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height
35
-y, --yes Skip tx broadcasting prompt confirmation
36
37
Global Flags:
38
--chain-id string The network chain ID
39
--home string directory for config and data (default "/home/vitwit/.akash")
40
--log_format string The logging format (json|plain) (default "plain")
41
--log_level string The logging level (trace|debug|info|warn|error|fatal|panic) (default "info")
42
--trace print out full stack trace on errors
Copied!

Query Rewards

Query all rewards earned by a delegator, optionally restrict to rewards from a single validator.
Usage
1
$ akash query distribution rewards <delegator-address> [<validator-address>] -o json
Copied!
Examples
1
$ akash query distribution rewards akash1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p akashvaloper16q6s0tauc3cks5us7f57wds8c8lqg4jq6dwddr -o json
2
3
[{"denom":"uakt","amount":"69009.444000000000000000"}]
4
5
$ akash query distribution rewards akash1gghjut3ccd8ay0zduzj64hwre2fxs9ld75ru9p -o json
6
7
{"rewards":[{"validator_address":"akashvaloper16q6s0tauc3cks5us7f57wds8c8lqg4jq6dwddr","reward":[{"denom":"uakt","amount":"1467715.032000000000000000"}]}],"total":[{"denom":"uakt","amount":"1467715.032000000000000000"}]
Copied!
More info
1
$ akash query distribution rewards -h
2
3
Usage:
4
akash query distribution rewards [delegator-addr] [<validator-addr>] [flags]
5
6
Flags:
7
--height int Use a specific height to query state at (this can error if the node is pruning state)
8
-h, --help help for rewards
9
--node string <host>:<port> to Tendermint RPC interface for this chain (default "tcp://localhost:26657")
10
-o, --output string Output format (text|json) (default "text")
11
12
Global Flags:
13
--chain-id string The network chain ID
14
--home string directory for config and data (default "/home/vitwit/.akash")
15
--log_format string The logging format (json|plain) (default "plain")
16
--log_level string The logging level (trace|debug|info|warn|error|fatal|panic) (default "info")
17
--trace print out full stack trace on errors
Copied!

Query Balance

Query the total balance of an account or of a specific denomination.
Usage
1
$ akash query bank balances <account-address>
2
$ akash query bank balances <account-address> --denom=[denom]
Copied!
Examples
1
$ akash query bank balances akash16q6s0tauc3cks5us7f57wds8c8lqg4jqs0qtaf -o json
2
3
{"balances":[{"denom":"stake","amount":"99899900000"},{"denom":"uakt","amount":"100000000000"}],"pagination":{"next_key":null,"total":"0"}}
Copied!
More info
1
$ akash query bank balances -h
2
3
Usage:
4
akash query bank balances [address] [flags]
5
6
Flags:
7
--count-total count total number of records in all balances to query for
8
--denom string The specific balance denomination to query for
9
--height int Use a specific height to query state at (this can error if the node is pruning state)
10
-h, --help help for balances
11
--limit uint pagination limit of all balances to query for (default 100)
12
--node string <host>:<port> to Tendermint RPC interface for this chain (default "tcp://localhost:26657")
13
--offset uint pagination offset of all balances to query for
14
-o, --output string Output format (text|json) (default "text")
15
--page uint pagination page of all balances to query for. This sets offset to a multiple of limit (default 1)
16
--page-key string pagination page-key of all balances to query for
17
18
Global Flags:
19
--chain-id string The network chain ID
20
--home string directory for config and data (default "/home/vitwit/.akash")
21
--log_format string The logging format (json|plain) (default "plain")
22
--log_level string The logging level (trace|debug|info|warn|error|fatal|panic) (default "info")
23
--trace print out full stack trace on errors
Copied!

Recover Key

Provide seed phrase to recover existing key instead of creating.
Usage
1
$ akash keys add <key-name> --recover
Copied!
Example
1
$ akash keys add alice --recover
2
> Enter your bip39 mnemonic
3
close super rare vicious core supreme collect fatigue maid cupboard throw surge notable phrase brand actual high track stay visual afraid lot dizzy wedding
4
5
- name: alice
6
type: local
7
address: akash12wlzqjelrt87r3u56ps4m8lk7wavx5m5jg9cax
8
pubkey: akashpub1addwnpepqd80atzkr5c5teq933q80jkh27ljgwsm3r00fxjcl5nvaxkm9z0hqhw5h7e
9
mnemonic: ""
10
threshold: 0
11
pubkeys: []
Copied!

Export Key

Export a private key from the local keybase in ASCII-armored encrypted format. Export key with entering new password.
Usage
1
akash keys export <key-name>
Copied!
Example
1
$ akash keys export provider
2
Enter passphrase to encrypt the exported key:
3
-----BEGIN TENDERMINT PRIVATE KEY-----
4
kdf: bcrypt
5
salt: FC01B9FACA831E315C867E07A586AEF7
6
type: secp256k1
7
8
VmSk+mQl2tpra7dHt2Dm2z4S2unH2kbjXaOZTK/9NGQsw3TSb6GkwBU7WizTCmN/
9
3dxPu/wdDa1uBLYg+zgYhTtK6HlPDrulxlDDQjg=
10
=KGDA
11
-----END TENDERMINT PRIVATE KEY-----
Copied!

Import Key

Import a file with ASCII armored private key into the local keybase. Required key password to import key.
Usage
1
$ akash keys import <key-name> <keyfile>
Copied!
Example
1
$ akash keys import provider key
2
Enter passphrase to decrypt your key:
Copied!

Generating a Transaction

Generating a transaction can simply be done by appending the --generate-only flag on any tx command
Example:
1
akash tx send bob akash12wlzqjelrt87r3u56ps4m8lk7wavx5m5jg9cax 10000000uakt --chain-id devnet --generate-only
Copied!
This will output the unsigned transaction as JSON in the console. We can also save the unsigned transaction to a file by appending > unsigned_tx.json to the above command.

Signing a Transaction

Signing a transaction using the CLI requires the unsigned transaction to be saved in a file.
1
$ akash tx sign unsigned_tx.json --chain-id devnet --from alice
Copied!
This command will decode the unsigned transaction and sign it with SIGN_MODE_DIRECT with alice's key, which we already set up in the keyring. The signed transaction will be output as JSON to the console, and we can save it to a file by appending > signed_tx.json.
More Info
1
Usage:
2
akash tx sign [file] [flags]
3
4
Flags:
5
-a, --account-number uint The account number of the signing account (offline mode only)
6
--amino Generate Amino encoded JSON suitable for submiting to the txs REST endpoint
7
-b, --broadcast-mode string Transaction broadcasting mode (sync|async|block) (default "sync")
8
--dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it
9
--fees string Fees to pay along with transaction; eg: 10uatom
10
--from string Name or address of private key with which to sign
11
--gas string gas limit to set per-transaction; set to "auto" to calculate sufficient gas automatically (default 200000)
12
--gas-adjustment float adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored (default 1)
13
--gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom)
14
--generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase is not accessible)
15
-h, --help help for sign
16
--keyring-backend string Select keyring's backend (os|file|kwallet|pass|test) (default "os")
17
--keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used
18
--ledger Use a connected Ledger device
19
--memo string Memo to send along with transaction
20
--multisig string Address of the multisig account on behalf of which the transaction shall be signed
21
--node string <host>:<port> to tendermint rpc interface for this chain (default "tcp://localhost:26657")
22
--offline Offline mode (does not allow any online functionality
23
--output-document string The document will be written to the given file instead of STDOUT
24
--overwrite Overwrite existing signatures with a new one. If disabled, new signature will be appended
25
-s, --sequence uint The sequence number of the signing account (offline mode only)
26
--sign-mode string Choose sign mode (direct|amino-json), this is an advanced feature
27
--signature-only Print only the signatures
28
--timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height
29
-y, --yes Skip tx broadcasting prompt confirmation
Copied!
Some useful flags to consider in the tx sign command:
    --sign-mode: you may use amino-json to sign the transaction using SIGN_MODE_LEGACY_AMINO_JSON,
    --offline: sign in offline mode. This means that the tx sign command doesn't connect to the node to retrieve the signer's account number and sequence, both needed for signing. In this case, you must manually supply the --account-number and --sequence flags. This is useful for offline signing, i.e. signing in a secure environment which doesn't have access to the internet.

Encode a Transaction

Encode transactions created with the --generate-only flag and signed with the sign command. It will read a transaction from , serialize it to the Amino wire protocol, and output it as base64. If you supply a dash (-) argument in place of an input filename, the command reads from standard input.
1
$ akash tx encode signed-tx.json
2
3
CpABCo0BChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEm0KLGFrYXNoMTZxNnMwdGF1YzNja3M1dXM3ZjU3d2RzOGM4bHFnNGpxczBxdGFmEixha2FzaDF6c2d6ZWU2dnZ4OTQyYzRjNjl2bDg1OXc5YXpuNzdqOHVoZHV1ZxoPCgVzdGFrZRIGMTAwMDAwElgKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQPoQpMlneHFhtCg/hoAsRxDlM5ZdXJeVb6BoA71SMBdxBIECgIIfxgCEgQQwJoMGkB+VlYeHU81v4qxIOGpIKpmq7fzVB83Lvy5xvxpm37F6yZ9+XA56KzkMdHhpURmaFYF2567D0nE5e57UKfKF6Az
Copied!
More Info
1
Usage:
2
akash tx encode [file] [flags]
3
4
Flags:
5
-a, --account-number uint The account number of the signing account (offline mode only)
6
-b, --broadcast-mode string Transaction broadcasting mode (sync|async|block) (default "sync")
7
--dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it
8
--fees string Fees to pay along with transaction; eg: 10uatom
9
--from string Name or address of private key with which to sign
10
--gas string gas limit to set per-transaction; set to "auto" to calculate sufficient gas automatically (default 200000)
11
--gas-adjustment float adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored (default 1)
12
--gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom)
13
--generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase is not accessible)
14
-h, --help help for encode
15
--keyring-backend string Select keyring's backend (os|file|kwallet|pass|test) (default "os")
16
--keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used
17
--ledger Use a connected Ledger device
18
--memo string Memo to send along with transaction
19
--node string <host>:<port> to tendermint rpc interface for this chain (default "tcp://localhost:26657")
20
--offline Offline mode (does not allow any online functionality
21
-s, --sequence uint The sequence number of the signing account (offline mode only)
22
--sign-mode string Choose sign mode (direct|amino-json), this is an advanced feature
23
--timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height
24
-y, --yes Skip tx broadcasting prompt confirmation
25
26
Global Flags:
27
--chain-id string The network chain ID
28
--home string directory for config and data (default "/home/vitwit/.akash")
29
--log_format string The logging format (json|plain) (default "plain")
30
--log_level string The logging level (trace|debug|info|warn|error|fatal|panic) (default "info")
31
--trace print out full stack trace on errors
Copied!

Broadcasting a Transaction (CLI)

Broadcasting a transaction using the CLI requires the signed transaction to be saved in a file.
1
akash tx broadcast [file_path] [flags]
Copied!
You may optionally pass the --broadcast-mode flag to specify which response to receive from the node:
    block: the CLI waits for the tx to be committed in a block.
    sync: the CLI waits for a CheckTx execution response only.
    async: the CLI returns immediately (transaction might fail).
More info
1
Example:
2
3
$ akash tx broadcast ./mysign.json
4
5
Flags:
6
-a, --account-number uint The account number of the signing account (offline mode only)
7
-b, --broadcast-mode string Transaction broadcasting mode (sync|async|block) (default "sync")
8
--dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it
9
--fees string Fees to pay along with transaction; eg: 10uatom
10
--from string Name or address of private key with which to sign
11
--gas string gas limit to set per-transaction; set to "auto" to calculate sufficient gas automatically (default 200000)
12
--gas-adjustment float adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored (default 1)
13
--gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom)
14
--generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase is not accessible)
15
-h, --help help for broadcast
16
--keyring-backend string Select keyring's backend (os|file|kwallet|pass|test) (default "os")
17
--keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used
18
--ledger Use a connected Ledger device
19
--memo string Memo to send along with transaction
20
--node string <host>:<port> to tendermint rpc interface for this chain (default "tcp://localhost:26657")
21
--offline Offline mode (does not allow any online functionality
22
-s, --sequence uint The sequence number of the signing account (offline mode only)
23
--sign-mode string Choose sign mode (direct|amino-json), this is an advanced feature
24
--timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height
25
-y, --yes Skip tx broadcasting prompt confirmation
26
27
Global Flags:
28
--chain-id string The network chain ID
29
--home string directory for config and data (default "/home/vitwit/.akash")
30
--log_format string The logging format (json|plain) (default "plain")
31
--log_level string The logging level (trace|debug|info|warn|error|fatal|panic) (default "info")
32
--trace print out full stack trace on errors
Copied!

Broadcasting a Transaction (REST)

Broadcasting a transaction using the REST endpoint (served by gRPC-gateway) can be done by sending a POST request as follows, where the txBytes are the protobuf-encoded bytes of a signed transaction:
1
curl -X POST -H "Content-Type: application/json" -d'{"tx_bytes":"{{txBytes}}","mode":"BROADCAST_MODE_SYNC"}' localhost:1317/cosmos/tx/v1beta1/txs
Copied!
Here, tx_bytes value will be encoded tx of signed transaction.
Example
1
$ $ curl -X POST -H "Content-Type: application/json" -d'{"tx_bytes":"CpABCo0BChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEm0KLGFrYXNoMTZxNnMwdGF1YzNja3M1dXM3ZjU3d2RzOGM4bHFnNGpxczBxdGFmEixha2FzaDF6c2d6ZWU2dnZ4OTQyYzRjNjl2bDg1OXc5YXpuNzdqOHVoZHV1ZxoPCgVzdGFrZRIGMTAwMDAwElgKUApGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQPoQpMlneHFhtCg/hoAsRxDlM5ZdXJeVb6BoA71SMBdxBIECgIIfxgCEgQQwJoMGkB+VlYeHU81v4qxIOGpIKpmq7fzVB83Lvy5xvxpm37F6yZ9+XA56KzkMdHhpURmaFYF2567D0nE5e57UKfKF6Az","mode":"BROADCAST_MODE_SYNC"}' localhost:1317/cosmos/tx/v1beta1/txs
Copied!

Using CosmJS (JavaScript & TypeScript)

CosmJS aims to build client libraries in JavaScript that can be embedded in web applications. Please see https://cosmos.github.io/cosmjs (opens new window) for more information. As of January 2021, CosmJS documentation is still work in progress.
Please go through this code to sign a transaction using CosmJS javascript library.
Last modified 3mo ago