4.2 DPoS Consensus Algorithm
Last updated
Last updated
Consensus is an algorithm for blockchain transactions to reach a distributed agreement. In the P2P network, the order of transactions received by each node may be different due to the network latency. Therefore, a mechanism is needed for nodes to implement the order of transactions that occur simultaneously.
The DxChain Mainnet currently implements the DPoS (Delegated Proof of Stake) algorithm, which is considered an improved version of the PoS (Proof of Stake) algorithm and has the characteristics of democratization, low costs, low latency, and high concurrency. As an implementation of technology-based democracy, DPoS uses the voting and election process to protect the blockchain from centralization and malicious usage.
On DxChain, users/organizations apply for candidates by staking an amount of DX and will get votes from all DX holders in each election cycle (which is 24 hours). The total amount of staking and votes will determine the probability of electing as a validator, according to the Lucky Wheel Algorithm, the higher the amount, the greater the probability of being selected.
DxChain 3.0 improves the DPoS consensus algorithm by storing the staking and voting data in the built-in contract and keeps the data storage structure consistent with the state trie, allowing more efficient elections and block synchronization. The number of transactions processed per second (TPS) can reach 500 after optimization, which will satisfy various activities on DxChain and further DeFi programs.
The built-in contracts of the system include:
1)Blacklist: Blacklist addresses management
2)Proposals: Node application and governance
3)Validators: Store validator information and modification
4)SystemRewards: Reward storage for validators and delegators
5)NodeVoting: Delegators voting
To improve the performance of DPoS elections, the total number of delegators is adjusted to a maximum of 210 n DxChain's latest economic model, of which the validator is up to 99 and the candidate is up to 111.
In terms of contract transactions, the optimized DPoS supports the RPC interface and built-in contract for election, staking, and voting, and will be easily upgraded due to the re-organization of the fundamental layer logic.
Table 1: DxChain 3.0 and Ethereum Comparison
Chain
Consensus
Block Generation Time
TPS
Fees
Max Validators
Ethereum
POW
12s
15
High
3000+
DxChain 3.0
DPOS
3s
500+
Low
<=99