ChainX Launches 2.0 Public Testnet to Recruit Genesis Nodes

ChainX
7 min readNov 5, 2020

Since the official launch on May 25,2019, ChainX has followed a long and tortuous path. ChainX is the first chain developed and launched in the Polkadot ecosystem based on Substrate, which is dedicated to breaking barriers among assets in different chains and create the ecosystem of multi-currency integration.

Polkadot officially launched Substrate 2.0 in September 2020, introducing on-chain governance, treasury module, etc. In order to open a new chapter of community governance and to prepare for access to the Polkadot slot. ChainX will upgrade the main network to Substrate 2.0. After two months of effort, it has been basically achieved. The public Beta launches today and will last for three weeks.

The 2.0 test network includes Node election, asset mining, , Web Wallet, Browser, Chain Governance, and so on. you can join the tg group to get the test token. https://t.me/joinchat/KvooDx2icSTvuZ36xnUx6g

Wallet Address:https://dapp-v2.chainx.org/

Browser address: https://scan-v2.chainx.org/

How to establish a node:

节点搭建文档:https://chainx-org.github.io/documentation/zh/docs/validators/

Why should nodes participate in the 2.0 test net?

1. Excellent test nodes have the opportunity to become a genesis node of the ChainX 2.0 main net

For the stability of the ChainX 2.0 network on the starting stage, the genesis blocks are not jointly generated by the 30 validators of 1.0, instead,we will select the nodes that performed well in the 2.0 testnet phase to participate in the network block generation with PolkaX nodes. The mainnet startup phase will last for 3 days, after which all nodes will resume block generation.

2. Genesis earnings during the main net launch will serve as incentives for the entire test net.

In the 2.0 start-up phase, because not all validators produce blocks together, users cannot normally receive staking proceeds. After the start-up phase ends, the original state will be restored. All the profits obtained by the nodes in the start-up phase of the 2.0 main net will be contributed to incentives during the 2.0 test net, which will be distributed to users and nodes participating in the test net.

3. Participate in the test to get Scores and divide the test net incentive prize pool

3.1- Any operation of the node caused by the ChainX 2.0 test network to collapse will be awarded 20 scores

3.2 According to the node’s mortgage voting to obtain mortgage ranking points, the levels are divided as follows:

  • First place: 30 scores
  • Second place: 29 scores
  • And so on;

3.3 According to the number of votes obtained and the mortgage by the node, the ranking scores will be obtained. The ranks are as follows:

  • First place: 30 scores
  • Second place: 29 scores
  • And so on;

3.4 Any bug found in the test could be submitted to https://github.com/chainx-org/chainx-testnet-bug-bounty and the issue is submitted according to the template format, and corresponding points are obtained according to the importance level of the issue. The levels are divided as follows:

  • CRITICAL-Nodes: get 10 scores;
  • IMPORTANT-Nodes: get 5 scores;
  • USEFUL-Nodes: Get 2 scores.

3.5 Finally, the top 50 nodes would be selected to share the node incentive prize pool, which is 6000PCX, according to the proportion of each node to the total scores of the corresponding level:

  • Level 1: Top 1–5, 3000 PCX will be divided up in proportion to the ratio of the scores
  • Level 2: Top 6–20 , 2000 PCX will be divided according to the ratio of the scores
  • Level 3: Top 20–50 , 1000 PCX will be divided according to the ratio of the scores

Before participating in the test, what preparations should the node make?

  1. Preparations: A VPS — The easiest way is to use a cloud host, you can choose any host provider freely.
  2. Testnet hardware configuration: CPU 2 cores, memory 2G, bandwidth 1M.
  3. Install the ChainX program: Either Compile from source or Download the binary

Option A: Compile from source

We assume that you have installed Rust nightly and wasm32-unknown-unknown:

$ rustup install nightly-2020-09-30
$ rustup override set nightly-2020-09-30
$ rustup target add wasm32-unknown-unknown --toolchain nightly-2020-09-30

Next, you need to follow the steps below to complete the compilation:

$ git clone https://github.com/chainx-org/ChainX
$ cd ChainX
$ git checkout develop-2.0
$ cargo build --release

After the compilation is complete, the chainx program will be in the target/release/ directory.

Option B: Download the compiled binary directly

