User Tools

Site Tools


gaiacli

Cosmos SDK GaiaCLI Helpful Commands

Note: This list is not meant to be a substitute for the Cosmos SDK Documentation. It may be inaccurate or outdated. Use at your own risk.

Accounts

Create account using Ledger hardware wallet

gaiacli keys add <yourAccountName> --ledger

This command will only work while the Ledger is plugged in and unlocked

Create additional accounts using Ledger

gaiacli keys add <yourAccountName> --ledger --account 1

gaiacli keys add <yourAccountName> --ledger --account 2

You can add optional --account flag to specify the path (0,1,2, etc). By default, account 0 is generated.

Create new account

gaiacli keys add <yourKeyName>

The command will generate a 24-words mnemonic and save the private and public keys. You will be prompted to input a passphrase to encrypt the private key

Restore account from mnemonic

gaiacli keys add <yourKeyName> --recover

You can create more accounts from the same mnemonic using the following command

gaiacli keys add <yourKeyName> --recover --account 1

See all available public keys

gaiacli keys list

Check your balance

gaiacli account <YOUR_ADDRESS>

This command will only work when synced with the network


Node Config

View version of software

gaiacli version

Add --long for additional build info

gaiacli version --long

View existing config options

gaiacli config

Any currently set configurations will display after this command

Set the output to text

gaiacli config output text

Set Node Address and Port

gaiacli config node <host>:<port>

If you run your own full-node, use tcp://localhost:26657

Set Trust Node Flag

gaiacli config trust-node false

Set to true if you run a light-client node, false to host your own blockchain

Chain-ID Flag

gaiacli config chain-id cosmoshub-1

Set to cosmoshub-1 for mainnet, otherwise use a testnet


Querying Validators

Query account information

gaiacli query account <yourAccountName>

Query the list of validators

gaiacli query staking validators

Query validator information

gaiacli query staking validator <validatorAddress>

Query all delegations for a given delegator

gaiacli query staking delegations <delegatorAddress>

Query a specific delegation made from a delegator to a validator

gaiacli query staking delegation <delegatorAddress> <validatorAddress>

Query Delegator Rewards

gaiacli query distr rewards <delegatorAddress>


Managing Validators

Create a Validator

find your validator pubkey by running

gaiad tendermint show-validator

To create your validator, run the following command:

gaiacli tx staking create-validator --amount=1000000uatom --pubkey=$(gaiad tendermint show-validator) --moniker=“choose a moniker” --chain-id=<chain_id> --commission-rate=“0.10” --commission-max-rate=“0.20” --commission-max-change-rate=“0.01” --min-self-delegation=“1” --gas=“auto” --gas-prices=“0.025uatom” --from=<key_name>

Unjail Validator

gaiacli tx slashing unjail --from=<key_name> --chain-id=<chain_id>


Bonding and Sending Atoms

Bond atoms to a given validator

gaiacli tx staking delegate <validatorAddress> <amountToBond> --from <delegatorKeyName> --gas auto --gas-prices <gasPrice>

Here's an example of what an actual transaction should look like to be accepted by the network (bonding 3000 atoms in this example):

gaiacli tx staking delegate cosmosvaloper1ps7dmygt4wm72t8l9kdjetelhggsv8w77mdh33 3000000000uatom --from cosmospool --gas 130000 --gas-prices 0.025uatom --sequence 15 --ledger --chain-id cosmoshub-1

Withdraw Staking Rewards

gaiacli tx distr withdraw-all-rewards --from <delegatorKeyName> --gas auto --gas-prices <gasPrice>

ex value for flag: <gasPrice>=0.001stake

Unbond atoms from a validator

gaiacli tx staking unbond <validatorAddress> <amountToUnbond> --from <delegatorKeyName> --gas auto --gas-prices <gasPrice>

You will have to wait 3 weeks before your Atoms are fully unbonded and transferrable

ex value for flags: <validatorAddress>=cosmosvaloper1ps7dmygt4wm72t8l9kdjetelhggsv8w77mdh33, <amountToUnbound>=10000stake, <gasPrice>=0.001stake

confirm transaction goes through

gaiacli query tx <txhash>

Sending Atoms

gaiacli send --amount=10faucetToken --chain-id=<name_of_chain> --from=<key_name> --to=<destination_address>


Querying Governance Proposals

Query all proposals currently open for depositing

gaiacli query gov proposals --status deposit_period

Query all proposals currently open for voting

gaiacli query gov proposals --status voting_period

Query a proposal given its proposalID

gaiacli query gov proposal <proposalID>

Query All Governance Proposals

gaiacli query gov proposals

you can add the following json formatting argument

gaiacli query gov proposals -o json --indent

Query Governance Parameters

gaiacli query gov params


Participating in Governance

Submit a Proposal

gaiacli tx gov submit-proposal --title “Test Proposal” --description “My awesome proposal” --type <type> --deposit=10stake --gas auto --gas-prices <gasPrice> --from <delegatorKeyName>

<type>=text/parameter_change/software_upgrade ex value for flag: <gasPrice>=0.0001stake

Increase Proposal Deposit

gaiacli tx gov deposit <proposalID> <deposit> --gas auto --gas-prices <gasPrice> --from <delegatorKeyName>

Retrieve proposalID from $gaiacli query gov proposals --status deposit_period ex value for parameter: <deposit>=1stake

Vote on a Proposal

gaiacli tx gov vote <proposalID> <option> --gas auto --gas-prices <gasPrice> --from <delegatorKeyName>

Retrieve proposalID from $gaiacli query gov proposals --status voting_period <option>=yes/no/no_with_veto/abstain

Installing Cosmos in a Windows 10 Virtual Machine

How to Delegate Atoms to CosmosPool.org

How to Vote and Participate in Governance

gaiacli.txt · Last modified: 2019/06/15 12:53 by admin