Detailed explanation of blockchain — from essence to implementation principle

Time:2020-11-18

With the rapid rise of digital currencies such as bitcoin and Ethereum, the underlying technology of digital currency, blockchain technology, has begun to enter the public’s view. Yao Jinbo said: blockchain may be as great as the Internet. What are the advantages of blockchain technology over traditional Internet technology? What is its implementation principle? I hope that through this article, we can answer our questions.

Trust issues

The cost of information replication and dissemination on the Internet is almost zero, which makes it easy for people to publish and access information. But assets and information are different. Assets should not be copied at will. If the RMB can be copied at will, everyone will be a Billionaire: -).

Now the Internet and financial technology, through the establishment of a centralized server, solves the problem of asset dissemination, but the cost remains high. The reason is that today’s financial markets are built on a huge network of different service providers. In this huge network, there are various isolated data systems and operation systems, which greatly affect the further improvement of financial market efficiency. In a 2012 report by the European Central Bank, it was estimated that, in addition to the direct costs paid by everyone, the indirect costs were as high as 1% of GDP, about 130 billion euro per year. In the World Bank report, the cost of cross-border remittances is close to 8%. [1]

Financial institutions can not trust each other unconditionally, which leads to the phenomenon of isolated data island in the financial field, which leads to the high circulation cost of digital assets on the Internet.If financial institutions can trust each other, then all asset data can be freely circulated on the Internet, and there will be no data island phenomenon, thus reducing the circulation cost of digital assets. It is difficult to implement the moral appeal for credit. Is there any technical means to solve the problem of trust? The emergence of blockchain technology has brought a ray of light to solve the trust problem. Now blockchain technology is being applied in more fields besides financial field to solve the trust problem in these fields.

Trust machine

Using blockchain technology, we can create a trust machine [2]. Bitcoin system is a bookkeeping machine based on blockchain; Ethereum is a smart contract machine based on blockchain. andThe secret of trust lies in the encryption, openness and unforgeability of blockchain

encryption

Blockchain technology is based on cryptography and mathematics, which is the foundation of trust. Including elliptic curve digital signature algorithm, asymmetric encryption, hash function, Merkel tree and so on. These algorithms are universally recognized in cryptography and mathematics that are hard to crack. The data on the blockchain is public, but it doesn’t mean that your secret can be known by anyone. Using these encryption algorithms can protect your digital rights, such as your online privacy, the ownership of your online articles, and the token in your digital wallet.

open

Openness is the best way to win trust. The rules (procedures) and data of the system based on blockchain technology are public. Any participant can join in by running the blockchain program to verify the data. From the perspective of program reliability, trust can be built on both a black box program and an open source program. From the perspective of both sides of the transaction, trust can be established on the basis of a trustworthy third party, and on the basis of self verification. If you can verify by yourself or rely on a third party for verification, your own verification is more reliable; if you can’t verify yourself, you can only choose a trusted third party.Blockchain provides a more open, transparent and self verifiable mechanism, so the system based on blockchain technology is easier to win the trust of everyone than black box and third parties.

No tampering

The unforgeable feature of blockchain technology is the foundation of digital assets that cannot be copied. Technically, we can add, delete, modify and check any data. However, in the system based on blockchain technology, the feasibility of deletion and modification is almost zero.

Core principles

Encryption technology is the existing technology before the emergence of blockchain, this paper will not expand in detail. The biggest innovation of blockchain lies in its openness and unforgeability. Next, this article will analyze the core principles of blockchain to help you understand why it is open and unforgeable.

State machine

Let’s start with the simplest blockchain accounting machine, such as Ethereum system (the principle of bitcoin system is a little more circumscribed, but the essence is the same). In fact, multiple nodes maintain the same account book. The bookkeeping machine records information about each transaction in the ledger. From the initial balance of each account and the recorded information, we can infer the balance of each account at any time. In other words, the basic principle of the blockchain bookkeeping machine to complete the bookkeeping function is: state machine [3]. For example: in state1, both a and B have 100; a initiates a transaction and pays 100 to B, and the transaction will be recorded by the blockchain system. We can calculate the account balance of a and B in State2 through the account balance of state1 and the transaction records on the blockchain: A has 50 and B has 150. Similarly, as long as we know the initialization status (Genesis) and will use the blockchain system to record each transaction, we can calculate the balance of any account at any time.

Detailed explanation of blockchain -- from essence to implementation principle

Double payment

Before the blockchain technology came out, there was no good way to solve the problem of double payment in the process of decentralized accounting. Centralized bookkeeping refers to that one node (such as a computer) maintains one account book; decentralized bookkeeping refers to multiple nodes maintaining the same set of account books.

