x/staking
Transactions
tx staking create-validator
First of all, we can create a validator with the create-validator transaction, for example:
$ shareledger tx staking create-validator \
--from=[name_of_your_key] \
--amount=[staking_amount] \
--pubkey='{"@type":"/cosmos.crypto.secp256k1.PubKey", ...}' \
--moniker="[moniker_id_of_your_node]" \
--security-contact="[security contact email/contact method]" \
--chain-id="[chain-id]" \
--commission-rate="[commission_rate]" \
--commission-max-rate="[maximum_commission_rate]" \
--commission-max-change-rate="[maximum_rate_of_change_of_commission]" \
--min-self-delegation="[min_self_delegation_amount]"
## Transactions payload
{"body":{"messages":[{"@type":"/cosmos.staking.v1beta1.MsgCreateValidator"...}
confirm transaction before signing and broadcasting [y/N]: y
tx staking delegate [validator-addr] [amount]
Delegate an amount of liquid coins to a validator from your wallet.
tx staking unbond [validator-addr] [amount]
Unbond an amount of bonded shares from a validator.
tx staking redelegate [src-validator-addr] [dst-validator-addr] [amount]
Redelegate an amount of illiquid staking tokens from one validator to another.
Queries
query staking delegation [delegator-addr] [validator-addr]
With a given delegator address and the validator account that it is associated with, we can check the delegation by:
$ shareledger query chain-maind query staking delegation [delegator-addr] [validator-addr] --output json
{
"delegation": {
"delegator_address": "[delegator-addr]",
"validator_address": "[validator-addr]",
"shares": "[delegator_shares]"
},
"balance": {
"denom": "nshr",
"amount": "[delegator_balance]"
}
}
query staking delegations-to [validator-addr]
We can check all the delegations made to a specific validator:
$ shareledger query staking delegations-to [validator-addr] --output json
{
"delegation_responses": [
{
"delegation": {
"delegator_address": "[delegator-addr-1]",
"validator_address": "[validator-addr]",
"shares": "[delegator_shares]"
},
"balance": {
"denom": "basecro",
"amount": "[delegator_balance_1]"
}
},
{
"delegation": {
"delegator_address": "[delegator-addr-2]",
"validator_address": "[validator-addr]",
"shares": "[delegator_shares-2]"
},
"balance": {
"denom": "nshr",
"amount": "[delegator_balance_2]"
}
}
.......
],
"pagination": {
"next_key": null,
"total": "0"
}
}
query staking pool
We can check the amount of bonded and unbonded amount in the staking pool:
$ shareledger query staking pool --output json
{
"not_bonded_tokens": "[not_bonded_amount]",
"bonded_tokens": "[bonded_amount]",
}
query staking unbonding-delegation [delegator-addr] [validator-addr]
Query an unbonding-delegation record based on delegator and validator address
$ shareledger query staking unbonding-delegation [delegator-addr] [validator-addr] --output json
{
"delegator_address": "[delegator-addr]",
"validator_address": "[validator-addr]",
"entries": [
{
"creation_height": "[height_of_unbonding]",
"completion_time": "[completion_time]",
"initial_balance": "[unbonding_initial_balance]",
"balance": "[unbonding_balance]"
}
]
}
query staking validator [validator-addr]
We can query the details of a specific validator with its validator address by:
$ shareledger query staking validator [validator-addr] --output json
{
"operator_address": "[validator_address]",
// address of the validator's operator
"consensus_pubkey": "[consensus_pubkey]",
// the consensus public key of the validator
"jailed": "[jailed_or_not]",
// if it has been jailed from bonded status?
"status": "[validator_statuses]",
// validator status (bonded/unbonding/unbonded)
"tokens": "[total_tokens]",
// total delegated tokens
"delegator_shares": "[delegator_shares]",
// total shares issued to a validator's delegators
"description": {
"moniker": "[validator_moniker_id]",
"identity": "",
"website": "",
"security_contact": "[security_contact]",
"details": ""
},
// description terms for the validator
"unbonding_height": "[unbonding_height]",
"unbonding_time": "[unbonding_time]",
"commission": {
"commission_rates": {
"rate": "[commission_rates]",
// the commission rate charged to delegators
"max_rate": "[maximum_commission_rates]",
// maximum commission rate which validator can ever charge
"max_change_rate": "[maximum_rate_of_change_of_commission]"
// maximum daily increase of the validator commission
},
"update_time": "[last_update_time]"
// the last time the commission rate was changed
},
"min_self_delegation": "[min_self_delegation_amount]"
// validator's self declared minimum self delegation
}
query staking validators
A full list of validators and their details can be found by this query.