Home About John Resume/CV References Writing Research

Binance Smart Chain

Overview

Binanace Smart Chain (BSC) has similar signature schemes to Polygon but with a much smaller set of validators and some degree of random (yet predictable and deterministic) perturbation to the active validator set.

The consensus protocol is based on Parlia19, a variation that adds staking, validators, and elections to the proof-of-authority consensus protocol Clique, initially proposed in the Ethereum community. The protocol uses 21 validators for producing and signing blocks, with 19 of them picked from stakers with top voting power and 2 randomly chosen every 200 blocks 20. Blocks are signed using ECDSA on secp256k1 curves, and block headers can be verified following the standard signature verification process21.

Consensus Mechanism

Following is an excerpt from Binance Consensus Engine documentation

Although Proof-of-Work (PoW) has been recognized as a practical mechanism to implement a decentralized network, it is not friendly to the environment and also requires a large size of participants to maintain the security.

Ethereum and some other blockchain networks, such as MATIC Bor, TOMOChain, GoChain, xDAI, do use Proof-of-Authority(PoA) or its variants in different scenarios, including both testnet and mainnet. PoA provides some defense to 51% attack, with improved efficiency and tolerance to certain levels of Byzantine players (malicious or hacked). It serves as an easy choice to pick as the fundamentals.

Meanwhile, the PoA protocol is most criticized for being not as decentralized as PoW, as the validators, i.e. the nodes that take turns to produce blocks, have all the authorities and are prone to corruption and security attacks. Other blockchains, such as EOS and Lisk both, introduce different types of Delegated Proof of Stake (DPoS) to allow the token holders to vote and elect the validator set. It increases the decentralization and favors community governance.

BSC here proposes to combine DPoS and PoA for consensus, so that:

  1. Blocks are produced by a limited set of validators
  2. Validators take turns to produce blocks in a PoA manner, similar to Ethereum’s Clique consensus design
  3. Validator set are elected in and out based on a staking based governance

The consensus protocol of BSC fulfills the following goals:

  1. Short Blocking time, 3 seconds on mainnet.
  2. It requires limited time to confirm the finality of transactions, around 45s for mainnet.
  3. There is no inflation of native token: BNB, the block reward is collected from transaction fees, and it will be paid in BNB.
  4. It is 100% compatible with Ethereum system .
  5. It allows modern proof-of-stake blockchain network governance.

Signing Mechanism

BSC uses the same signing mechanism as Ethereum 1.0.

Transactions are signed using recoverable ECDSA signatures. This method utilises the SECP-256k1 curve. (see the Ethereum Yellow Paper Appendix F. Signing Transactions). go-ethereum utilizes the secp256k1 package which wraps the bitcoin secp256k1 C library. Signing is handled by the signer receives a request and produces a signature. Note, the produced signature conforms to the secp256k1 curve R, S and V values, where the V value will be 27 or 28 for legacy reasons, if legacyV==true.

Signing

Code Review

The Binance Smart chain is cloned from Ethereum 1.0 and thus the majority of code incuding primitives, signing are similar. The key addtions are

Some ommissions include the majority of work done for Ethereum 2.0 for example BSC has no beacon/engine.

References

Consensus

Staking

Additional

[19] See BSC Consensus Engine documentations

[20] Following BEP-131, see a summary and detailed specifications. Note that the proportion of randomly selected validators may increase, as proposed in the BEP.

[21] See code for full procedure and how ecrecover is used for signature verification.