Detailed introduction to blockchain and blockchain technology

Source: Internet
Author: User
Tags blockchain blockchain technology blockchain platform blockchain consensus blockchain project

Blockchain is currently a relatively popular new concept, containing two concepts of technology and finance. From a technical point of view, this is a distributed database that sacrifices consistency efficiency and guarantees eventual consistency. Of course, this is one-sided. From an economic point of view, this kind of fault-tolerant peer-to-peer network just meets a necessary requirement of the sharing economy - a low-cost trusted environment.


1. The technician looks at the correct posture of the blockchain


Although the blockchain is an emerging concept, the technology it relies on is not new, such as asymmetric encryption technology, P2P network protocol. Like Lego bricks, building blocks are limited, but different combinations can produce very interesting things.

I have been in contact with some engineers. When I first came into contact with the blockchain, I said incomparably: they are mature technologies, not distributed storage. From the perspective of engineers, the first reaction is to map this new concept into its own knowledge framework, which is very natural. However, it is found that this one-sided understanding may bring a misunderstanding of the blockchain, that is, as a technician, ignoring the economic characteristics of the blockchain—a system of decentralized and fully autonomous .

The blockchain is essentially a P2P-based value transfer protocol. We can't just see P2P, and we can't see the value transfer. In the same way, you can't just see the value transfer, but you can't see the underlying technology of the blockchain.

It can be said that the blockchain is more like an interdisciplinary subject, combining P2P network technology, asymmetric encryption technology, macroeconomics, economics game and so on, to build a new field - the exploration of value Internet.

So what is the value of the Internet? The value Internet can be a payment service derived from the current e-commerce. But is it really just a payment field? Obviously this is not enough. Tier 1 capital market, entity asset recognition and transfer, securities registration and delivery, credit reporting and anti-fraud. Let's think about it again. Are the professional bad reviewers of our major e-commerce platforms still less malicious?

In today's financial sector, in addition to the convenience of payment, in most other businesses, we are like walking in a chain, we repeatedly confirm, repeated review, repeated supervision, we repeatedly build one big size after another Small high-availability clusters ensure the reliability and continuity of online services. We hire one security engineer after another to deliver one penetration testing project. why? Because the cost of cheating is too low, as long as you change the database's one-line record, you can withdraw millions of funds.

The powerful Internet gives us a high-speed information transmission channel with almost zero cost, but there is no low-cost and reliable high-speed value transmission channel, which is what the blockchain is about to bring.

The blockchain is a public distributed general ledger. The following is a brief introduction from a technical point of view:

Imagine a cluster of 100 distributed databases. The current situation is that the actual owner of the 100 nodes is an organization, and all nodes are in the intranet of the organization, so this organization wants these 100 database nodes. Why do you do it, in other words, the 100 nodes are in a trusted environment and are controlled by an entity that has absolute arbitrage allocation rights.

Another situation is this. Imagine that the 100 nodes are owned by different people, and each person's node data is the same, that is, completely redundant, and all nodes are in the wide area network, in other words, this is There is no trust between 100 nodes, and there is no entity, it has absolute arbitration rights.

Now consider the second case, what algorithm (consensus model) can be used to provide a trusted environment that:

The process of exchanging data for each node is not tampered with; the exchange history cannot be tampered with;

The data for each node is synchronized to the latest data and acknowledges the latest data that has been agreed upon;

Based on the principle of minority obeying the majority, the data maintained by the overall node itself objectively reflects the exchange history.

The blockchain is essentially a technical solution to solve the above second case, and more specifically, it should be called a distributed redundant chained ledger solution. Some of the elements of the blockchain have been summarized in my previous articles:

Contains a distributed database

The distributed database is the physical carrier of the blockchain, the blockchain is the logical carrier of the transaction, and all core nodes should contain the full copy of the blockchain data.

The blockchain serializes the blocks in time, and the blockchain is the only subject of the entire network transaction data.

Blockchain is only valid for additions, invalid for other operations

Public and private key verification based on asymmetric encryption

The accounting node requires the Byzantine general to be solved/avoided

The consensus progress is evolutionarily stable, that is, the contradictory data facing a certain amount of different nodes will not collapse.

The consensus process can solve the double-spending problem

Therefore, as a technician, you should not only see the technology that the blockchain depends on, but also the points and faces outside the blockchain. In general, the blockchain will be much more interesting.


2. Introduction to the general structure of the blockchain

