Bonding and proof-of-stake
Bonded tokens
Any account on Namada can bond or stake NAM tokens to any validator in the proof-of-stake system. When NAM tokens are bonded to a validator, that validator, if it is a member of the consensus set, may use those tokens as voting power to vote or sign newly proposed blocks.
These validators earn some block rewards for doing so, and the original stakers of those tokens earn a proportional share of the validators' block rewards.
The non-validator accounts that bond NAM to a validator are known as delegators. Validators may also bond NAM tokens to themselves.
Becoming a delegator
In order to become a delegator, you must first have an account with positive NAM balance. If you do not have an account, you can follow the instructions here to create one.
Once you have an account, you can bond your NAM to a validator. Bonding (or delegating) to a validator is the same as staking with a validator.
First, you may want to list some available validators you can stake to:
namadac bonded-stake
Once you've found the address of your favourite validator, you can bond to them with the following command:
namadac bond --source <delegator-address> --validator <validator-address> --amount <amount>
Because the validator alias sometimes clashes with the alias for the implicit account and or established account in the wallet, it is recommended to use the validator address instead of the alias. In order to find the validator address, you can use the following command:
namadaw list --addr | grep <validator-alias>
then make sure it is the corresponding tnam
address.
The <delegator-address>
is your account address from which you would like to stake NAM tokens. Validators who would like to self-bond do not need to provide the --source
argument.
If you have the alias for an address saved in your wallet, you can also pass it as an argument.
Once the transaction is submitted, the bond will become active at the pipeline length relative to the current epoch, which is some number of epochs in the future relative to the current one. Currently, this value is 2 epochs.
The pipeline length of the chain and other important proof-of-stake parameters can be queried from the chain with the following command:
namadac query-protocol-parameters
Unbonding
Unbonding is the process of removing your bonded NAM from a validator, and this must be done before attempting to withdraw your previously bonded tokens.
This process is identical to unbonding tokens from a validator.
The command to unbond is similar to the bonding command:
namadac unbond --source <delegator-address> --validator <validator-address> --amount <amount>
After a successful unbond transaction, the unbonded NAM tokens will be available for withdrawal after pipeline_length + unbonding_length + cubic_slashing_window_length
epochs. Once again, the values of these three parameters can be queried from the chain.
Withdrawing
When the full unbonding period has passed, you can withdraw the unbonded NAM using the following command:
namadac withdraw --source <delegator-address> --validator <validator-address>
This transaction will immediately transfer all fully unbonded NAM tokens back to the delegator-address
account, increasing your transferable balance.
You may also query some information regarding how many NAM tokens are available for withdrawal with the following command:
namadac bonds --owner <delegator-address>
Redelegating
In certain circumstances, you may want to switch the validator that holds your bonded tokens. This could be because your original validator has dropped out of the consensus set or has been deactivated or jailed and slashed for misbehaving.
You can accomplish this with a redelegating the bonded tokens rather than unbonding, withdrawing, and then bonding again. Use the following command:
namadac redelegate --owner <delegator-address> --source-validator <source-validator> --destination-validator <destination-validator> --amount <amount>
The delegator-address
is your address, the source-validator
is the validator that currently holds your bond, and the destination-validator
is your desired new validator to hold your bond.
Your new bond will be active and begin contributing to the destination-validator
's voting power after the pipeline length has passed. It will no longer be held by the source-validator
at this epoch as well.
Claiming rewards
Inflationary rewards for proof-of-stake are computed and minted once per epoch, at the very beginning of a new epoch.
In order to claim rewards that are owed to you for bonded NAM tokens, run the following command:
namadac claim-rewards --source <delegator-address> --validator <validator-address>
Successful execution of this transaction will immediately transfer the the reward tokens you are owed to your delegator-address
, incrementing your transparent balance.
Additionally, you can query the pending reward tokens without claiming by running:
namadac rewards --source <delegator-address> --validator <validator-address>
Interacting with jailed validators
When the validator that holds a bond is jailed, there are restrictions on what can be done with the bond.
Bonding tokens is always permitted to any validator, even if it is jailed.
Unbonding and redelegating from a jailed validator is not permitted if that validator is enqueued to be slashed (it is frozen), as described in this section on jailing validators for protocol misbehaviors. Otherwise, unbonding and redelegating is permitted.