Bystack high TPS consensus algorithm

Consensus algorithm is a distributed system to ensure consistency of approach node status data, sub-POW in consensus algorithm block chain (workload proof) and POS (proof of interest) two categories. The first mode is the consensus algorithm POW most widely used application in the public chain project, Bitcoin has been running for 10 years fully proved that the security and stability of POW's. POW characteristic is the decentralized and safety to the extreme, but at the expense of performance. The TPS bits credits peak was 3.87, the average per transaction is packed into 10-minute blocks; TPS than the peak of the original chain is 36.32, the average is packed into blocks every transaction requires 2.5 minutes. The second category to the POS mode is selected by an algorithm block consensus node, Union chain and used for a number of new public pursuit of high TPS chain projects. Characteristics POS is supported by a smaller block spacing to achieve optimal performance, but at the expense of security and to the center section.

Bystack is a block-based main chain, a side chain BaaS internet architecture, the block chains are classified as Layer1 and Layer2 layers.

Layer1 than both the original backbone chain by the POW algorithm to ensure security of assets and to the center of the highest level. Layer1 of TPS problem is through cross-link technology assets will be transferred to the settlement of the Layer2.

Side chain (both Layer2) using innovative BBFT consensus algorithm allows TPS single side chains reach 20,000 or more, a plurality of side chains with TPS allows linear growth.

Under the premise of the node bandwidth performance bottlenecks not reached, TPS = Block number of transactions per second * confirmation of the number of blocks. Since the maximum number of trading blocks can be accommodated by simply modifying the code parameters to achieve, so increasing the number of blocks per second to confirm become a key way to improve the TPS. The ratio of each block of the original chain can accommodate a maximum of 5500 transactions, in the main chain per 150 seconds as an average of one block so POW characteristic TPS is 36.32, but on a side chain as will enter the second final the number of blocks can be easily increased to 5 TPS will reach 25,000 or more.

DPOS problem

DPOS traditional consensus algorithm such as EOS already can do to support a block per second two blocks, but there is a wait for the final confirmation of the problem.
Because a conventional block DPOS final confirmation is based on all the super nodes after the block out through the at least one sub-block. This means that assuming 21 super nodes, each round out of six blocks, a block average time of 0.5 seconds. Then a block of time to get final confirmation takes 60 seconds.

BFT problem

Because of the nature of the BFT based on the POS all BFT each block may be quickly output after the final confirmation, but it is difficult to obtain a high TPS.
Reason BFT each block is divided into three states, generating a pre-final state and the final confirmation state.
Change of state is to rely on collected signatures 2/3 node and signature generation efficiency is dependent delay network. Suppose in U.S. super node portion, a communication portion in China then the delay is approximately 200 milliseconds.
That a block from generation to final confirmation of at least 600 ms limit. So BFT consensus in the network become the bottleneck of high algorithmic delay of TPS.

DPOS BBFT consensus algorithm

Bystack consensus new hybrid algorithm is based on a consensus algorithm and algorithm DPOS characteristics BBFT,
by the mode of the block so that the asynchronous method signature BBFT while having a high TPS and rapid final characteristics. In BBFT consensus algorithm consists of the whole network user consensus vote of n nodes out of the block. Consensus block section turns out to become a node, when the node becomes the common node will block s seconds at a speed of one block out of the m successive blocks. When a block is generated directly broadcast to the whole network,
but the nodes will not block waiting to acquire additional common node signature 2/3 but continued the next block on the basis of the current block. At this time, the current block are valid blocks, but the final confirmation is not obtained, the possibility of non-similar bits credits 6 blocks obtained confirm the presence of rollback. When another node receives a consensus on the block and the block will be signed after passing authentication and broadcast to the whole network, when a signature block access to more than two-thirds of the state entered the final confirmation.

TPS

TPS core point to achieve a high consensus is that each successive node the m blocks. Because each node only when the block is a block consensus if then the next node block out the need to wait for a consensus on a node, where you need to consider a network latency problem brought about. If the block is smaller than the network delay interval, the probability that there will be large when the common node on the received block is not a block caused bifurcated state. However, when m is set to a slightly larger number may be raised to the limit tps node bandwidth performance.
Assume that when m = 20,
since the network does not receive the delay block 19 before the last but one received block when the next block is a common node, a node connected to a block 19. After the block. Will enter state block chain bifurcated instant but according to the principle of longest chain after two full blocks unified network state. Although the loss of the TPS 1 blocks,
but any of the above to ensure a block of the block is smaller than the network delay interval of the case.

Asynchronous BFT