As the name suggests, double payment means that the same amount of money can be used for two payments. Specifically, at the same time point, a will pay 100 yuan to both B and C. If this happens, a is equivalent to spending 100 yuan as 200 yuan. But B, C and one of the bookkeeping institutions will suffer a loss of 100 yuan. In a centralized accounting system, double payment is obviously impossible. No matter whether these two transactions are carried out at the same time or not, the centralized accounting system will process these two transactions in a certain order. The centralized accounting system will first process the first transaction and deduct 100 yuan from a’s account before processing the second transaction. If there is no balance in a’s account at this time, the second transaction will fail.

In a decentralized bookkeeping system, there are multiple nodes that record transaction information. In the above example, some nodes in the decentralized accounting system will receive the transaction information of B first; others will receive the transaction information of C first. In a decentralized accounting system, all nodes are equal. There is no co-ordinated node to decide whether to process B transaction or C transaction first. This leads to the problem of double payment in decentralized accounting system.

To solve the dual payment problem of decentralized accounting system, it can be divided into two steps: the first step is to determine the order of transaction information; the second step, a consensus mechanism is needed to ensure that all nodes recognize this order.

The first step, the principle of confirmation order is very simple, that is, to sort transactions. The data structure that determines the order of transactions is blockchain. The “block” in “blockchain” refers to the collection of transaction information and related data in the same period of time. “Chain” is to connect the blocks in the order of generation.

Detailed explanation of blockchain -- from essence to implementation principle

Consensus mechanism

Consensus mechanism is that independent nodes in the blockchain system spontaneously reach consensus on the sequence of blocks by following a set of same rules. This set of rules can be simply described as the following three steps [4].

All nodes’ pledge costs (e.g., computing power) compete for bookkeeping rights, and the winners produce and broadcast blocks (accounting information), and obtain rewards (such as bitcoin).

Each node independently verifies the new block and assembles it into the blockchain.

Each node selects the longest blockchain independently.

How does this rule enable independent nodes to participate in the bookkeeping of the blockchain system spontaneously? How to avoid the trouble of nodes?

Step 1 ensures that each node will “honestly” participate in the blockchain system for the purpose of “selfishness”. “Selfish” means that nodes are all for profit (profit cost). “Honesty” refers to following the consensus mechanism of blockchain. But if there is profit, there will be cheating. How to prevent cheating? We have to rely on the latter two steps.

In the second step, each node can verify the accounting information of the winning node. Even if a “troublemaker” node grabs the right of bookkeeping and records a fake account, other nodes, including your node, can be verified to know whether it is fraudulent. Blocks (account books) can’t be fake, so is it possible to fake on the chain (sequence)? In other words, double payment is made by reversing the order of transactions.

Step 3, it is not economically feasible to reverse the order of transactions. Since every honest node chooses the longest chain, can the troublemaker make the longest chain? When the length of the chain of disruption exceeds the length of the chain of honesty, the order of the whole transaction is reversed. On a blockchain, there can be only one parent node, but there can be multiple child nodes, and multiple child nodes will have forks, called fork. The troublemaker node can fork the original chain at a node, and then create a longest disruption chain faster than honest node. Is it possible? The answer is that it is possible technically, but not economically.

Detailed explanation of blockchain -- from essence to implementation principle

summary

The essence of blockchain technology is to provide a solution to the trust problem of multi parties through open, encrypted and unforgeable technical means. Now, blockchain technology has a long way to go before it can be applied on a large scale. The most important reason is that the number of transactions confirmed per second is too few and the time to confirm transactions is too long [5]. But think about it from another angle. The problem is the opportunity. Today’s blockchain is like the Internet of 1998. The future is full of challenges and hopes.

This article starts with the official account of the 58 wireless technology.

This paper is supported by the high quality content program of blockchain workshop. For more in-depth good articles on blockchain, please click the brief column of blockchain workshop:http://www.jianshu.com/c/b17f…

Reference articles:

White paper on blockchain technology and application development in China

http://www.199it.com/archives…

Economist the trust machine

https://www.economist.com/new…

How does Ethereum work, anyway?

https://medium.com/@preethika…

Master bitcoin (2nd Edition) translated by Qiao Yanhong

http://book.8btc.com/books/6/…

Fundamental challenges with public blockchains

https://medium.com/@preethika…

Recommended Today

Understanding of promise

What is promise? Including the above: Abstract asynchronous operation tools.In javascript: promise is a constructor (function is also an object) Why promise? 1. If multiple nested asynchronous operations are used directly in the callback mode, it will cause a callback shell2. Promise makes asynchronous operation more standardized and API more unified.3. The complex relationship between […]