Regarding the development history of the blockchain itself, there are many data on the network, and this article will not repeat them.

The introduction of blockchain technology is detailed in the community of each blockchain platform, but the summary of these materials, as well as the abstraction of a common concept, is still rare, this article tries to summarize.

Before the introduction, I would like to introduce a little about the concept of public chain and alliance chain. These concepts were proposed by the founder of Ethereum Vitalik. I have done some research on the basis of these concepts.

In fact, it is very simple to distinguish between the public chain and the alliance chain. Just look at the access rights of this blockchain. If you need to obtain the permission of the node on the chain, then this is a coalition chain, otherwise it is a public chain.

According to the name, we can also "see the meaning of the text", publicly represents a completely open network, the alliance represents a semi-open network, members are shared, non-membership is not free access, so we also call the alliance chain License chain.

Let's look at a few more mainstream blockchain platforms (public chains, all open source):

Bitcoin Bitcoin

Ethereum Ethereum / Classic Ethereum Classic

Bit shares Bitshares

I generally call it the "Big Three". From an ecological point of view, Bitcoin is the most mature and stable. Ethereum is more like a warrior rushing ahead. Bit stocks are much smaller than the first two ecology, but from the innovative The angle is no less than the first two.

Many other projects are derived from these three blockchains, so based on these three, you can basically get through the blockchain.

I have to mention the Linux Foundation project, the HyperLedger project (mainly the alliance chain, open source), and also aims to create a common blockchain technology, but I think it is still in the development iteration, there is no specific application case. , press not to speak.

There are also some alliance chain projects between bank oligarchs - R3 CEV project (chain of alliances, closed source), and China's R3 project - ChinaLedger (chain of alliances, closed source), of course, these are not open source, I can not get useful The data is analyzed, so it will not be expanded.

From a technical point of view, for different business scenarios, there are different requirements for blockchains, such as real-time settlement services, which require blockchains to provide second-order delivery, corresponding to the requirement of block speed, and the block speed is too fast. It often leads to blockchain forks, forming orphan chains, and orphan chains are invalid, then the transaction is invalidated, which affects the final consistency of the blockchain.

If a frequent fork occurs and a significant percentage of user transactions fail, then the system can be considered unreliable.

If we put this kind of real-time demanding business into the alliance chain, we can control the risk. By adjusting the consensus algorithm and using the Consensus Model to avoid the above problem, although not as robust as the public chain, It is enough for some special scenes.

Therefore, at the architectural level, the technologies of the public chain and the alliance chain should be treated differently.

However, the overall design of the client still has some general concepts, as shown below:

A blockchain is divided into at least three layers. The bottom layer is some common basic modules, such as basic encryption algorithm, network communication library, stream processing, thread encapsulation, message encapsulation and decoding, system time, etc.

The middle layer is the core module of the blockchain, which generally contains the main logic of the blockchain, such as P2P network protocol, consensus module, transaction processing module, transaction pool module, simple contract or smart contract module, embedded database processing module, Wallet module, etc.

The top layer is often based on the Json Standard RPC interactive module. Based on Json-RPC, we can also make a better UI interface, or it can be a web-service.

If the blockchain supports smart contracts, it may be divided into more layers, such as adding the BaaS layer. Smart contracts on the blockchain provide autonomous services, such as the following Ethereum architecture diagram (from Google, for reference only):

This layering is more concerned with the layering of the blockchain itself, that is, the business perspective, not completely technical.

We turn to the design of Bitcoin:

The coupling between several modules of Bitcoin is actually quite high, and there are quite a lot of historical burdens. The inventor of Bitcoin, Nakamoto Satoshi, developed VC++ when developing Bitcoin, and sstream in VC++'s standard library. The stream processing performance is very moving, and I have to give up and implement the vector-based stream processing container. With the introduction of C++11 and the update iteration of the standard library, performance is not the same.

As you can see from the whole picture, the Bitcoin module is relatively small and relatively simple. The chain-paramters describe the parameter settings for the entire blockchain, wallet is associated with address/encryption and storage, and mem-pool is an unconfirmed transaction pool. Thanks to the immortal contribution of the Bitcoin core developers, the bitcoin code quality is quite good now compared to the Bitcoin code of the Nakamoto era.

Regardless of the design above, it is generally necessary to cut in from the P2P network protocol. As a P2P wallet, both the Service and the Client are provided, and the Service depends on the P2P network protocol, and the Client relies on Json-RPC.

