Detailed block chain architecture

Chain-off, designed for developers and students, Insider!

This article from the chain off the block chain Q & A community , refused reproduced without permission.

Here Insert Picture Description

Ready to work

Block chain is not a technology, but a system architecture design, using a series of techniques used in combination to complete the center of data storage. Bitcoin block chain over into the finance, currency, game science, philosophy and even to some extent, for the issuance of electronic money, operation and trading. There are some basics need to know well in advance before learning block chain, the latter will not be expanded description of the specific technology, but to solve the problem from this technology, why use this technique to describe this perspective.

F2f

Irreversible algorithm

Asymmetric encryption algorithm

Merkle tree

CAP theory

The final consensus algorithm

Bitcoin What to do?

If you are an architect, do the architecture of a system, you first have to figure out what to do in this system? To solve a problem? With this question the analysis, the overall system architecture design. For Bitcoin, too, first find out what Bitcoin is to be done to solve the problem? Then direct them to the parsed bit currency technology.

If you use a word to describe what Bitcoin to do, it can be described: Make a decentralized electronic currency trading system. There are three key words:

To the center

Electronic currency

Electronic currency trading

To the center

All currency transactions in today's world is a trusted third-party financial institutions to provide processing services, anyone can access this data by a third party centralized storage, in theory, if the financial institution fraud has occurred or collapse, then money is stored in this body, as well as transaction done there is a risk. Of course, to the center of Bitcoin, not because of fear of the risk, but do not need the third party of. This is one of the powerful subversive block chain, those who need a trusted third-party organizations need to secure the save process data can be securely stored to the center, everyone can access.

From a technical perspective, how do decentralized?

Central counterparts is distributed, is distributed to the center. The original data is stored in a third-party organization, centralized storage, distributed storage.

Distributed storage to solve three basic problems

Network architecture

Data is not tampered with nature

The final consistency

Network architecture

Decentralized distributed storage refers to the overall issuance of electronic money, as well as currency trading data from different institutions, individuals unreasonable thousands of computer storage together to jointly safeguard the same copy of the same data, only common maintenance of this the same data is the data that the ultimate right, any person tampering with their data no sense, and everyone can access the stored data.

Using P2P protocol for data transmission between the nodes has two main functions:

a. The need to store the broadcast data to be stored on all the nodes. b. check the latest data from all nodes in a cluster across the network, the data are inconsistent with most if its own node node, the update data itself is consistent with most of the data storage node.

Bitcoin is a decentralized storage, the biggest risk is the entire bitcoin network cluster is destroyed, tampered with the data stored across the network. But the second function points can effectively prevent this risk, because the system will automatically update the same data for the entire cluster majority node storage, so to tamper with the data, it must at the same time more than half of the entire network tampering with data, it is not I can not say, but use bitcoin block chain coupled with the interests of the game the way the mechanism, when you have this capability, do not need to tamper with such a low input-output ratio of such things, the data a non-tamper resistance is described in further detail.

Data is not tampered with nature

After the network architecture is designed to run bit token system, data can not be altered to be considered, since such data storage is decentralized, anyone can access, then it is easy to be tampered with, in this section describes the under the network structure of the operation mechanism, to be tampering with the data, you must change the node data on the network at the same time more than half of the cluster, each node if there is no security protection mechanisms, then it is easy to do is modify the network at the same time more than half of the cluster data nodes.

One way is for each person to own this data inserted after the hash sign with your own key, and then comes on if their public key, the system can use the public key to verify the signature and insert the data has been modified. If the database table likened to a book, watch each piece of data is considered to be every transaction recorded in the books. There are two problems, first, not at liberty to insert data, if you do not have bitcoins, but still insert a data transfer to a person, the system needs to be found illegal, rejects the insertion request. Second, in addition to not freely inserted and modifications, but also the need to prevent deletion of data, each record above the sign does not prevent malicious deleted.

Once a book after the chain can not go to change the data in a history book, change a history book, you will need to change all the books after it, but each book are based on current the system time stamp verification hash value meets the conditions to receive, it is impossible to tamper with the data history books. Can do only additional investment is very high price and then build a Bitcoin cluster, the cluster than the current cluster, data is automatically prevail in accordance with the newly built cluster. This is another protection mechanism plurality book more difficult to be tampered with than a single book. Issuance and trading currency in the subsequent re-describe, when you have the ability to rebuild a new Bitcoin network to attack the cluster for data tampering, benefits you get will be far less than the cost of your investment.

