More about the Staking Upgrade

smartBCH
4 min readAug 14, 2023

--

We introduced smartBCH’s staking upgrade on Jul 17. This staking upgrade will be activated at height 11006000, about 15 Aug. This article explains more details of this upgrade.

What will be upgraded?

  1. A validator must stake no less than 32 BCH.
  2. The PoW hashrate election will be disabled. The PoS election through the xhedge contract is the only way to become a validator.
  3. Double-sign Slashing: a validator will be slashed 8 BCH if it signs multiple blocks at the same height.
  4. Offline guard: the smartbchd clients will count each validator’s signed blocks in small fixed 100-block windows; if a validator’s signed blocks are less than 5, its voting power will be lowered to 1/10 of its normal power temporarily, until it signs enough blocks. During this process, the validator is not slashed
  5. Offline slashing: the smartbchd clients will count each validator’s signed blocks in large fixed 14400-block windows (about 24 hours); if a validator’s signed blocks are less than 8640, it will be slashed 2 BCH.

The Details of Slashing

A validator will be slashed for the following cases.

Long-time Offline

The smartbch’s blocks are divieded into successive non-overlapping 14400-block observing windows (about 24 hours). In each observing window, if a validator signs less than 8640 blocks (about 16 hours), it is considered as offline. Then the smartbchd clients will slash this validator at the end of the observing window: all the pending rewards of this validator and 2 BCH out from its staked BCH will slashed and sent to the slashed-coin receiver. And it will also lose its role as a valiator immediately, i.e., clear its voting power to zero. The left staked BCH of the slashed validator will be returned at the end of the next epoch.

Offline slashing is relatively easy to be triggered. If your valiator’s machine is down for 8 hours within a 24-hour window, it will be slashed.

If your validator’s machine is down and cannot be recovered, you can call the retire function of the staking contract to avoid the slashing before the end of the observing window. We will provide a UI for calling retire at https://assets.smartbch.org/staking-frontend/.

The 100-block small observing windows ensures the smartbch network is still stable even when multiple validators get offline one after another. 100 blocks is about 10 minutes. When a validator gets offline for about 10 minutes, its voting power is reduce to 1/10 of its normal value. If 34% of the validators get offline one after another, finally the lost voting power will be 66/(66+3.4)=4.9%.

If smartbch is not protected by these small observing windows, the offline validators must be recovered as soon as possible because the accumulated voting power of offline validators must not exceed 66%. When smartbch is protected by these small observing windows, the recover time of the offline validators is allowed to be a bit longer, so we choose a 24-hour time window.

Double-Signing

If a validator signs two smartbch blocks at the same height, then the smartbchd clients will slash this validator immediately: all the pending rewards of this validator and 8 BCH out from its staked BCH will slashed and sent to the slashed-coin receiver. And it will also lose its role as a valiator immediately, i.e., clear its voting power to zero. The left staked BCH of the slashed validator will be returned at the end of the next epoch.

Double-signing is relatively hard to be triggered. If you do not copy your validator’s consensus key to no less than one machines and run these machines at the same time, it will never be triggered.

What to do next

Currently, only the matrixport validator packs blocks and the other valdiators are temporarily disabled. The smartBCH side chain is working in a single-validator mode now.

After height 11006000, the new staking logic will be activated and the current validators should stake no less than 32 BCH in the epoch between height 11006000 and 11207601 (about 26 Aug, 2023). If you want to register a new validator, you should also stake no less than 32 BCH after height 11006000. You can stake exactly 32 BCH, or any value above that (33 BCH, 32.001 BCH, etc).

After height 11207601, all the validators with 32 BCH staked will take charge and smartBCH will exit the single-validator mode.

To vote for a new validator using locked BCH, you need to interact with the xhedge smart contract. The UI of xhedge.cash can help you.

To register a new validator and stake BCH, you need to interact with the staking smart contract. The UI of staking-frontend will be updated to support the new functions after this upgrade.

If you are running a smartBCH node, please update to the latest v0.5.1. You can build its binary from the source or simple download its docker image using docker pull smartbch/smartbchd:v0.5.1.

--

--

smartBCH

Maximize throughput of EVM & Web3 on a sidechain of Bitcoin Cash