It should be pointed out that the current account models used by the "Big Three" are different (the so-called account model refers to the account accounting method), Bitcoin uses the UXTO model, and Ethereum and BitShares use the account balance model.

UXTO Model (UTXOs): This model expresses the concept of a transfer, that is, any generated new currency, in the future life cycle, only transfer, no extinction, the transfer is essentially the signature of the encryption algorithm With validation control:

Account Balance Model: The account balance model discards this strongly validated account model, ie the account balance is returned to the number plus or minus, which increases the efficiency of the transaction.


3. Consensus algorithm and distribution

Finally came to the point, each section of this article can actually be launched into an independent article, limited content, simple.

The so-called blockchain consensus process, mentioned above, refers to the process of how to record the entire network transaction data objectively and not to be tampered with. At present, the "Big Three" use different Consensus Algorithms, Bitcoin uses ProW of Proof of Work, Ethereum will be converted to ProS of Stake, and BitShares use license to prove DPoS (Delegated Proof of Stake).

These algorithms are called "economics" algorithms. The so-called economic algorithms mean that the cost of cheating can be calculated, and the cost of cheating is often far greater than the benefit of cheating, that is, cheating is unprofitable. The idea constructs an algorithm for the game between nodes and tends to a stable balance.

Correspondingly, we also have distributed consistency algorithms in the computer field, such as Paxos, Raft, which I also call the traditional distributed consistency algorithm.

The biggest difference between them is the reliability of the system in the Byzantine Generals Problem scenario, namely Byzantine fault tolerance (the PBFT algorithm supports Byzantine fault tolerance). However, whether it is Paxos or Raft algorithm, it is theoretically possible to enter an infinite loop that cannot be voted on (although this probability is very very low), but they all satisfy the safety, but relax the requirements of liveness, PBFT is also like this. .

The following are some of the similarities and differences between traditional distributed consistency algorithms and blockchain consensus processes. Let's look at the same point first:

Append only

Emphasis on serialization

Minority obeying majority principle

Separation coverage problem: long chain coverage of short-chain blocks, multi-node coverage of a few node logs

This is different:

Most of the traditional distributed consistency algorithms do not consider Byzantine fault tolerance (except Byzanetine Paxos), which assumes that all nodes only have non-human problems such as downtime and network failure, and do not consider the problem of malicious nodes tampering with data;

The traditional distributed consistency algorithm is oriented to the log (database), that is, the more general case, and the blockchain consensus model is transaction-oriented, so strictly speaking, the traditional distributed consistency algorithm should be below the blockchain consensus model. layer.

Considering the differences above, combined with the characteristics of the public chain and the alliance chain, we have:

Alliance chain: A semi-enclosed ecological value network with peers that are not trusted, such as members of a certain association.

Public chain: an open ecological value network that provides a global trading network for the industry chain and the private chain.

Due to its semi-closed and semi-open nature of the alliance industry chain, it is feasible to use Delegated Proof of XXX. It is also possible to consider adding a Byzantine fault-tolerant/security protection mechanism based on traditional consistency algorithms.

For the public chain, the "economics" algorithm such as PoW/Pos/DPos may be the optimal algorithm.

Technically, the above different consensus algorithms, many of our new development blockchains support a feature: the consensus module can be plugged and unplugged to meet the requirements of different scenarios.

The following picture is an ecological diagram of the future blockchain:

The public chain provides a credible and reliable value transmission network, which can continue to set up decentralized applications (DAPP) or deploy alliance chains, and even traditional databases can be used to build C-side applications on the upper layers.


4. Digital Assets and Value Distribution Network

Here is a schematic diagram of the development of the future blockchain:

Ref: Metaverse Meta-White Paper-CN (Summary)

Among the “Big Three”, Bitcoin is in the “Digital Currency”, Bitcoin is in the “Decentralized Exchange”, and Ethereum is in the “Decentralized Organization”. In fact, the blockchain and the actual contact point are still in the position shown.

Therefore, the blockchain is still a growing thing. In combination with Figure 5, we hope to build a value-transport network with perfect infrastructure, and the upper-layer application of rich blockchain ecology still requires a lot of effort.

The next step is to digitize assets (classification of assets). For example, we can digitize rare items (artworks/antiques), digitize intellectual property, bill funds, etc., which will greatly enhance the efficiency of market operations. Smart contracts, even artificial intelligence, programmable society is no longer a dream.

Wonderful question and answer

Question: I still feel too abstract. I still can't understand the blockchain in a concrete way, and I haven't found a concrete explanation.

