Useful CLI commands

General

Set the default chain for migalood to use:

migalood config chain-id <chain-id>

Mainnet chain ID: migaloo-1 Testnet chain ID: narwhal-1

Set the default RPC for migalood to use:

migalood config node <rpc-endpoint>

Queries

Get native/IBC token balances:

migalood q bank balances <wallet/contract-address> --output json

Query contract:

migalood q wasm contract-state smart <contract-address> <query> --output json

The query needs to be a JSON object, e.g. {"balance": {"address": "migalood1..."}}

Get contract state:

migalood q wasm contract-state all <contract-address> --output json

Get contract metadata:

migalood q wasm contract <contract-address> --output json

Transactions

Upload a wasm binary on chain:

migalood tx wasm store <wasm_file> --from <from> --chain-id $CHAIN_ID --node $RPC

Uploading a wasm binary will return a code_id, which you can use to instantiate the contract in a subsequent step.

Instantiate a contract:

migalood tx wasm instantiate <code-id> <instantiate_msg> --label "Contract label" --from <from> --chain-id $CHAIN_ID --node $RPC

The instantiate_msg needs to be a JSON object, e.g. {"owner": "migalood1..."}

Execute a command on a wasm contract:

migalood tx wasm execute <contract_addr> <message> --from <from> --amount <coins,optional> --chain-id $CHAIN_ID --node $RPC

The message needs to be a JSON object, e.g. {"owner": "migalood1..."}

Send native/IBC tokens:

migalood tx bank send <from> <to> <amount> --chain-id $CHAIN_ID --node $RPC --from <from>

Keys

See keys on the current box:

migalood keys list

Add a key:

migalood keys add <name>

The mnemonic of your key will be displayed on screen only once. Write it down and keep it safe.

Import a key from a mnemonic:

migalood keys add <name> --recover

Delete a key:

migalood keys delete <name>

Staking

Create validator:

migalood tx staking create-validator \
--amount 1000000uwhale \
--commission-max-change-rate "0.05" \
--commission-max-rate "0.10" \
--commission-rate "0.05" \
--min-self-delegation "1" \
--pubkey=$(migalood tendermint show-validator) \
--moniker 'Moby Dick' \
--website "https://migaloo.zone" \
--identity "496BD02G58A7E1O9" \
--details "Validator description." \
--security-contact="email@validator.com" \
--chain-id $CHAIN_ID \
--node $RPC  \
--from KEY

Delegate tokens:

migalood tx staking delegate <validator> <amount> --from <from> --chain-id $CHAIN_ID --node $RPC

Governance

Query gov proposal:

migalood q gov proposal <proposal-id> --chain-id $CHAIN_ID --node $RPC --output json | jq 

Vote on gov proposal:

migalood tx gov vote <proposal-id> <vote_option> --from <from> --chain-id $CHAIN_ID --node $RPC

Vote options are: yes, abstain, no, no_with_veto

Validators and Nodes

Check the status of your node:

migalood status

Get your node ID:

migalood tendermint show-node-id

Check if your node is catching up:

# Query via the RPC (default port: 26657)
curl http://localhost:26657/status | jq .result.sync_info.catching_up

Your peer address will be the result of this plus host and port, i.e. @:26656 if you are using the default port.

Get your valoper address:

migalood keys show <your-key-name> -a --bech val

Last updated