In order to prevent the last book data is tampered, generate a new hash value relies on a book in the book of records of all transactions, so that once the last book data is changed to correspond to the new book is not . But all transactions calculated hash value is calculated book in a time-consuming, and therefore Bitcoin uses merkle tree for all transactions in a book of the hash calculation. It is mainly to solve the efficiency problem of books in the transaction record hash calculation. Below HA, HB ... HP specific transaction records, each adjacent two form a Hash value transactions up, then the adjacent node is formed further on hash values, until all transactions that formed roots only hash value.

Network structure previously described and books chain structure described in this section, are essentially of the Solution to the data center secure storage.

The final consistency

Distributed storage is not open around CAP theory, the same bit currency, credits bit P2P protocol employed for data transmission between nodes, the abandoned Consistency CAP, the AP uses two dimensions. Consistency If you give up this property, then had a Byzantine general question of how much data node to reach consistency. The Byzantine army are one squad, each squad has a general responsibility for the generals to convey a series of actions by military orders, but some of them rebel, vandalism orders how to do?

Distributed storage system and Byzantine generals problem as it is difficult to achieve consistency, the system Bitcoin open cluster in the global deployment of even more so. So Bitcoin gave up strong consistency, and point to point communication via P2P, no central node, server failure of the entire cluster, leave, join the cluster does not have an impact on the entire cluster.

Electronic currency

In the previous section to the center, which describes a decentralized system, how to do secure data storage, not to be tampered with. It mainly uses the P2P network architecture + block chain structure to solve the security of stored data. But for a currency, but also a need to address the issue of money, how to distribute, distribution to whom? How to make Bitcoin system allows all people spontaneously run forever? Currency issue needs a fair, open, fair, and money can not be issued to a third party, any person they meet certain conditions will be able to obtain currencies. Think about it, if you are an architect, how would you design the system to issue currency?

Essentially, the bit token system can find itself a random value, generates a new book. But Bitcoin the currency issue and look for new computing power behind the book together. Looking for new books need to consume computing power, who found a random value in line with the conditions of the new book, he represents consumes a lot of computing power, once the new book is receiving system, then the system automatically records a new book in which the he must transfer to the record number of Bitcoin, we completed the issuance of currency.

Electronic currency trading

Section on electronic money issuance described in the section, and who found a new numerical strength of books, the system will automatically credited to an account, transfer a certain amount of bitcoins to whom he also won the bitcoins. How to confirm the transaction record belongs to you, do not be taken away by anyone? As the architect of how you solve this problem?

Bitcoin uses asymmetric cryptography operations on the user's account, the public key is the user's account number, who found a new book, the system automatically to new books discoverer of public accounts, recorded a record number of specific Bitcoin . When users want to consume Bitcoin, the need for signing with the private key, the system will use the account number is the public key to verify the signature is correct, and calculated from the true history of the transaction amount in the current account in accordance with the user's account number, to ensure that funds operating within the user account of the actual amount. The design here there are two main points:

Each insertion is a record requires public key to verify the signature with the private key signature is correct, the system with the account number, verify that the correct considered legitimate.

If the first condition is satisfied, the inserted record to verify the amount to be transferred is correct, verify that the way is calculated the amount of the current account of the public record of all transactions in the past, and if the amount does not exceed the value was legitimate . Illustrated as follows:

Block chain applications

Bitcoin system solves the problem of safe storage of the center to solve the problem of issuing currency, to solve the problem of currency trading account security after, they built an electronic current Bitcoin virtual currency system a. The use of bitcoin block chain is considered to be a disruptive technology, a revolutionary technology that his subversive reflected in what place? It is not technology above subversion, mainly on the ideological level of the revolutionary business model level. For example, on a democratic transition from centralized to, it is a revolutionary change for this country and social state. The block chain technology offers two basic functions:

Centralized data storage to go

To ensure the security of your account

In theory, allow the original data services to be provided by a third-party organization, it can be a revolutionary change for the decentralized way to provide services, such as Bitcoin can replace the use of each country's legal tender. This feature will block chain business model derived from all walks of life disruptive change.

Guess you like

Origin blog.csdn.net/weixin_44172023/article/details/91953139