Skip to main content

Interacting with your Node

Using the Marsd CLI‚Äč

Now that your chain is running, it is time to try sending tokens from the first account you created to a second account. In a new terminal window, start by running the following query command:

marsd query bank balances $MY_NODE_ADDRESS --chain-id my-test-chain

You should see the current balance of the account you created, equal to the original balance of stake you granted it minus the amount you delegated via the gentx. Now, create a second account:

marsd keys add recipient
# Put the generated address in a variable for later use.
RECIPIENT=$(marsd keys show recipient --address)

The command above creates a local key-pair that is not yet registered on the chain. An account is created the first time it receives tokens from another account. Now, run the following command to send tokens to the recipient account:

marsd tx bank send $MY_VALIDATOR_ADDRESS $RECIPIENT 1000000stake --chain-id my-test-chain --keyring-backend test
# Check that the recipient account did receive the tokens.
marsd query bank balances $RECIPIENT --chain-id my-test-chain

Finally, delegate some of the stake tokens sent to the recipient account to the validator:

marsd tx staking delegate $(simd keys show my_validator --bech val -a --keyring-backend test) 500stake --from recipient --chain-id my-test-chain --keyring-backend test
# Query the total delegations to `validator`.
simd query staking delegations-to $(simd keys show my_validator --bech val -a --keyring-backend test) --chain-id my-test-chain

You should see two delegations, the first one made from the gentx, and the second one you just performed from the recipient account.