共识机制

更新时间:2019-08-16 22:26:00点击:445 Technical framework

Consensus mechanism layer is responsible for coordinating and ensuring the consistency of data records of all nodes in the whole network.

The data in block chain system is stored by all nodes independently. Under the coordination of consensus mechanism, the consensus layer synchronizes the accounts of each node, thus realizing the functions of node election, data consistency verification and data synchronization control.

Data synchronization and consistency coordination make the block chain system transparent and data sharing.

The following table is a comparison of two common consensus mechanisms

The first type of consensus mechanism and the second type of consensus mechanism

Writing order: Write first, consensus first, and then write

Algorithms represent POW, POS, DPOS PBFT, BFT variants

Consensus Process, Probability Consensus, Final Confirmation of Consensus Engineering, Confirmation of Consensus and Reconsideration of Consensus

Consensus is confirmation

Computational complexity and network complexity

Arbitration mechanism: If there are multiple accounting nodes in consensus, bifurcation will occur, and ultimately the quorum vote will be based on the longest chain, and P2P broadcasting communication among the nodes will reach agreement.

Are there bifurcations? No bifurcations

Security threshold: no more than 1/2 of the malicious nodes and no more than 1/3 of the total nodes

Number of nodes

The more nodes, the more stable they are.

The more nodes there are, the worse the performance will be.

Application scenarios are mostly used in non-license chains and license chains

The two consensus mechanisms mentioned above are mainly based on the order of data writing.

From the perspective of business application requirements, the implementation of consensus algorithm should take into account the application environment, performance and many other requirements.

Generally speaking, the consensus mechanism of node voting is adopted in the license chain to improve system performance at the cost of reducing security.

Non-license chain adopts workload-based or proof-of-interest algorithm, which mainly emphasizes system security, but its performance is poor.

In order to encourage each node to participate and maintain the safe operation of the block chain system, the non-license chain adopts the way of issuing Token as the reward and incentive mechanism of the participants, that is, to prevent tampering with the contents of the general ledger by means of economic balance. Therefore, according to the operating environment and trust classification, choosing the suitable consensus mechanism is one of the important factors that should be considered in the application landing of block chains.

Here we list the comparison of several consensus algorithms.

Features POW POS DPOS PBFT VRF

Node Management, No License, No License, No License, No License, No License

Transaction latency: high (minute) low (second) low (second) low (millisecond) low (millisecond)

Low throughput, high throughput and high throughput

Energy saving

Security boundary: malicious computing power < 1/2 Malicious rights < 1/2 Malicious rights < 1/2 Malicious nodes < 1/3 Malicious nodes < 1/3 Malicious nodes < 1/3 Malicious interests < 1/2 Malicious interests < 1/2 Malicious interests < 1/2 Malicious nodes < 1/3

Represents Bitcoin, Ethereum Peercoin Bitshare Fabric traceability chain (OT)

Expansion: Good, Good, Poor

According to the above comparison, the traceability chain (OT) ecosystem will adopt the VRF consensus mechanism to better complete transactions and experience of intelligent locks, so that more intelligent locks can develop their own side chains, so that the intelligent locks industry can be better innovated and developed.

Smart Contract

Intelligent contract layer is responsible for the implementation, compilation and deployment of business logic in the form of code, triggering and automatic execution of established rules, and minimizing manual intervention.

Intelligent contracts are mostly operated by digital assets. The characteristics of hard to modify and strong triggering conditions determine that the application of intelligent contracts has high value and high risk. How to avoid risk and bring value into play is the difficulty of wide application of intelligent contracts.

Intelligent contracts are classified into two categories according to whether Turing is complete or not: Turing is complete and non-Turing is complete.

Common reasons affecting Turing completeness include: limited loop or recursion, unable to implement arrays or more complex data structures, etc.

Turing's complete intelligent contract has strong adaptability. It can program business operations with complex logic, but it may fall into a dead cycle.

In contrast, Turing's incomplete intelligent contract is simpler, more efficient and safer, although it can not perform complex logic operations.

Here's a comparison of the smart contract features of mainstream platforms



Block Chain Platform: Is Turing Complete?

Bitcoin Incomplete Bitcoin Script

Etaifang Complete Solidity

EOS Complete C++

Hyperledger Fabric Complete Go

Hyperledger Sawtooth Complete Python

Traceability Chain (OT) Complete Kotlin/Java


At present, the application of intelligent contract is still in a relatively primary stage, and intelligent contract has become a "disaster area" of block chain security. From the security time caused by previous intelligent contract vulnerabilities, there are many security vulnerabilities in contract portability, which brings great challenges to its security.

At present, there are several ways to improve the security of intelligent contracts:

One is formal verification, which ensures that the logic expressed by the contract code conforms to the intention through rigorous mathematical proof. The logic of this law is strict, but it is difficult. Generally, it needs to entrust a third-party professional organization to audit.

Second, intelligent contract encryption. Intelligent contracts can not be read in plaintext by third parties, thus reducing the vulnerability of intelligent contracts due to logical security vulnerabilities. The cost of this method is low, but it can not be open source.

Thirdly, the grammatical format of contract language should be strictly regulated. Summarizing the excellent mode of intelligent contract, developing standard intelligent contract template and writing intelligent contract with certain standard can improve the quality of intelligent contract and the security of contract.

Recommended Reading