Mining Pool Upgrade — CKB 2021 Hardfork

CN Version Link → 矿池测试 ckb 2021 hardfork

EN Version is translated by ashleewang

CKB will witness its first hardfork since the launch, the 2021 edition as we call it (the exact activation date has not yet been fixed). This article illustrates the pre-testing necessary in order to upgrade to this version of the mining pool.

To begin with, this hardfork is focused on improving the extensibility and performance of CKB, not on changing the economic model, so none of the pool/miner related revenue calculations will be affected. For more details on the hardfork update, refer to: https://github.com/nervosnetwork/rfcs/pulls?q=is%3Apr+label%3ACKB 2021

Updates for Testing of Mining Pool Software

  1. Download or compile the 0.101 version from the source code: https://github.com/nervosnetwork/ckb/releases/tag/v0.101.1

  2. Initialize a test chain locally

Input genesis-message and ba-arg

ckb init -c dev --genesis-message ckb-2021-local-test --ba-arg your-args-hex-string
  1. Modify the specs/dev.toml file in the directory after the initialization.

Edit the last line from

func = "Dummy"

to

func = "Eaglesong"
  1. Upgrade the CKB package version for the mining pool application

Take the btcpool open source mining pool project as an example, edit these 2 lines of the version tag to “0.101”

ckb-jsonrpc-types = ">=0.101.0"
ckb-types  = ">=0.101.0"
  1. Launch the CKB node and the updated mining pool, connect to a mining server to perform a mining test, and the upgrade will be completed if the blocks are properly generated.

Once CKB 2021 is officially released (version 0.102.0), follow steps 1 and 4 (2 and 3 are not required) above to upgrade to the corresponding version.

Updates on Fee Calculation for Miners

  1. In versions prior to 0.42, the RPC get_cellbase_output_capacity_details was used to calculate miner rewards. But the RPC has been deprecated in versions after 0.42 and in hardfork, replace it with get_block_economic_state.

Since CKB awards are delayed by 11 blocks, be aware that the block hash parameter passed in here is different from the previous get_cellbase_output_capacity_details: the previous parameter passed in the 100th block is going to return the 89th block as a reward to the miner; the current rpc passed in the block hash of the 100th block will return the 100th one as a reward to the miner.

  1. Send Transaction Related Codes

If the transaction is submitted by using CKB-cli, simply upgrade CKB -cli to version 0.101. In other cases, such as using sdk + CKB-indexer, an upgrade to the corresponding version is all that is required.

2 Likes