Blockchain circle

One stop hot information platform

About us:

Blockchain circle provides the latest information about blockchain, digital currency, digital wallet, exchange, metauniverse, bitcoin, Ethereum, contract, financial management and so on, and always pays attention to the latest market...

How to understand the blockchain architecture in 5 minutes?

Time : 10/02/2022 Author : 91t5pz Click : + -
        As a beginner, how to understand the blockchain technology, blockchain thinking, and the financial principles of bitcoin in the shortest time? This article attempts to make people understand the technical essence of blockchain from a macro perspective based on the architecture design thinking of bitcoin. Blockchain is not a technical implementation, but a system architecture design that uses a series of technology combinations to complete decentralized data storage. Bitcoin integrates finance, moneology, game theory and even a certain degree of philosophy on the blockchain, which is used for the issuance, operation and trading of electronic money. Before learning the blockchain, we need to master some basic knowledge in advance. Later, we will not describe the specific technology, but describe what problems this technology solves and why it is used.
        If you are an architect and do the architecture of a system, you must first understand what the system needs to do? What problem should be solved? Carry out analysis with this problem and design the overall architecture of the system. The same is true for bitcoin. First, find out what bitcoin does and what problems it needs to solve? Then take these problems to analyze the technical implementation of bitcoin. If we use one sentence to describe what bitcoin will do, we can describe it as follows: to build a decentralized electronic currency issuance and trading system. Here are three keywords:. All currency transactions in the world today are handled by a third-party trusted financial institution. No one can access the data centrally stored by the third-party institution. Theoretically, if the financial institution is fraudulently or bankrupt, the currency stored in the institution and the transactions made will be at risk.
        Of course, the decentralization of bitcoin is not because of the risk, but because there is no need for this third-party organization. This is also one of the strong subversives of the blockchain. Any data that needs to be stored and processed by a trusted third-party organization can be stored in a decentralized and secure manner and accessible to all. Centralization corresponds to distribution, and decentralization refers to distribution. The data originally stored in a third-party organization and stored centrally is distributed. Decentralized distributed storage means that the entire issued electronic money and currency transaction data are stored by thousands of computers of different institutions and individuals, and the same data is maintained together. Only the same data maintained jointly is considered as the final correct data. It is meaningless for any individual to tamper with his own data, and the stored data can be accessed by all.
        As an architect, what kind of network structure would you choose to implement this distributed storage? One way is to use a method similar to HDFS in Hadoop, and a central node namenode can coordinate access. However, this method will bring a single point of risk, destroy the central node, and the entire system will not be accessible. Or Cassandra decentralized voting mechanism can be used to maintain the state of the entire cluster, but this method will lead to no convergence in the global open deployment. Therefore, bitcoin adopts a more simple and direct way to maintain the entire bitcoin network cluster by using P2P protocol. It does not require a central node to coordinate the communication between nodes, and it does not require all machines to vote to maintain the cluster status.
        Instead, data transmission between nodes is carried out through the P2P protocol. Any node can join or leave the bitcoin network cluster at any time without affecting the bitcoin network cluster, and there is no need to repair the faulty machine in the cluster. a. Broadcast the data to be stored to all nodes for storage. b. Query the latest data of all nodes in the entire network cluster. If the data of your own node is inconsistent with the data of most nodes, update your own data to be consistent with the data stored by most nodes. Bitcoin is decentralized storage. The biggest risk is that the entire bitcoin network cluster is destroyed and the data stored in the entire network is tampered with.
        However, the above-mentioned second function point can effectively prevent this risk. Since the system will automatically update the same data stored for most nodes in the entire cluster, to tamper with the data, it is necessary to tamper with more than half of the data of the entire network at the same time. This is not impossible, but bitcoin uses the blockchain method and the interest game mechanism. When you have this ability, There is no need to tamper with such a low input-output ratio, which will be described in detail in the section on data tamperability. Jack submits a certain transaction data to server a, which verifies the validity of the data and stores it in its own database. At the same time, Jack transmits the transaction data point-to-point to all nodes B, C, D and e of the bitcoin network cluster.
        A maintains point-to-point communication with all other nodes B, C, D and E, and automatically updates the same data maintained by most nodes in the cluster. If the data saved by the three servers B, C and D are the same, but not the same as that of a and E, a and e will automatically update to the same data as that of B, C and D. Therefore, Jack's transaction needs to wait until all nodes in the bitcoin network cluster accept it and consider it as legal storage before it is considered to be successfully completed. Of course, in reality, it is not necessary to wait for all nodes to confirm the completion. Generally, only a few servers need to confirm the completion of the transaction, because the data state maintained by each server and the entire network cluster is consistent. When a small number of servers think that the transaction is consistent with the entire cluster, the transaction is consistent in probability.
        The data storage under this network structure will continue to be described in the final consistency section. After designing the network structure for bitcoin system operation, we need to consider the non tamperability of data, because this data storage is decentralized and accessible to anyone, so it is easy to be tampered. The previous section describes that under the operation mechanism of this network structure, to tamper with data, more than half of the node data in this network cluster must be changed at the same time. If each node does not have a secure protection mechanism, It is easy to modify the data of more than half of the nodes in the network cluster at the same time. First, if you are an architect, how would you design this protection mechanism to ensure that the stored data cannot be tampered with? Traditionally, we save transaction data one record by one in the database table, and the database is placed on the server of a third party organization, which sets strict access restrictions on the network, server and database where the server is located for data security.
        But how to protect the security of data in a decentralized environment where no organization or person can control the access rights of the system?. One way is that each person hashes the inserted data and signs it with his own key, and then attaches his own public key. The system can verify whether the inserted data has been modified with the signature and public key. If the database table is compared to an account book, every data in the table is considered as every transaction recorded in the account book. There are two problems here. First, you can not insert data at will. If you do not have bitcoin, but still insert a piece of data transferred to someone, the system needs to find it is illegal and refuse the insertion request.
        Second, in addition to not being inserted and modified at will, it is also necessary to prevent data from being deleted. Signing each record above cannot prevent it from being deleted maliciously. With these questions, if you are an architect, what kind of architecture design would you do to realize these requirements?. Here we will begin to introduce the design of blockchain. The above compares the database table to an account book. If there is only one table in the system, that is, an account book, the data in this account book can be easily changed. If the system automatically generates a table every 10 minutes, that is, a new account book is generated, and the new transaction records are recorded in the new account book. And certain conditions are required to create this new account book. Use the sequence number of the current account book, the hash value of all records of the previous account book, the system time stamp (one dimension of 10 minutes), and then find a random value. After several data are hashed together, certain conditions are met. For example, the system will receive this new account book if the first number of bits is 0.
        The generated new account book is concatenated with the previous account book through the account book sequence number to form a chain structure of the account book. The new account book depends on the data of the previous account book and the current system timestamp. Therefore, once the new account book is generated, the data of the historical account book cannot be tampered with, because once tampered with, it will not match the subsequent account book and the account book will be destroyed, Automatically update the same account book maintained for most nodes in the network cluster according to the network structure described in the previous section. Once a linked account book is formed, it is impossible to change the data in a historical account book. If a historical account book is changed, all accounts after it need to be changed. However, each account book can only be received after verifying whether the hash value meets the conditions according to the current system timestamp. Therefore, it is impossible to tamper with the data in the historical account book.
        What we can do is to invest a very large cost to build a bitcoin cluster. If this cluster exceeds the current cluster, then the data will automatically follow the newly built cluster. This is why the mutual protection mechanism of multiple account books is more difficult to tamper with than a single account book. As will be described in the subsequent currency issuance and transaction, when you have the ability to rebuild a new bitcoin network cluster to attack and tamper with data, your income will be far lower than your cost. In order to prevent the data of the previous account book from being tampered with, the generation of a new account book depends on the hash values of all transaction records in the previous account book, so that once the data of the previous account book changes, it will not correspond to the new account book.
        However, calculating the hash value of all transactions in an account book is a time-consuming calculation, so bitcoin uses Merkle tree to hash all transactions in an account book. It is mainly to solve the efficiency problem of hash calculation of transaction records in account books. As shown in the figure below, ha, Hb... HP are specific transaction records. Each adjacent two transaction records form a hash value upward, and then form a hash value with the adjacent node upward until the root of the tree forms the unique hash value of all transaction records. For distributed storage, the cap theory cannot be bypassed, and bitcoin is the same. Bitcoin uses P2P protocol for data transmission between nodes, abandoning the consistency in cap and adopting the two dimensions of AP.
        If the attribute consistency is abandoned, the Byzantine general problem arises. How can so many nodes achieve data consistency. The Byzantine army is composed of small teams. Each team has a general in charge. The generals convey a series of actions through the command troops. However, there are some rebels in the army. What should we do if we deliberately destroy the command?. Like the Byzantine general problem, it is difficult to achieve consistency in the distributed storage system, especially in the system cluster of bitcoin open global deployment. Therefore, bitcoin gives up strong consistency, and through P2P peer-to-peer communication, there is no central node. Server failure, leaving and joining the cluster will not affect the whole cluster.
        In the previous section, the basic mechanism for generating the account book is described. The sequence number of the current account book, the hash value of all records of the previous account book, the system time stamp (one dimension of 10 minutes), and then a random value are found. After several data are hashed together, certain conditions are met. For example, the system will receive the new account book. This is the consensus of all nodes in the cluster. All nodes only receive such account books, And finding this random value requires huge computing power. It is called proof of work (POW) mining in bitcoin. When this value is found every 10 minutes, a new account book is generated.
        However, the network clusters are all open. Two values may be found at the same time, and two account books are generated in a small number of nodes in the cluster. In view of this situation, the bitcoin system is designed as follows: the whole network cluster adopts the principle of the minority obeying the majority. Which account book is adopted by the majority of nodes in the cluster, and the few nodes obey the majority of nodes. The account books that are not adopted by the majority are discarded to achieve final consistency. In the previous chapter, we mainly described how a decentralized system can store data safely without being tampered with. It mainly adopts the P2P network structure + block chain structure to solve the problem of safe storage of data. But for a currency, we need to solve the issue of a currency, how to issue it, and to whom? How can the bitcoin system let all people run spontaneously? The issue of currency needs to be fair, open and just, and the currency cannot be issued to a third-party institution. Anyone can obtain the issued currency as long as he meets certain conditions.
        Think about it. If you were an architect, how would you design a system to issue money?. In essence, the bitcoin system itself can find a random value and generate a new account book. But bitcoin combines the computational power behind issuing currency and finding new books. Searching for a new account book requires a lot of computing power. Whoever finds a random value that meets the conditions of the new account book represents that he has consumed a lot of computing power. Once the new account book is received by the system, the system will automatically record a record of transferring a certain number of bitcoins to him in the new account book, thus completing the currency issuance. The operation of bitcoin must depend on the generation of new account books. Whoever finds a new account book can obtain the transfer records automatically generated by the system, that is, obtain a certain amount of bitcoin, which is mining.
        This also encourages people to continue to invest in mining, constantly dig up new accounts, and maintain the operation of the bitcoin system through incentives. What reflects the design genius here is that bitcoin integrates finance, moneology and game theory, and forms a certain operating mechanism through the system, which encourages people to let the system run spontaneously. In the section on electronic currency issuance in the previous section, it is described that whoever finds a new account book through calculation, the system will automatically record an account and transfer a certain amount of bitcoin to whoever, and he will also get bitcoin. So how can you confirm that the recorded transaction belongs to you and is not taken away by others? How do you solve this problem as an architect?.
        Bitcoin uses asymmetric encryption technology to operate the user's account. The public key is the user's account number. Whoever finds a new account book, the system automatically records a specific amount of bitcoin into the public key account of the new account book discoverer. When the user wants to consume bitcoin, it needs to sign with the private key. The system will verify whether the signature is correct with the account number, that is, the public key, and calculate the real amount in the current account from the historical transactions according to the user's account number to ensure that the funds operated by the user are within the real amount of the account. There are two main points in the design here:. Each record inserted needs to be signed with the private key. The system verifies whether the signature is correct with the account number, that is, the public key. If the signature is correct, it is considered legal.
        If the first condition is met, verify whether the transfer amount in the inserted record is correct. The verification method is to calculate the current amount of the account from all previous transaction records of the public key. If the amount does not exceed the value, it is legal. The figure is as follows:. This mechanism can ensure that only one's own account can be operated. In combination with the final consistency principle under the P2P network structure and the chain structure of the account book, an attacker needs to build a network cluster that exceeds the current bitcoin network and has more computing power than the current cluster to create another
Previous:"Culture and art chain" was released in Beijing, officially launching the digital art and blockchain Laboratory
Next:No more

Related articles:

© 2005-2032 | Blockchain Circle & & All Rights Reserved    Sitemap1 Sitemap2 If there is infringement, please contact us at: