Translation of Articles - DPOS: Consensus on the Aergo Mainnet, which Sun written Wu - Developer AT Blocko and Aergo
Each blockchain protocol uses a consistent algorithm to support one and only one list of cryptographically related blocks - blockchas. The most famous in the world of blockchas is a consensus dynamo implemented in Bitcoin based on Proof of Work (POW). It allows you to achieve complete decentralization, allowing finality only by the probabilistic method. In this case, several branches can compete with each other and gradually turn into one. Another extreme in the spectrum is the consensions that originated from the traditional Byzantine Agreement (BA). They guarantee the instantaneous end of the block, but limit the degree of decentralization.
Consensus of delegated confirmation of the share (DPOS) ¹, which is used in the main network of Aergo, is in the middle between the aforementioned two consensus. He delegates the exclusive right to generate blocks for a number of selected block manufacturers (BP), at the same time allowing reorganization in a limited range. (A) Following the PROF OF OF STAKE (POS) and (b) models, maintaining only a limited amount of BP, it solves both the productivity problem and the problem of excessive power, detected in POW-based consensus.
This article provides a detailed description of the DPOS, implemented in the Aergo blockchain core. In the remaining part of the article "DPOS" means DPOS implemented in the Aergo block nucleus, unless otherwise defined.
Delegated Property Property in Aergo
DPOS allowed to generate blocks only by limited quantity² of nodes called active block manufacturers (BP). They are chosen by voting among stakeholders. Time is evenly divided into slots, and for each slot must be created maximum block. Active BP are distributed over these slots by counting votes and in turns produce blocks.
For simplicity, let's consider an example of four active BP, which are respectively A , B , C and D in descending order of votes. Block interval is 1 second. If everything is in order, the blockchain works as shown in Figure 1.
Each BP generates a block every four seconds. However, when the first unit is not received on time, the next BP must generate it. For example, suppose that A Created a block "1" and then B fell before producing block "2" in this case, FROM must generate a block "2", and not B . Figure 2 shows how the blockchain looks like in case of such a failure.
There are no blocks corresponding to the slots "1" and "5", since b gives a failure, so blocks are distributed unevenly in time; The time interval between blocks "1" and "2" is about twice as long (2 (2 C) than usual (1 s).
On the other hand, DPOS allows branching and reorganization as in Bitcoin. Let's assume that B Disabled from other BP due to a network failure. Even in this case b and others ( A , C , D ) Do not stop the production of blocks. They control their own blocks accordingly, as shown in Figure 3.
Please note that the slots "1" and "5" of the main chain (top) are empty, because blocks created by B , not accepted ( A , C , D ) due to network separation.
Lower chain managed B, is a side chain, because it is shorter than another; While the height of the main chain becomes 7, the height of the side chain is still only 3. Thus, according to the rule of the longest chain, as soon as the network problem is solved, and the blocks of the main chain are sent to B , B it becomes known that his chain is shorter than another. Finally, she begins to follow the main chain (reorganization).
Finished: the last irreversible block
If the block is connected to the block chain, it can be viewed as a block and its parent blocks driven by. Based on this idea, a concept called the last irreversible block (LIB) was introduced into DPOS. As soon as the block becomes lib, any reorganization that goes beyond its limits is prohibited. Accordingly, the completeness of the LIB and the blocks preceding it is guaranteed. Under normal conditions, LIB is constantly updated to a higher value, with the exception of the initial reboot period.
Speaking by technical language, LIB is determined in two stages:
- When most (⅔ +) BP attach the blocks to the chain, the first of them becomes the proposed LIB.
- The LIB proposed finally becomes LIB when complemented by blocks from another majority of BP.
Initially, the range of voting [or confirmation] on the block did not have restrictions. In other words, the block connected to the chain was considered a vote for the Block itself and all the superior blocks. However, later it will be changed to avoid conflicting libs³. In the modified version, a block generated by BP X, Confirms only a number of block predecessors produced by BP X last time.
A simple example is shown in Figure 4. This is the case with a DPOS 4-BP network, most votes in it amounts to 3. In this case, the voices of 3 BP are needed to achieve consensus, respectively, on each of the stages of the LIB definition. Therefore, as shown in Figure 3, block "one"It becomes the proposed LIB when connecting the block"3"To chains (1 phase). After that block "one"Finally goes to lib when the block is added to it."five"(second phase). Under normal conditions, as soon as the block is completed as a LIB, the height of LIB is increased by 1 when the new block is connected; One new block accompanies new lib.
Rates, vote and election
Active BP are selected by Aergo users who put their tokens (Aergo) ⁴. The interested party can vote freely for several candidates (a maximum of 30 candidates), although voting is limited to 1 voice per day. Voting result is collected every 100 blocks. Rating affects the change of regime after 100 blocks. This election scheme is illustrated in Figure 5. Here BP block "700" Selected in accordance with the rating collected on block "600" (and not "700"). It is designed to reduce the likelihood of unreasonably frequent change of regime as a result of reorganization, since the reorganization of past blocks is less likely than recently.
On a simple example, consisting of 4 BP, we explained how DPOS works. Its main advantages are:
- generating a block with a limited number of favorite BP; and
- The ability to reorganize only within the limited range of blocks.
The first provides fast and stable block production, while the second guarantees the absolute finality of the blocks until most of the active BP are in normal operation. Thanks to them, DPOS can achieve high performance at a moderate degree of completion of transactions. Such a balance between performance and finality is one of the most important factors defining our choice of DPOS for consensus on the Aergo network.
- DPOS was first represented as a consensus algorithm for BITSHARES (https: // BITSHARES.ORG / technology / delegated-proof-of-stake-consensus /). The current implementation of Aergo is similar to the implementation of the EOS (https: // GitHub.COM / EOSIO / Documentation / Blob / Master / TechnicalWhitepaper.MD # Consensus-Algorithm-BFT-DPOS).
- Currently, Aergo network operates with 13 active BP at the incubation stage (HTTPS: // Medium.COM / AERGO / AERGO-MAINNET-INCUBATION-8F097344D14E).
- "To correct the loss of the DPOS consensus due to the contradictory of the recent irreversible block" (https: // GitHub.COM / EOSIO / EOS / ISSUES / 2718).
- The rate and voting are carried out by submitting applications for participation in the auction.