Skip to main content

Staking

Staking is a fundamental component of ZenChain's Cross-Liquidity Consensus Mechanism (CLCM). It involves locking up a certain amount of the network's native token, ZCX, as collateral to participate in network security and governance. Staking not only secures the network but also incentivizes participants through rewards and ensures that validators and nominators are aligned with the network's best interests.

Eras and Sessions

ZenChain uses a time-based structure to keep things organized, splitting time into eras and sessions.

An era in the ZenChain network is a fixed period, typically lasting 6 hours, during which validators participate in block production and transaction finalization. At the end of each era, the network evaluates the performance of validators and calculates rewards and penalties. These rewards are then distributed to validators and their nominators based on their contributions and performance throughout the era. Eras provide a regular cadence for assessing validator behavior, ensuring consistent incentives and penalties to maintain network security and integrity.

Sessions are shorter intervals within an era, with each era typically consisting of 6 sessions. Each session lasts for a set period (usually around 1 hours), during which validators take turns producing blocks and participating in consensus activities. The frequent occurrence of sessions within an era allows for continuous evaluation and adjustment of the validator set, enhancing the network's resilience and adaptability. Validators are rotated across sessions, providing multiple opportunities to validate and produce blocks, thereby contributing to the overall network health and stability. The results of these sessions collectively determine the validator's performance for the era, influencing the distribution of rewards and any penalties applied.

TermDuration (in time)Duration (in blocks)
Block6 seconds1
Session1 hour600
Era6 hours3600

Bonding and Exposure

Bonding is the process by which participants, both validators and nominators, lock up their ZCX tokens to participate in the staking mechanism. Bonded tokens are essentially staked as collateral to support network security and can earn rewards based on the validator's performance or the validators they nominate.

Exposure involves actively participating in the network's consensus mechanism by either validating blocks or nominating validators. Staked tokens remain locked and cannot be freely transferred or traded until they are unbonded.

To participate in consensus by becoming a nominator or validator, you must have a minimum amount of ZCX staked.

RoleMinimum Stake
Nominator ZCX
Validator ZCX

Unbonding

Unbonding is the process of withdrawing staked tokens from the network. When a participant decides to stop staking, they initiate the unbonding process, which takes a predefined period of two eras (known as the unbonding period) to complete. During this period, the tokens remain locked and cannot be used, transferred, or traded. The waiting period begins after you request to unstake (aka "unbond") your currency. Once the bonding period culminates, you can then withdraw your unbonded funds. The unbonding period serves as a security measure to ensure that consensus participants cannot immediately withdraw their stake and act maliciously without consequences.

Fast-Unstaking

If you have staked currency, but your stake is not "exposed" in the current era, then you can unstake your currency without waiting for the full bonding duration. Being "exposed" with a validator, from the point of view of the staking system, means earning rewards with the validator, and also being at risk of penalties with the validator. Being exposed is equivalent to being an active nominator or validator. To register for fast unstake, you must provide a deposit of 1 Gwei ZCX, which is lost if you made the request without being eligible.

Validating

Validators are the backbone of the ZenChain network, responsible for producing blocks, validating transactions, and participating in consensus to secure the network. To become a validator, a participant must bond a significant amount of ZCX tokens and be elected through the network's election process. Validators earn rewards based on their performance and the amount of stake they secure, but they are also subject to slashing if they fail to fulfill their responsibilities or act maliciously.

Nominating

Nominators are participants who delegate their stake to one or more validators to support network security. By nominating validators, these participants can earn a share of the rewards generated by the validators they support.

Nominators are incentivized to select reliable and performant validators to maximize their rewards and minimize the risk of slashing. Since a validator's reward distribution does not increase with their total stake, nominators are also incentivized to back validators who have lower total support, since doing so maximizes their own share of the validator's staking rewards. The staking system is designed to incentivize participation, decentralization, and network security.

Nominators select a set of validator targets to support, but the staking system will assign their backing to a subset of their targets in any given era. The subset is determined by the election process and changes at the start of each era.

Chilling

Chilling is an action that validators or nominators can take to temporarily pause their participation in staking activities without unbonding their tokens. This allows participants to take a break from active participation without fully withdrawing their stake or undergoing the unbonding process. Chilling is useful for participants who may want to avoid the risk of slashing without losing their staked position.

Rewards

Staking rewards are distributed at the end of each era based on the performance of validators and the stake they hold or have been nominated. Validators receive rewards for producing blocks and participating in consensus, while nominators receive a share of the rewards based on the performance of the validators they support. Rewards are designed to incentivize honest and reliable participation in the network.

Claiming

Once rewards are distributed at the end of an era, both validators and nominators need to claim their rewards. Claimed rewards are immediately available for use, while unclaimed rewards may accumulate over multiple eras. Reward payouts must be claimed within 84 eras (21 days), else they are lost. The ZenChain station and Staking Smart contracts provide mechanisms for claiming payouts.

Rewards are stored in pages, with up to 64 nominators' rewards stored on each page. If a page is claimed, rewards are distributed for all the nominators on the page.

Since pages are associated with validators, each nominator will have a page of rewards to claim for each of the validators they are nominating. In practice, since a nominator shares each page with up to 63 other nominators, a nominator will not typically need to claim all of their pages. Users may often find that other stakers have already initiated reward payouts on their behalf.

A validator's rewards are distributed in proportion to the nominators' rewards on the claimed page. All of a validator's pages must be claimed for the validator to receive all of their rewards. Validators are therefore incentivized to claim their associated pages and help distribute rewards to their nominators.

Slashing

Slashing is a penalty mechanism designed to protect the network from malicious behavior or poor performance by validators. If a validator acts maliciously, such as double-signing blocks or failing to validate transactions correctly, they and their nominators can be subject to slashing. This results in the loss of a portion of their staked tokens, serving as a deterrent against misconduct and ensuring network integrity.

Election Process

ZenChain uses Phragmen's Election Algorithm to select validators for each era. This algorithm optimizes the assignment of nominators to validators, ensuring a fair and balanced distribution of stake across the network. The election process occurs at the beginning of each era, taking into account the total stake of each validator and their nominators to determine the optimal validator set.

The validator election process is a multi-phase system:

  1. Signed Phase: Anyone can submit election solutions as signed transactions. The transaction requires a currency deposit that is lost if an invalid solution is submitted.
  2. Unsigned Phase Validators use off-chain workers to compute and submit election solutions as unsigned transactions.
  3. Election Phase The solutions, ordered by score from best to worst, are validated in order. The first valid solution is kept. All remaining (unchecked) solutions are discarded and deposits are returned.

Submitting a solution is not equivalent to voting; rather, it is equivalent to counting votes that have been cast by stakers who have already chosen which validators to nominate. Since the election algorithm is relatively computationally burdensome, the election process is designed to securely perform the computation off-chain. You can use the Polkadot Staking Miner tool, which is compatible with ZenChain's election system, to generate and submit solutions during the signed phase.