A guide to staking on the KiChain
Welcome to the Ki-steps series, a sequence of how-to posts where we explain the detailed steps to perform more or less advanced tasks on the KiChain. In this post, we will discuss the staking aspect in the KiChain and explain how to delegate you XKIs as well as the staking related best practices.
Whether you've been around the blockchain party for a long while now, or you just landed in this rough concept-abundant terrain, you most likely have already heard of the word staking /steɪk/+ing. This concept was introduced to the blockchain domain with the emergence of the Proof of Stake (PoS) blockchains. It has since been pushed to the front of the scene by the democratisation of chains using the voting based variants of the PoS such as the delegated PoS (ARK ecosystem), the bonded PoS (Cosmos Based chains), the nominated PoS (Polkadot), etc...
The KiChain is a Cosmos based blockchain and staking is a core functionality of it. Hereafter we will tackle the various aspects of this functionality and take you through the step of being part of the staking ecosystem.
On rewards, inflation and staking
Let's start with the big picture of staking in the KiChain. In a nutshell, XKI holders can lock their tokens in favour of one or more validators and improve the power of those validators in the validation process. In return, holders are rewarded a part of the inflation and fee tokens acquired by those validators through the validation process.
Now let's get into some details to clarify the previous statement and its concepts. Bullet points are a good mean of structuring. So bullet points it is!
- Validation rewards: In a blockchain, validators are the active actors that ensure the integrity and security of the network and its asset transactions. Their task consists —briefly — in validating the transactions, voting over the next state of the blockchain and committing it when a consensus is reached. To recompense these validators for their effort in maintaining their node and securing the network, they receive token rewards from two different sources. The first is the tokens created at each block validation (a.k.a inflation tokens), and the second is the fees found in the transactions included in the validated blocks.
- Inflation tokens: inflation tokens are tokens created (a.k.a minted) at each validation cycle. The reason they are called "inflation tokens" is related to the impact of their creation on the system economics. Indeed, increasing the supply of any asset decreases its value. This phenomena is called inflation. In the KiChain, the inflation rate varies between 2% and 14% starting at 8% at the chain launch. Its change is ruled by the same model used by the Cosmos Hub chain. That is, starting its initial value it increases or decreases depending on the ratio of bonded tokens over the total token supply (800M XKI). When this ratio is less than 67%, the inflation increases to its maximal value. Otherwise it decreases to its minimal value. Both the increase and the decrease are gradual and linear. Their slope is computed with respect to the remaining tokens to be created to achieve the goal yearly inflation. Varying the inflation rate based on the bonded supply is one way of incentivising the system actors to reach a sweet spot where the liquidity serves the token value. To keep this post simple, I won’t go into the details of this aspect.
- Transaction fees: Fees are extra amount of tokens payed by the initiator of a transaction to allow it to be broadcasted, validated and included in a block. Fees serve two purposes. First, they act as a defense mechanism against spammy transactions that aim at flooding the network. Second, they constitute a pay off to the block producers (i.e., validators) for their job in validating the transactions.
- Staking: as mentioned earlier, staking consists of locking a certain amount of tokens in favour of a given set of validators. Locking the tokens means that, in the delegator balance, an amount equivalent to the stake is no more transferable (unless it is undelegated first). The higher the stake of a validator is, i.e., the higher the number of tokens people have delegated to them, the more blocks they propose, and thus, the more reward they capture.
- Distributions: indeed, a validator who profits from their delegators' stake, needs to pay them back their share of the collected reward. Usually, a validator operator sets a commission rate on the collected reward. This commission constitutes their real revenue. The remaining rewards are distributed over all of their delegators proportionally to their relative stake.
Practically, the aforementioned rewards are not equal to 100% of the created tokens and collected fees. In fact, 4% of the created tokens and collected fees go directly to the community pool. And up to 96% go to the validators as rewards. In contrast to Cosmos hub where the rewards are distributed to all of the validators at each height (with a slight advantage to the block proposer), in the KiChain all of the rewards at a given height goes to the block proposer for that height.
The numerical values of these parameters and their semantic meaning are just the tip of the iceberg. Indeed tuning them is part of a larger business model and precise tokenomics that aim at supporting the value of the token by tying it to a real world usage and value. For you business folks out there, tune in for the reveal of this hidden part of the iceberg in a future post.
Staking related actions
The staking process consists of 4 main actions. Following are the definitions of these actions:
- Delegate : this bonds a given amount of tokens to a given validator.
- Undelegate: this unbonds the given amount of tokens from the given validator. This requires an existing delegation for that validator and implies a lock up period of 21 days on the unbonded tokens.
- Redelegate: This transfers all or a part of a delegation amount from one validator to another validator. This requires an existing delegation for the source validator.
- Withdraw rewards: this withdraw all the pending rewards for a given delegation. Withdrawn tokens are not locked up and can be transferred or delegated.
- Withdraw commission: If the delegation concerns a validator operator (that is, the wallet used to create a validator is delegating tokens to that validator), the withdraw reward can be extended to withdraw also the commissions of the validator.
The following practical points are important to know to enhance you staking experience on the KiChain:
- Every new staking action leads to an automatic withdrawal action. That is, if you delegate new tokens, undelegate tokens or redelegate tokens to/from one of the validators to whom you have an ongoing stake, your pending rewards for this particular validator are automatically withdrawn.
- If you need to change your delegation destination, i.e., stop (partially or entirely) delegating your tokens to one validator and start delegating the same amount to a new validator, use the redelegate action rather than "undelegate + delegate" actions. The former prevents the loss of the staking rewards during the lockup period that the latter implies.
- All of the staking actions require fees. Therefore, it is mandatory to keep a couple of tokens of a wallet's total balance not delegated. These tokens will serve to pay your new delegation and (mainly) withdrawal actions.
Is staking worth it?
Yes it is!
As mentioned above, creating new tokens creates inflation. The best way of maintaining the value of your tokens in a growing supply is to take your share out of the newly created supply (otherwise someone else is getting it!). Your staking rewards constitutes in reality this share. Moreover, when it comes to an ecosystem with a real world utility and value such as the Ki ecosystem, this share is not only helping you maintaining the value of your tokens, but rather increasing it.
If you are interested in getting some insights on how many tokens you can gain w.r.t. to the amount of your stake you can simply do the math yourself to get a rough estimate. Here are some guidelines:
- Check the inflation rate on the Ki Explorer. Say it is
i
. - Suppose the ratio of bonded supply over total supply is
b= B/S
whereB
is the number of bonded token andS
is the total supply. (You can check the value of b on the Ki Explorer as well) - Suppose you have a stake of
s
XKIs. - Suppose you are voting for a validator with
c
in commission rate. - Your annual yield is equal to :
y = ( 1 — c ) * ( s / b * i )
This is only a rough estimate of the inflation part of your delegation reward. The calculation does not include the transaction fees neither.
How to stake XKIs?
In the Ki Desktop Wallet
This section is recycled from a previous post where we introduced the Ki Desktop wallet. Here, I will assume that you already have your app up and running and your wallet imported and fed with XKIs
If you did not download and install the Ki Desktop wallet yet or you are not sure about how to use it, I recommend you checking this post first. You will find all the details you need to get started with using the desktop wallet.
Staking tokens in the Ki Desktop wallet is as easy as heading to the Delegation tab in the wallet view, picking the validator to whom you want to delegate your tokens from the list, and clicking on delegate at the right of the corresponding row
In the delegation form simply fill the amount of tokens that you want to stake to the chosen validator and enter your wallet password before clicking on delegate.
If you are willing to delegate all of your tokens, simply use the All shortcut found right above the amount field. This will fill in the value of your total balance minus 1 XKI that you can use to pay your transaction fees as explained earlier.
To undelegate or redelegate your tokens, follow the same process while choosing the correspondant function (Undelegate or Redelegate) in the validator list. Note that, by the wallet taxonomy, the redelegation function will move the tokens delegated to the selected validator to a new one. That is, when redelegating, select in the validator table the source validator.
To withdraw your rewards, a similar process needs to be followed. This time though, head to the withdraw tab. The list of validators to whom you are currently voting is shown. At each row, next to the validator name, the pending rewards are displayed. To the right of the row you can find a withdraw button. Click on it to open the withdraw form. Select whether you want to withdraw the rewards, the commissions or both, fill in your password and hit withdraw. Note that you can not determine the amount of rewards to withdraw. A withdraw action withdraws all of the pending rewards for the selected validator.
Starting the version 0.3.0 of the Ki Desktop Wallet, you can withdraw all of your pending rewards for all of the validators in a single transaction using the withdraw all button. This does not include the commission for validator operators.
Using Ki-tools
If, for some strange reason, you prefer to use your terminal to stake your tokens, we got you covered! here is how you can proceed:
To delegate complete and run the following command:
kicli tx staking delegate <VALIDATOR ADDRESS> 1000uxki — from <YOUR WALLET> --home kicli/ --chain-id kichain-1 --gas-prices=0.025uxki
where <YOUR WALLET>
is your wallet name in the kicli
keystore, <VALIDATOR ADDRESS>
is the validator operator address that starts with kivaloper1…
an --gas-price
is a flag that sets the gas used to compute the fees. The value of the latter might change depending on the node which your kicli
is querying.
To undelegate complete and run the following command:
kicli tx staking unbond <VALIDATOR ADDRESS> 1000uxki — from <YOUR WALLET> --home kicli/ --chain-id kichain-1 --gas-prices=0.025uxki
To redelegate complete and run the following command:
kicli tx staking redelegate <SOURCE VALIDATOR ADDRESS> <DESTINATION VALIDATOR ADDRESS> 1000uxki — from <YOUR WALLET> --home kicli/ --chain-id kichain-1 --gas-prices=0.025uxki
And finally to withdraw your reward, you guessed it, complete and run the following command:
kicli tx distribution withdraw-rewards <VALIDATOR ADDRESS> --from <YOUR WITHDRAW WALLET> --home kicli/ --chain-id kichain-1 — gas-prices=0.025uxki
if you are a validator operator and want to withdraw your commissions along with the staking rewards add the --commission
to the previous command.s
How to choose your validators?
Now that you know how to stake you tokens, it is time to choose the validators who will get your delegations. As explained above, each validator sets a commission that is their share of their delegators' reward. Naturally, delegating your tokens to a validator with a low commission is more profitable from an economical perspective. However this is not the only criterion.
The delegators in the Ki Chain (and Tendermint based chains in general) are as responsible as their validators in the cases where the latter misbehave. In fact, when a validator degrades (accidentally or intentionally) the performance or the security of the blockchain, they get punished. And so are their delegators.
For instance, when a validator misses a lot of consecutive blocks, i.e., they don't sign them, the stake of this validator is slashed and the validator is jailed. Jailing means that the validator is temporarily banned from the validator list and can no more propose blocks and receive rewards. The delegators of this validator incur the same penalty as their delegated tokens get slashed and they stop receiving their delegation reward for the whole jail duration.
There are various possible security and performance violations with their correspondent, more or less, sever punishments. We will not enter into the details of this aspect here but it is important to mind this factor when selecting your validators. One needs to choose a reliable validator. To assess this reliability, multiple indicator can be sought. Here are some tips:
- Delegate to validators you know personally.
- Check the validator's online content about their security guarantees and infrastructure.
- Rely on the transitive trust by searching in their delegators list for wallets you can trust.
- Inspect their presence and history on other blockchains.
- Follow their on chain performance in our dedicated monitoring channel.
Take away
Here is a summary of what you should retain from this post:
- Delegating allows you to get your share of the validation reward and the incoming transaction fees.
- Delegating can be easily done through the Ki Desktop wallet.
- Delegating can be also done using the Ki Tools.
- Undelegating tokens locks the undelegated amount for a period of 21 days.
- Use the redelegate function rather than “undelegating then delegating”. This prevents the loss of the staking rewards during the lockup period.
- Never delegate all of your tokens. Always keep a couple of XKIs aside to pay for your transaction fees.
- Choose your validators wisely !