If reaching consensus represents the root of a blockchain, consensus algorithm is the soul.
Blockchain technology is innovative largely because of its decentralized system of trust, where users are reassured to trust and make deals with strangers in a new environment online. Consensus algorithm is what drives the system. It maintains the normal operation of ‘the world of blockchain’, like the law of a country.
Consensus generally means an opinion that everyone in a group agrees with or accepts. Similarly, the consensus algorithm of a blockchain refers to the computational procedure followed by multiple distributed nodes to reach an agreement on a transaction.
Proof-of-Work and Proof-of-Stake are two prevailing consensus algorithms for the blockchain at present.
- Proof-of-Work (PoW), as its name suggests, allows higher gains as long as the user has more work done.
- Proof-of-Stake (PoS), similar to the stock warrant and voting system, enables those who have the most tokens to make the final decision.
Delegated Proof of Stake, or DPoS, is a common consensus algorithm deriving from PoS. Unlike its predecessor, DPoS is an evolved variant featuring the selection of multiple ledger nodes, which are chosen as ‘delegates’ of massive nodes and determine the validity of transactions.
The thing is the above well-known consensus algorithms are born with some non-negligible flaws. PoW relies on machines to carry out mathematical operations and gain the right to sign on the ledger, resulting in a tremendous waste of hashing power and electric energy during the mining.
PoS, while having that problem well fixed, gives rise to new questions: first, stakeholders having more tokens possess greater rights, which simply leads to monopoly; second, validation is generally an expression of probability and there may be other attacks. In addition, it’s easy to generate hard forks given the low mining cost.
To kill three birds with one stone and address concerns about resource consumption, safety, and monopoly concurrently, GaiaWorld has developed the innovative Competitive Proof-of-Stake (CPoS), a competition-based consensus algorithm that ensures greater fairness.
CPoS is employed to select the address with the greatest right-to-vote in competition as the block generation node. CPoS differs from other PoS solutions in that it randomly divides all forgers to 256 groups; the stake is a function of block height, times of accumulation, and random initial value, in addition to the fund invested. In a given group, the forger holding the largest stake has the right to ‘forge’ the block.
So, anything new about the CPoS algorithm?
Of course. To enhance the impartiality and prevent fraud, GaiaWorld has introduced VRF into CPoS, i.e. the right-to-vote is associated not only with the deposit, but the VRF of the block.
Every potential VRF generator should release their BLS public key before they really become a VRF generator who uses the private key to generate a VRF by following specified methods, and all nodes of the blockchain can verify the VRF with the BLS public key. VRF generators are unable to control the public key released in advance. This guarantees true fairness.
This design enables more nodes to have a chance of block forging, so that it is possible for less-funded nodes to triumph. A consensus algorithm like this is a better solution to dealing with safety and supervision concerns that are beyond PoS and DPoS.
Long story short, CPoS offers every node random opportunities to forge new blocks. It rules out fraud effectively and is a safer solution under close public monitoring.
Procedure of CPoS Algorithm
- Receive transaction information
- Calculate block generation groups
- Package blocks and broadcast them for verification
- Verify block generation information
- Compute the total right to vote and validate the block
- Reset the forger’s right-to-vote and group them again
After numerous debugging tests, our CPoS-based blockchain could operate at much higher efficiency.