Staking DIG in Cosmos using Ledger
A tiny write-up on how to stake DIG coin on a DIGCHAIN Cosmos-based blockchain using Ledger.
A tiny write-up on how to stake DIG coin on a DIGCHAIN using Ledger.
Pro-tip: Since DIG is a Cosmos-based blockchain you can stake using the same commands on any other Cosmos-based blockchain.
Make sure you have a recent golang installed.
1. Get digd
git clone https://github.com/notional-labs/dig
cd dig
make
2. Import your ledger account
Have a Cosmos app on your Ledger open and your Ledger connected to your device you are running digd
commands at.
digd keys add default --ledger
3. Pick your validator
NODE=https://rpc-1-dig.notional.ventures:443
digd --node $NODE query staking validators -o json | jq -r '[ "validator", "tokens", "commission", "commission_max_rate", "commission_max_change_rate", "name"], (.validators[] | select(.jailed != true) | [.operator_address, (.tokens|tonumber / pow(10; 6)), (.commission.commission_rates | (.rate | tonumber)*100, (.max_rate | tonumber)*100, (.max_change_rate | tonumber)*100), .description.moniker]) | @csv' | column -t -s"," | sort -nrk2 | nl -v 1
VALIDATOR=digvaloper1...
4. Query your balances
ACC=$(digd keys show default -a)
digd --node $NODE query bank balances $ACC -o json | jq -r '(.balances[0].amount | tonumber) / pow(10;6)'
5. Delegate some DIG
Make sure to not delegate all tokens, always leave at least 1 DIG for signing transactions!
NET="$(digd --node $NODE status | jq -r '.NodeInfo.network')"
digd --node $NODE tx staking delegate $VALIDATOR 5000000000udig --from default --sign-mode=amino-json --gas="auto" --gas-adjustment=1.2 --fees 3000udig --chain-id $NET
6. Query accumulated rewards
digd --node $NODE query distribution rewards $ACC $VALIDATOR -o json | jq -r '(.rewards[].amount | tonumber) / pow(10;6)'
7. Withdraw rewards
digd --node $NODE tx distribution withdraw-rewards $VALIDATOR --from default --chain-id $NET --sign-mode=amino-json --gas="auto" --gas-adjustment=1.2 --fees 3000udig
8. Query all validators you are delegating to
digd --node $NODE query staking delegations $ACC