Basic Series-1|ChainX Node

ChainX
3 min readDec 10, 2019

--

Node registration

  • Parameters: node name
  • Setting: anyone can submit a name which should be less than 16 bytes, and cannot be repeated.

Initialize the vote age of the node and set the initial status to “opt out of election”.

Node update

  • Parameters: website, profile, block account ID, status (opt in election| opt out of election)
  • Setting: only registered nodes can call an update; the website byte range is 4 to 24, allowing only numbers, uppercase and lowercase letters, and. , and the profile is less than 128 bytes.

If the number of opt-in nodes is less than the minimum number of validator nodes, then qualified nodes are not allowed to opt out. In other cases, the node information is updated directly.

Trust node setting

  • Parameters: chain ID, profile, hot public key, cold public key
  • Setting: Only the opt-in nodes can call the process; currently the chain is only for Bitcoin with correct public key format.

Update the node’s trust settings because only after chains set the trust correctly can they be elected as trust nodes.

Casting a vote

  • Parameters: node account ID, increased votes, notes.
  • Setting: anyone can call the process; the node account must exist and the increased amount of votes must be less than the user’s PCX available balance; notes are less than 64 bytes.

If users cast their votes, accordingly the user and node’s vote age should be updated.

Retracting a vote

  • Parameters: node account ID, retracted votes, notes.
  • Setting: Only users who have voted for the node can call the process; the retracted amount must be less than or equal to the original voting; notes are less than 64 bytes.

After users retract their votes, a record is created and accordingly the user and node’s vote age should be updated. The height of unfreezing the redeemed needs to be recalculated (redeeming the collaterals of a node or retracting votes). After the user retracts a node’s votes, the redeemed assets yet still unfrozen cannot generate revenue.

Unfreezing the redeemed

  • Parameters: node account ID, index
  • Setting: users who have the redeeming operation corresponding to the index can call the process, and the current height must be higher than the unlocked height.

The redeemed is to be converted into users’ balance with the record deleted.

Withdrawing interest

  • Parameter: asset ID
  • Setting: Only users who hold the asset can call it.

Interest receivable which is calculated according to the above-mentioned method is to be issued to users’ balance from the prize pool.

Node election

The validator nodes are elected every election cycle. Nodes that are qualified to stand the election must:

  1. already be a candidate
  2. attract at least 1 vote

Nodes that meet the above conditions can stand the validator node election and will be ranked according to the number of votes they get.

Original Resource: https://github.com/chainx-org/ChainX/wiki/Staking

About ChainX

--

--

ChainX
ChainX

Written by ChainX

ChainX is a BTC Layer 2 solution compatible with EVM that utilizes Bitcoin as a gas fee, serving as the predecessor network of BEVM.

No responses yet