Design a new mechanism about stake and election #898
Replies: 4 comments
-
CKB chain:stake and mint/award contract on one cell. cross-chain(IBC):{
"stake_number":"",
"node_key/nodeId":"",
"election_rule": {
// ckb contract use for stake/mint, no need to define election_rule
},
} Axon chain:election process (system contract); contract Skeleton {
function candidateList() public;
function nodeHistory() public;
function getTotalVoteCount() public;
function getVoteCount(bytes32 nodeId) public;
function vote(bytes32 nodeId) public;
function registerNode(bytes32 nodeId) public;
} election interface contract: contract Rule {
function rulesOfWeight() public;
function rulesOfRole() public;
function rulesOfRandom() public;
function rulesOfpunishment() public;
function rulesOfreputation() public;
} |
Beta Was this translation helpful? Give feedback.
-
The general idea now: Program interface design:
Q&A
|
Beta Was this translation helpful? Give feedback.
-
The latest requirements indicate that both staking and election logic need to be placed on the L1. |
Beta Was this translation helpful? Give feedback.
-
Here is the latest version:This document describes the validator selection procedure in Axon, which is critical for ensuring the security and stability of the network. Validators are in charge of participating in the consensus process. In essence, anyone can participate in the validator selection process, by either staking their AT tokens in the stake type script or delegating their tokens to another participant via the delegate type script, who acts as a validator candidate with the delegated tokens. Afterward, a metadata type script selects the stakers with the highest stakes to become future validators. We have also designed the corresponding incentive mechanism, encoded in checkpoint type script, to encourage the participants to act honestly. Protocol DesignProtocol Participants
Key Concepts
OverviewWe describe the entire protocol as five sub-protocols—Initiation, Stake, Delegation, Validator Selection, Checkpoint Record, and Reward Distribution, according to their functionalities. Initiation is executed only at the beginning of Axon’s lifecycle, while the other five are executed continuously or repeatedly. Initiation. The founder prescribes the metadata of the first two epochs and initiates the Axon chain. The metadata is recorded in metadata cell, and it is written the genesis of Axon. Stake. The participant stakes AT to the stake type script. The kicker will apply all Stakers’ stake infos to Stake SMT cell periodically. Once staked, the participant becomes a staker and can participate in the validator selection process for the Axon validators. Stakers can increase their probability of becoming a validator by staking additional AT at any time, and can also redeem their staked AT. All these operations will take effort after two epochs. If a staker loses in the election process, their AT tokens will be promptly refunded. Delegation. The participant delegates or redeems AT to a staker. Similar to staking protocol, the operation will take effort after two epochs. And, the kicker will apply all Delegator’ stake infos to Delegate SMT cell periodically. Validator Selection. The process can be triggered by either the founder or a kicker. Both parties share the responsibility of updating the metadata at the beginning of each epoch. The metadata includes important information such as the basic configuration and the list of validators. The logic for calculating the new list of validators is encoded in a metadata type script. This script calculates the sum of tokens staked and delegated by each staker, using a fixed weight. Additionally, it verifies the Checkpoint Record. The axon validators update the checkpoint at the end of each period. Therefore, the checkpoint cell record the latest status of Axon. Reward Distribution. There is no explicit distribution process as all information needed for reward are stored on chain. Users(Staker or Delegator) can claim their reward any time they want if the reward’s lock time has expired. The claim history is recored in Reward SMT cell. Remember, users must claim their reward in one year. Otherwise, the expired reward will be cleared automatically. Protocol in DetailInitiationThis stage is initiated by the seeder. The seeder creates the following cells:
Once these cells are created, the seeder can start the Axon chain. The cells’ details are explained in the following section. StakeAssume the Any holder of AT can participate in staking by locking the token. All staking information related to the Axon chain is recorded in off-chain server in the form of SMT. While only the SMT root is stored in Stake SMT cell to reduce capacity cost. Every Axon-Based chain needs to created a unique Stake SMT cell. To ensure the stability of the staking information and prevent it from being altered, the staking operation will only become active after a minimum of two epochs, which will depend on the configuration at the time of staking. Stake within the same inauguration epoch by the same staker in one epoch will be merged and recorded. Besides, there is at most DelegateA delegate cell will be created every time a participant successfully stakes AT. This cell will store information about the delegation and the dividend ratio. Each staker needs create an unique delegate cell. Checkpoint RecordIn the Axon blockchain, the responsibility of submitting a checkpoint rotates among the nodes after each period ends. This ensures that the task of checkpointing is distributed among the nodes and helps to prevent any single node from having too much control over the process. A checkpoint refers to a stored record of the latest state of the Axon chain along with a proof of the latest block, which includes:
The latest status, excluding the proposed count, can be confirmed using proof. The proposed count can be verified through the state root. This serves to ensure the integrity and consistency of the blockchain and protect against any potential malicious attacks. The submission process is permissionless and non-rewarding. The process is a validator submits the latest status to a kicker, then the kicker builds the checkpoint-update transaction and sends it to CKB. The validation of checkpoint submissions is critical to ensure the liveness of the Axon chain. If the validators fail to submit, the Axon will be considered inactive. Reward DistributionAt the end of each epoch, the kicker will update metadata cell to store the propose counts of this epoch’s validators. As the Stake SMT cell and Delegate SMT cell all containes the history infos, we don’t need to distribute rewards at the end of every epoch. Instead, we only need to record the claim history of every user in Reward SMT cell. Because we can calculate every epoch’s reward of every user by referencing Stake SMT cell、Delegate SMT cell、Delegate Cells. Validator SelectionAt the start of epoch n, the metadata for epoch n + 1 can be updated by anyone, provided that the At this moment a metadata script elects the top n nodes with the highest amount of staking as the validator list of the next epoch. The amount of staking is determined by the sum of staking and delegate amounts, each with a different weight. According to the description in stake token, there are at most Kicker ProcessThe kicker is permissionless that can be deployed by anyone. A kicker has some functions:
Detail Implementation2-layer smtWe are taking stake as an example, the same argument applys to delegate as well. SMT patternFor every Axon-Chain, there will be dozens of stakers. If we store the infos of stakers on CKB, it will cost lots of CKB capacity which may worth lots of money. Thanks to the flexibility of CKB, we can utilize the so called SMT pattern to reduce space consumption. Instead of storing all data, we just need to store the SMT root of these data. To implement this idea, the Axon-chain developer needs to create a stake SMT cell to store the root. Moreover, we want to reduce staker‘s burden of claiming rewards,so we store the stake info of all epoches. Like the smt pattern mentioned above, we can implement a 2-layer smt to store the meta info on CKB. The layer2 smt root stored in Stake SMT cell is calculated like following: The key of layer 2 smt is epoch, value is smt root of layer 1 smt. The key of layer1 smt is account, value is stake token amount. The followint process is am example of verifying staker 1 have staked 100 AT in epoch 1.
Remember, to create a transaction of this kind, there must be a off-chain server storing this 2-layer smt. mitigate SMT cell competitionBecause there are so many stakers, if we let each staker change root in Stake SMT cell. Then there might be fierce competition for Stake SMT cell which leads to high possibility of stake failure. The staker may have to sign the stake transaction again and again. To mitigate this pain, the stake tx signed by users will only update their own Stake AT cell. A kicker will aggregate lots stake infos of all stakers to update Stake SMT cell. This kind of batch update will reduce cell competition by a large margin(especially for delegation). |
Beta Was this translation helpful? Give feedback.
-
Design a new mechanism of stake and election for axon.
Here is my design draft:
A mechanism which can supports user-customizable
Provide traits to define the node type and election algorithm in election, and users can customize the specific implementation mechanism.
At the same time, several built-in schemes are provided for users to choose. For example, the combination of "nominator, verifier, supervisor" or "nominator, agent, election committee" is provided in the node type;
The election algorithm trait provides "weighted phragmen algorithm" or "Verifiable Random Number (VRF)" for developers to choose.
The election process would like this:
Provided configurable options:
Has a voting function;
function as a validating node;
It can function as a governance committee member to determine the election process and arbitration;
Algorithms that support weighted types;
Algorithms that support verifiable random numbers;
Default built-in functions:
Considering that proof of non-existence may be required, use an SMT that readily provides this feature.
The record content is:
The pledge is on the CKB chain cell, and the pledge is managed using type script.
Functions to be provided:
The scheme to prevent verification nodes from not producing blocks:
Run the daemon process, when all the verifiers are not selected, or there is no block scenario, run a secondary, cyclic verifier selection algorithm in the background to avoid this situation, the verifier selected by this algorithm always generates secondary The secondary block will only take effect when the node does not produce a block.
Fork detection and fork accountability:
Fork detection uses multiple full-node communications to determine whether there is a malicious node, and fork accountability is used to track and identify malicious behavior on the network.
upgrade:
For example, the premise of "the more pledged, the more reliable the node" adjusts the weight of candidate nodes.
Consider using snapshots to record information. When the upgrade proposal is passed, the upgrade is completed by starting a new daemon process.
demo case for abstract:
Beta Was this translation helpful? Give feedback.
All reactions