Download the provided binary from the GitHub release page (https://github.com/chainx-org/ChainX/releases).

Sync to the latest height of the testnet chain

Start synchronizing the blockchain with the following command:

$ ./chainx --chain=testnet --pruning=archive

After the synchronization is complete, restart the node in validator mode:

$ ./chainx --chain=testnet --validator

Or start syncing directly in validator mode:

# when using --validator , the archive mode will be enabled by default, namely --pruning=archive
$ ./chainx --chain=testnet --validator

Note, however, that you must wait for the synchronization to complete and set the Session Keys before letting the node participate.

If synchronization is abnormal, please ensure that the system time is consistent with the network time, and then synchronize after deleting the database.

Configuration file

For the validator node, we recommend the following configuration:

{
"log4rs": true, // Turn on log splitting
"no-mdns": true,
"validator": true, // The validator node must be true to participate
"ws-external": false, // Recommended to close for validators
"rpc-external": false, // Recommended to close for validators
"log": "info,runtime=info",
"port": 20222, // Specify the tcp port of the p2p protocol
"ws-port": 8087, // Specify the RPC service port of websocket
"rpc-port": 8086, // Specify http RPC service port
"pruning": "archive", // It is strongly recommended to add this configuration and start in archive mode
"execution": "NativeElseWasm",
"db-cache": 2048, // Set the cache of the node database, in MB, that is, 2GB here
"state-cache-size": 2147483648, // Set the node state tree cache, unit B, which is 2GB here (2GB = 2 * 1024 * 1024)
"name": "Your-Node-Name", // The node name displayed in the node browser Telemetry
"base-path": "<data storage path>", // The database path, the default under linux is `$HOME/.local/share/chainx/chains/$CHAIN_TYPE/db`
"bootnodes": [] // Seed nodes, use built-in seed nodes when the list is empty
}

After the node is successfully started, you can see your node on Telemetry (stats.chainx.org).

Register your account

You can register an account on the new wallet (http://dapp-v2.chainx.org), and transfer a little PCX to the account as transaction fees and subsequent mortgage fees.

Register node

After successful registration, you can register a node on the Network>Staking page.

Each account can only be registered once. In addition, you need to ensure that you have enough balance to pay the transaction fee before registering. Newly registered nodes participate in the election by default, and you do not need to perform additional operations. In addition to the initial pledge of coins when registering a node, you can also pledge again by voting. After the election time is over, the top 30 nodes with total pledge amount will become validators to participate in the consensus.

Set Session Keys

You can execute the following command on the machine running the node to generate Session Keys:

$ curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "author_rotateKeys", "params":[]}' http://localhost:YOUR_RPC_PORT

Here, YOUR_RPC_PORT is the port specified by rpc-port when starting the node. If it is not specified, the default port is 9933.

The returned results are as follows:

{
"jsonrpc": "2.0",
"result": "0x42a7d53603bac173eb96e4ac133e35bcd4a49f308387a0e748b6f6a6dbf5635313f065a67a42a78a2c3e261a63523d92d4e03f9e7c9bba7c3d13b13b6983f0724c46b00699362a374f3fe43dd668eae6fcd815d0b84f88998ca5fc1c41e09b2412e2b9d3a322d9229a24cbce31d53358edc77b6fbaca7d038247743f40b6f205",
"id": 1
}

In here, resultis the obtained Session Key, which you need to set inDeveloper>Extrinsic through setKeys:

At present, simply fill in 0x00 intoproof. Session Key is now set.

Backup node

When a node is not properly deployed, it will be punished when the block is abnormal. Therefore, additional backup nodes can be deployed, started in the — pruning=archive mode, so that when the primary node is abnormal, the backup node can be used to replace the work to avoid punishment.

Verification

After being elected as a validator, if you see Prepared block for proposing at 6467 in the log, it means that the node has successfully produced a block.

Node penalty

ChainX will issue rewards in each session, and at the same time punish nodes that may do evil. The types of punishment generally include node double signing and node offline. Once a node is found to be evil, all the rewards that the evil node deserves in the session will be punished into the state treasury, and the node reward pool will be punished according to the evil coefficient reported on the chain, namely:

penalty = max(session_reward + reward_pot_balance * F, minimum_penalty)
  • penalty: penalty amount
  • session_reward: node's session reward
  • reward_pot_balance: node prize pool amount
  • F: penalty coefficient, calculated by babe and im-online modules:
  • babe: Node double sign penalty details, frame/babe/src/equivocation.rs.
  • im-online: Node offline penatly details, frame/im-online/src/lib.rs.
  • minimum_penalty: The minimum penalty value, that is, at least the minimum_penaltyfor each penalty.

ChainX nodes do not punish the principal amount for doing evil, but punish the node prize pool. When the node prize pool is empty, the node will be forced to withdraw from the election.

if penalty > reward_pot_balance {
// force the validator(offender) to be chilled
}

About ChainX
Official website: https://chainx.org
Wiki: https://github.com/chainx-org/ChainX/wiki
Twitter: https://twitter.com/chainx_org
Medium: https://medium.com/@chainx_org
Telegram: https://t.me/chainx_org
White paper: https://chainx-static.oss-cn-hangzhou.aliyuncs.com/chainx_en.pdf
Desktop wallet: https://github.com/chainx-org/chainx-wallet/releases/tag/v1.0.3
Official Wechat: interchain

--

--

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.