This guide explains how to use command-line interface (CLI) commands to earn staking rewards as a validator or delegator.
NOTE: Before reading the following documents, it is recommended that you read delegators-guide-cli first. If you need to get OKT, you can get it here.
For more information on incentives, see Staking Rewards Algorithm.
OKTC employs Tendermint’s (BFT-DPoS) consensus algorithm. Users can use the command-line interface (CLI) tool to stake OKT and earn voting rights, and also have the option to give their votes to their desired validator node(s) for access to dividend rewards on the chain.
Note: Refer to Voting Weight Calculation.
// Deposit an amount of OKT to the delegator account.
// Deposited OKT in the delegator account is a prerequisite for adding shares. If add-shares was set before, this deposit will reuse the existing add-shares settings with the validators, respectively, and trigger a passive reward, which will automatically distribute the rewards to its own account (or reward withdrawal account).
// e.g., <amountToDeposit>=1024okt, <gasPrice>=0.00000001okt
exchaincli tx staking deposit <amountToDeposit> --from <delegatorKeyName> --gas auto --gas-adjustment 1.5 --gas-prices <gasPrice>
// Query all information on delegations and all shares recently added by a delegator.
// e.g., <delegatorAddress>=ex1c8w3jcfagaw8s2je3kk2dqftmyypzv3mrv4tcd
exchaincli query staking delegator <delegatorAddress>
// Add shares to one or more validators with all deposited OKT.
// Note: If shares are added multiple times, only the last setting will be used. If add-shares was set before, this operation will trigger a passive reward, which will automatically distribute the rewards to its own account (or reward withdrawal account).
// e.g., <validator-addr1, validator-addr2, validator-addr3, ... validator-addrN>=exvaloper1h0j8x0v9hs4eq6ppgamemfyu4vuvp2sle8094k,exvaloper1qrugh3kdhfz2a4cjx7ahuk6pkc7yy3pryv2jvw
// <gasPrice>=0.00000001okt
exchaincli tx staking add-shares <validator-addr1, validator-addr2, validator-addr3, ... validator-addrN> --from <delegatorKeyName> --gas auto --gas-adjustment 1.5 --gas-prices <gasPrice>
// Query all information on delegations and all shares recently added by a delegator.
// e.g., <delegatorAddress>=ex1c8w3jcfagaw8s2je3kk2dqftmyypzv3mrv4tcd
exchaincli query staking delegator <delegatorAddress>
Ordinary users can reference the following commands below to conduct staking and voting, hence obtaining dividend rewards.
Note: On every command, users can write -h or --help
to get more help info.
// Deposit an amount of OKT to the delegator account.
// Deposited OKT in the delegator account is a prerequisite for adding shares. If add-shares was set before, this deposit will reuse the existing add-shares settings with the validators, respectively, and trigger a passive reward, which will automatically distribute the rewards to its own account (or reward withdrawal account).
// e.g., <amountToDeposit>=1024okt, <gasPrice>=0.00000001okt
exchaincli tx staking deposit <amountToDeposit> --from <delegatorKeyName> --gas auto --gas-adjustment 1.5 --gas-prices <gasPrice>
// Query all information on delegations and all shares recently added by a delegator.
// e.g., <delegatorAddress>=ex1c8w3jcfagaw8s2je3kk2dqftmyypzv3mrv4tcd
exchaincli query staking delegator <delegatorAddress>
// Add shares to one or more validators with all deposited OKT.
// Note: If shares are added multiple times, only the last setting will be used. If add-shares was set before, this operation will trigger a passive reward, which will automatically distribute the rewards to its own account (or reward withdrawal account).
// e.g., <validator-addr1, validator-addr2, validator-addr3, ... validator-addrN>=exvaloper1h0j8x0v9hs4eq6ppgamemfyu4vuvp2sle8094k,exvaloper1qrugh3kdhfz2a4cjx7ahuk6pkc7yy3pryv2jvw
// <gasPrice>=0.00000001okt
exchaincli tx staking add-shares <validator-addr1, validator-addr2, validator-addr3, ... validator-addrN> --from <delegatorKeyName> --gas auto --gas-adjustment 1.5 --gas-prices <gasPrice>
// Query all information on delegations and all shares recently added by a delegator.
// e.g., <delegatorAddress>=ex1c8w3jcfagaw8s2je3kk2dqftmyypzv3mrv4tcd
exchaincli query staking delegator <delegatorAddress>
// Withdraw an amount of OKT and the corresponding shares from all validators.
// You will have to wait 14 days before your OKTs are fully unlocked and transferrable. This will also trigger a passive reward, which will automatically distribute the rewards to its own account (or reward withdrawal account)
// e.g., <amountToWithdraw>=1024okt, <gasPrice>=0.00000001okt
exchaincli tx staking withdraw <amountToWithdraw> --from <delegatorKeyName> --gas auto --gas-adjustment 1.5 --gas-prices <gasPrice>
// Query all information of delegations and all shares recently added by a delegator.
// e.g., <delegatorAddress>=ex1c8w3jcfagaw8s2je3kk2dqftmyypzv3mrv4tcd
exchaincli query staking delegator <delegatorAddress>
// Query all rewards earned by a delegator, optionally restrict to rewards from a single validator.
// e.g., <delegatorAddr>=ex1ja9xngm4zh0t442mse73ll30p7dczd49xqdhwu, [validatorAddr]=exvaloper1xkl5agjzqnjnptyat2dng2asmx8g5kllg7xamv
exchaincli query distr rewards <delegatorAddr> [validatorAddr]
// Withdraw rewards from a given validator address.
// e.g., <validatorAddr>=exvaloper1xkl5agjzqnjnptyat2dng2asmx8g5kllg7xamv,<gasPrice>=0.00000001okt
exchaincli tx distr withdraw-rewards <validatorAddr> --from <delegatorKeyName> --gas auto --gas-adjustment 1.5 --gas-prices <gasPrice>
// Withdraw all delegations rewards for a delegator.
// e.g., <gasPrice>=0.00000001okt
exchaincli tx distr withdraw-all-rewards --from <delegatorKeyName> --gas auto --gas-adjustment 1.5 --gas-prices <gasPrice>
Validators can reference the following commands below to set up a commission rate, withdraw a commission reward, etc.
Note: On every command, users can write -h or --help
to get more help info.
To manage the validator, you can read validators-guide-cli, it contains the following commands:
// Update an existing validator commission rate, ranging [0,1]. It can only be edited by the validator once every 24 hours.
//Default value is 1 (100%), i.e., no distribution rewards to users. If the value is set at 0.2 (20%), 80% will be allocated to users according to the voting ratio.
// e.g., <commission-rate>=0.2,<gasPrice>=0.00000001okt
exchaincli tx staking edit-validator-commission-rate <commission-rate> --from <delegatorKeyName> --gas auto --gas-adjustment 1.5 --gas-prices <gasPrice>
// Query the information of a validator with the given address.
// e.g., <validatorAddr>=exvaloper1xkl5agjzqnjnptyat2dng2asmx8g5kllg7xamv
exchaincli query staking validator <validatorAddress>
// Query available rewards of a validator address.
// e.g., <validatorAddress>=exvaloper1xkl5agjzqnjnptyat2dng2asmx8g5kllg7xamv
exchaincli query distr commission <validatorAddress>
// Query distribution outstanding (un-withdrawn) rewards for a validator and all their delegations.
// e.g., <validatorAddress>=exvaloper1xkl5agjzqnjnptyat2dng2asmx8g5kllg7xamv
exchaincli query distr outstanding-rewards <validatorAddress>
// Withdraw commission reward of validator with commission parameter. This will automatically distribute to its own account (or reward withdraw account).
// e.g., <validatorAddr>=exvaloper1xkl5agjzqnjnptyat2dng2asmx8g5kllg7xamv,<gasPrice>=0.00000001okt
exchaincli tx distr withdraw-rewards <validatorAddr> --commission --from <delegatorKeyName> --gas auto --gas-adjustment 1.5 --gas-prices <gasPrice>
exchaincli
command can query all the following info from the blockchain: account balance, number of bound tokens (OKT staked and voted for one or more validators), not yet withdrawn commissions, dividend rewards, etc.
Note: On every command, users can write -h or --help
to get more help info.
// Your balance will change after staking OKTs or withdrawing rewards.
exchaincli query account <yourAddress>
// This returns the execution result of a Tx
exchaincli query tx <txHash>
// Query the list of all validators.
exchaincli query staking validators
// Query the details of a validator with a given address.
// e.g., <validatorAddress>=exvaloper1xkl5agjzqnjnptyat2dng2asmx8g5kllg7xamv
exchaincli query staking validator <validatorAddress>
// Query the information of all shares recently added to a validator.
// e.g. <validatorAddress> exvaloper1xkl5agjzqnjnptyat2dng2asmx8g5kllg7xamv
exchaincli query staking shares-added-to <validatorAddress>
// Query the parameters of the staking module.
exchaincli query staking params
// Query the parameters of the distrbution module.
exchaincli query distr params
// Query the balance of the community pool.
exchaincli query distr community-pool
// Change the default withdrawal address.
// e.g., <withdraw-addr>=ex153z8qwxkqa5p2samfn8z50kr9pt8j6afs0am6e,<gasPrice>=0.00000001okt
exchaincli tx distr set-withdraw-addr <withdraw-addr> --from <yourKeyName> --gas auto --gas-adjustment 1.5 --gas-prices <gasPrice>
// Query the reward withdrawal address of a delegator.
exchaincli query distr withdraw-addr <delegator>
// Become a proxy by registration
// e.g., <gasPrice>=0.00000001okt
exchaincli tx staking proxy reg --from <yourKeyName> --gas auto --gas-adjustment 1.5 --gas-prices <gasPrice>
// Unregister the proxy identity.
// e.g., <gasPrice>=0.00000001okt
exchaincli tx staking proxy unreg --from <yourKeyName> --gas auto --gas-adjustment 1.5 --gas-prices <gasPrice>
// Bind proxy relationship
// e.g., <targetAddress>=ex153z8qwxkqa5p2samfn8z50kr9pt8j6afs0am6e, <gasPrice>=0.00000001okt
exchaincli tx staking proxy bind <targetAddress> --from <yourKeyName> --gas auto --gas-adjustment 1.5 --gas-prices <gasPrice>
// Unbind proxy relationship
// e.g., <gasPrice>=0.00000001okt
exchaincli tx staking proxy unbind --from <yourKeyName> --gas auto --gas-adjustment 1.5 --gas-prices <gasPrice>
// Query the addresses of delegators by a specific proxy
exchaincli query staking proxy <delegator>
// Query values for amounts stored in the staking pool.
exchaincli query staking pool