In BBFT the design of the block and is parallel with the BFT signature consensus node to offset the delayed impact of the network on the block efficiency of collecting signatures BFT. But unlike the classical algorithms have generated BFT, the pre-final and final state of the three states,
BBFT makes the algorithm according to the characteristics of the transformation block chain only a final state.
But adds two additional constraints: the first is when a common node of the same height of two different blocks fraudulent signature occurs both; the second is a consensus when two different nodes on the same block of time signing both fraud occurred. By way of this transformation reduces the number of common communication between nodes, thereby reducing the time it takes to block a final confirmation. Meanwhile BBFT also blocks directly and indirectly confirmed that the two kinds. The first direct confirmation both blocks received more than two-thirds of consensus node signature. The second is indirect confirmation did not get a 2/3 block consensus node signatures, but his son has won more than two-thirds of the signature block consensus node, BBFT would think that this block indirectly received final confirmation of the state.

Fault-tolerant disaster recovery

  1. Support the entire network in case of consensus support only a single node running to survive the next round of consensus node to replace, but the speed will drop to block the normal 1 / n.
    The user can change the vote to replace supernode In the meantime, the next when replacing wheels consensus on both nodes in the network returned to normal state.

  2. 1/3 consensus support in the case of the normal operation of the network node evil, when more than a third node evil block consensus will not be long until the network function into the final run to the next round of consensus node to be replaced. When more than half of the consensus node evil, malicious nodes will control network.

BBFT a block consensus scenario analysis

The following case is assumed that n = 5, m = 3, s = 1, block height = 100, timestamp = 1557148900, 

3 turn out to prepare a first common node block

Perfect state 

  1. 3 is a high degree of node 101, the timestamp is 155,714,890 blocks A, is broadcast to the entire network

  2. A block acknowledgment obtained over two-thirds of the node, into the final acknowledgment status

3. The node 3, a height of 102, the time stamp for the B blocks 155,714,891, is broadcast to the entire network

  1. Over 2/3 block B obtained confirm node, into the final acknowledgment status

The height of a node 3 103, timestamp 155 714 892 C block, is broadcast to the entire network

  1. Section C to give more than 2/3 of the nodes confirmed, into the final acknowledgment status

  2. 4 nodes successfully received blocks A, B, C are in the final state and, on the basis of the chain to continue the continuous

  3. 4 is a high degree of node 104, the time stamp for the D blocks 155,714,893, is broadcast to the entire network


Milliseconds and final confirmation, no rollback occurs only when the network latency low and stable consensus node generation

Ideally

  1. 3 is a high degree of node 101, the timestamp is 155,714,890 blocks A, is broadcast to the entire network

  2. 3, a height of 102 nodes, the timestamp is 155,714,891 blocks B, broadcast to the entire network

  3. A block acknowledgment obtained over two-thirds of the node, into the final acknowledgment status

4. The height of the node 3 103, timestamp 155 714 892 C block, is broadcast to the entire network

  1. Over 2/3 block B obtained confirm node, into the final acknowledgment status

  2. 4 nodes successfully received blocks A, B, C but only A,
    B in the final state, on the basis of the chain to continue the successive blocks

  3. 4 is a high degree of node 104, the time stamp for the D blocks 155,714,893, is broadcast to the entire network

  4. Section C to give more than 2/3 of the nodes confirmed, into the final acknowledgment status


Reached second grade final confirmation, no rollback occurs, but to collect signatures confirming consensus node on the block, leading to final confirmation of the delay.
But because of all the blocks have been successfully passed to the next block consensus on a node, it does not affect the block

A common node abnormal state block

  1. 155714890 timestamp is, no new block generating

  2. 155714891 timestamp is, no new block generating

  3. 155714892 timestamp is, no new block generating

  4. After the node does not receive any No. 4 block, the height of mining turn 101,
    timestamp 155 714 893 A block is broadcast to the entire network

  5. A block acknowledgment obtained over two-thirds of the node, into the final acknowledgment status


Reach the second stage a final confirmation, no rollback occurs, resulting in machine down because no consensus node a block in the entire network node 3 seconds. The impact is to slow down the speed of the entire network of a block, when a vote under a single-node machine down long to wait to re-elect a new round of consensus node repairable

1 abnormal network latency

  1. 3 is a high degree of node 101, the timestamp is 155,714,890 blocks A, is broadcast to the entire network

  2. A block acknowledgment obtained over two-thirds of the node, into the final acknowledgment status

3. The node 3, a height of 102, the time stamp for the B blocks 155,714,891, is broadcast to the entire network

  1. Over 2/3 block B obtained confirm node, into the final acknowledgment status

The height of a node 3 103, timestamp 155 714 892 C block, is broadcast to the entire network

  1. Section C to give more than 2/3 of the nodes confirmed, into the final acknowledgment status

  2. 4 nodes successfully received blocks A, B Block C, but due to the delay problem not yet received

  3. 4, a height of the node 103, the time stamp for the D blocks 155,714,893, is broadcast to the entire network

  4. Because two-thirds consensus nodes final blocks C, D can not get final confirmation

  5. No. 4 block C and C node receives a final confirmation, the rollback block D, switch to block chain C

  6. 4 is a high degree of node 104, timestamp 155 714 894 block E, is broadcast to the entire network

  7. Block E obtained over two-thirds node ACK, acknowledgment status into the final