Just like the blockchain term, it is created, and no previous concept can be mapped to it, so it is easy to understand. We don't talk about this concept, we just need to think about what our internet needs. As mentioned in the Bitcoin White Paper, a peer-to-peer cash system requires a very low premise, no registration, no phone number, a peer-to-peer network, as long as you use the device to access it, then you can use it. . The concept of blockchain is the same, with the aim of constructing a peer-to-peer ecology and deconstructing the asymmetry of power. It is just a shared general ledger, which is different from the multi-nodes in the network, and then reconciles, which disintegrates the central authority.

Question: How is blockchain technology applied in Internet identity authentication?

This problem is very good. The blockchain project I am currently working on covers this concept, which is what you call Internet identity authentication. We think it is a necessary part of linking blocks into real business.

In our vision, what is identity first? An identity is not just an ID number, a password, but a set of operational records owned by a user. The code of this record set is the identity. Just as the account is lost, and then the appeal is the same, the content of the appeal is the one who really targets you. The blockchain is the same, it requires the same ID, and it also needs to automatically verify the legitimacy of your history. At present, the identity authentication of the Internet is dependent on the public security system. The simplest solution is to map the identity system in the public security system to the blockchain. Another option is also a user-defined record set that checks the identity against the transaction history. Of course, in the future, combined with artificial intelligence, the blockchain may have better performance.

Question: If the real-time delivery data is placed in the alliance chain, will the data of the alliance chain be finally synchronized to the public chain? According to sharing, the data of the alliance chain is untrustworthy to the public chain. What is the relationship between the data in the alliance chain and the public chain?

I don't think it's possible that all institutions will be willing to put assets on the public chain, and there will be coexistence. Ideally, of course, the public chain is used to build a decentralized application. The direct data of the alliance chain and the public chain is a purely citation relationship. I think that the key data sets that are open, such as the user identity should be deposited into the public chain, let the users manage themselves, and the key data of the organization is relatively private, it should be used to access it. Isolation from the public chain, so the data of the alliance chain and the data of the public chain are considered complementary. In other words, whether the data of the alliance chain should be synchronized to the public chain depends on the needs of the organization itself. In addition, the external data reference of the public chain, we call it data-feed, this thing must introduce human factors, such as the law, lawyers, government agencies, etc., as an arbitrator to help reference data, good or bad can Let the market evaluate credit, just like rating an institution, if it is transparent.

Question: There are some very interesting physical projects such as smart door locks, no car rentals, these are offline projects, how to achieve interoperability?

First of all, the blockchain project is cross-platform, which means that embedded devices can rely on the low credit cost of the blockchain to automatically book accounts, either in the alliance chain or directly based on a public chain. DAPP, these books are shared. When these data are referenced, they can enter the public chain channel and get through the relationship.

Secondly, any specific blockchain project needs to rely on a public chain. Just as many landing projects are based on the “Big Three”, there is currently no standard that everyone is particularly satisfied with. Service, so I have to wait and see.

Question: Thank you for sharing. Can you talk about the impact of the various stages of blockchain development in the last picture on the traditional financial industry, especially the banking industry?

The impact on the banking industry, I think the impact at this stage is not big, especially at home. This depends on the extent to which the blockchain develops. As far as I know, the central bank has already started its own digital currency. For banks, at most, there is another IT infrastructure upgrade, which can help the banking industry reduce IT costs and facilitate supervision. But if in the future, the bank may not be particularly closed, becoming a proxy node for some blockchains, and will be supervised by everyone, not a few special institutions.

Question: If the public chain can record all history, is there any technology that can destroy or ban, is there a day when life ends?

There is a little technical risk. When the general quantum computing business is used, many of the current encryption technologies are invalid. The blockchain based on cryptography is the most affected (of course, the current centralized architecture will also be affected). It depends on the results of theoretical research. If there is a new cryptography theory that can resist quantum computing, there is no problem. From the perspective of the P2P network, there is no institution or individual that can be banned. As long as there are two nodes that can also make transactions, the blockchain is alive.

From the perspective of economics, the life and death of the blockchain is not mainly whether the encryption technology is broken, but mainly because of the wealth and benefits gathered in the chain, and the value of the data on the chain. If there is no value, the chain will naturally die. On the other hand, if it is broken, it is a fork, or waiting for a new encryption algorithm to come out after data migration, which is not much different from the centralized database recovery backup.

"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.