Reach the second stage a final confirmation, there occurs a rollback of all the nodes have not received in block C, it is to slow down the impact of one block out of blocks speed

2 abnormal network latency

  1. 3 is a high degree of node 101, the timestamp is 155,714,890 blocks A, is broadcast to the entire network

  2. A block acknowledgment obtained over two-thirds of the node, into the final acknowledgment status

3. The node 3, a height of 102, the time stamp for the B blocks 155,714,891, is broadcast to the entire network

  1. Over 2/3 block B obtained confirm node, into the final acknowledgment status

The height of a node 3 103, timestamp 155 714 892 C block, is broadcast to the entire network

  1. 4 nodes successfully received blocks A, B Block C, but due to the delay problem not yet received

  2. 4, a height of the node 103, the time stamp for the D blocks 155,714,893, is broadcast to the entire network

  3. Block D obtained over two-thirds node ACK, acknowledgment status into the final

  4. 3 D and D blocks node receives a final confirmation, the rollback block C, block D to switch chain

  5. 4 is a high degree of node 104, timestamp 155 714 894 block E, is broadcast to the entire network

  6. Block E obtained over two-thirds node ACK, acknowledgment status into the final


Reach the second stage a final confirmation, all nodes have a rollback occurs identity of C blocks, it is to slow down the impact of the block of one block speed

3 abnormal network latency 

  1. 3 is a high degree of node 101, the timestamp is 155,714,890 blocks A, is broadcast to the entire network

  2. A block acknowledgment obtained over two-thirds of the node, into the final acknowledgment status

3. The node 3, a height of 102, the time stamp for the B blocks 155,714,891, is broadcast to the entire network

  1. Over 2/3 block B obtained confirm node, into the final acknowledgment status

The height of a node 3 103, timestamp 155 714 892 C block, is broadcast to the entire network

  1. 4 nodes successfully received blocks A, B Block C, but due to the delay problem not yet received

  2. 4, a height of the node 103, the time stamp for the D blocks 155,714,893, is broadcast to the entire network

  3. Block D obtained over two-thirds node ACK, acknowledgment status into the final

  4. 3 D and D blocks node receives a final confirmation, the rollback block C, block D to switch chain

  5. 4 is a high degree of node 104, timestamp 155 714 894 block E, is broadcast to the entire network

  6. Block E obtained over two-thirds node ACK, acknowledgment status into the final


Reach the second stage a final confirmation, all nodes have a rollback occurs identity of C blocks, it is to slow down the impact of the block of one block speed

Abnormal network latency 4 

  1. 3 is a high degree of node 101, the timestamp is 155,714,890 blocks A, is broadcast to the entire network

  2. A block acknowledgment obtained over two-thirds of the node, into the final acknowledgment status

3. The node 3, a height of 102, the time stamp for the B blocks 155,714,891, is broadcast to the entire network

  1. Over 2/3 block B obtained confirm node, into the final acknowledgment status

The height of a node 3 103, timestamp 155 714 892 C block, is broadcast to the entire network

  1. 4 nodes successfully received blocks A, B Block C, but due to the delay problem not yet received

  2. 4, a height of the node 103, the time stamp for the D blocks 155,714,893, is broadcast to the entire network

  3. Block C, D each receive 50% of the voting common node, network state into the forked

  4. 4 is a high degree of node 104, timestamp 155 714 894 block E, is broadcast to the entire network

  5. Block E obtained over two-thirds node ACK, acknowledgment status into the final

  6. 4, a high degree of node 105, timestamp 155 714 895 block E, is broadcast to the entire network


Seconds to reach final stage (the extreme case of minutes credits rollback probability and bit block almost 6), there is a rollback occurs in all the nodes in the recognition block C, is to slow down the impact of one block out of block speed
limit state this abnormal situation of the two chains is about 50% of the stations count and occurs sustainable competitive force, until a slight advantage consensus chain first entered the final confirmation state.

Parameters on the network

  1. In fact, the number of nodes represents the consensus of fault tolerance network block chain, n is the larger the single point of failure on the network caused by the influence smaller. But the number n increases will lead to BFT increase the number of signatures required for the block, will consume more resources and time delay block into the final state needed

  2. Each node of the number of consecutive blocks so that under consideration of the delay of the network can still ensure high-speed method for the block.
    Block out the time when the continuous number of blocks enough theoretically up to milliseconds. The core point is the next node has a network delay block consensus has not received the last three blocks, but before the m-3 zones has been received, continues to be an m 3-block basis. Too m but not cause long block consensus single node failure

  3. The next block interval is to ensure a high surface tps theoretically when the block interval is 200 milliseconds up to more than 25,000 in Bytom tps. But after s set of small blocks may lead to a final confirmation of the extension of time.

Guess you like

Origin www.cnblogs.com/bytom/p/10930808.html