In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to understand blockchain". In daily operation, I believe many people have doubts about how to understand blockchain. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "how to understand blockchain"! Next, please follow the editor to study!
How to understand Block chain
First of all, the concept of blockchain is introduced: a node-based decentralized consensus protocol and workload proof (PoW) mechanism are combined. Nodes get the right to participate in the system through the PoW mechanism, and package transactions into blocks at regular intervals, thus creating a growing block chain.
There are two main concepts: decentralization and workload proof mechanism. In fact, the decentralization of Bitcoin may be more obvious, which I have written before to interpret Bitcoin as the earliest blockchain technology and the changes brought about by blockchain.
How to decentralize: each block in the blockchain system is responsible for recording transaction information, and each user's income and expenditure is permanently stored in the block for others to query. Each node will save a complete transaction data, all these nodes constitute a block chain of distributed database system, any node data problems, will not affect the operation of the whole system.
Workload proof mechanism: Proof Of Work (PoW), a simple understanding is a proof, used to confirm that you have done a certain amount of work in the system. Compared with the whole process of inefficient monitoring, it is a very efficient way to prove that the corresponding workload has been completed by certifying the work results. For example, by completing various tasks in our work, we prove that we have created value for the company, so as to be recognized by the company. This kind of "work certificate" usually takes a certain amount of time to get.
Workload proof mechanism (PoW)
Workload proof mechanism is an economic response to denial of service attacks (DoS) and other service abuses. It requires the initiator to carry out a certain amount of operation as a cost, which means that it takes a certain amount of time for the computer. For example, the verification code (slider or jigsaw puzzle) that needs to be entered when logging in to the website now adopts this CAPTCHA mode.
Similar to CAPTCHA, hash cash (HashCash) works by adding a hash value of hashcash stamp containing the recipient's address, sending time, and salt random number to the header of the message, but it is legal to satisfy that the first 20 bits are all zeros. This requires that the sender needs to adjust the value of salt for many times before formal transmission, and only after meeting this condition can the sender send it successfully. But we don't want the sender to continue to reuse after calculating the stamp, so HashCash stipulates that the expired stamp is illegal (that is, send time > stamp time).
The block chain also uses a workload proof method similar to hashcash, which does a double SHA256 operation (i.e. SHA256 (SHA256 (HEADER) on the data in the block head, and compares it with the target value of the current network. If it is less than the target value, the workload proof is completed.
PoW is explained here to make it easier to understand how PoW is applied to blockchains. Mining is also carried out through PoW. In the Bitcoin system, after the node completes the proof of workload, it means to obtain the transaction bookkeeping right of this block. The system will allow miners to compete for bookkeeping rights through the PoW mechanism, and those who perform more operations per unit time (with higher computing power) will have a higher probability of getting block bookkeeping rights. The miner who gets the bookkeeping right will broadcast the block to the network, and after other nodes in the network verify that the block meets certain conditions, the block will be linked to the main chain, thus forming a consensus on the current network status in the whole network. the miner will also receive a certain number of tokens rewarded by the system. All the blocks are linked together in this form to form the main chain of the block chain, and all historical transaction data are open and transparent from the Genesis block to the latest block currently generated.
It is mentioned above that blocks are used to record transaction information, and the data in the block head is involved in the PoW process. Then it is necessary to further analyze the contents of the block.
The composition of the block
For each input and status in the transaction, there are the following definitions:
1. An error is returned if the referenced UTXO is not in the current state, or if the signature does not match the owner's signature of the referenced UTXO.
two。 If the total UTXO of all inputs is different from the total UTXO of all outputs, an error is returned.
3. In the returned new state NEW_STATE, all input UTXO is removed and all output UTXO is added.
Merkle tree
Merkle tree is a kind of tree structure in data structure, which can be binary tree or multi-tree, which has all the characteristics of tree. Because the Hash operation is performed in the Merkle tree, it is also called the Hash tree. Before you look at the Merkle tree, let's take a look at the Hash algorithm and HashList.
Hash algorithm is an algorithm that can convert data of arbitrary length into fixed-length strings. Is a secure hashing algorithm. The most prominent feature is almost irreversible and conflict-free. The most common application of Hash algorithm is to check the integrity of data. For example, when we download some files, the resource provider will give a value of MD5 or SHA. This value is actually the value of the resource after the Hash operation. After downloading the data, the user can Hash the data and compare it with this value. If the same, it means that the data is not damaged or tampered with in the process of transmission.
Then looking back at the Merkle tree, its underlying layer is the same as HashList, which divides the data into small data blocks and then calculates its hash values separately. But the next layer is different. Instead of merging all the hash values together to do Hash, it splices two adjacent hash values together for Hash operation to produce a new Hash. For example, the hash value 201w of Block1 and the hash value of Block2 0mzc merge Hash to produce a new 3ali hash value. If an isolated hash value occurs after a pairwise match, it is directly used as a Hash, such as Block5. The result is a Root hash value, often referred to as Merkle Root.
Similarly, before downloading, the correct Merkle Root is obtained from the trusted data source, and then the Merkle tree is downloaded from other nodes to identify the authenticity of the Merkle tree through Merkle Root. If a mismatch is found, the Merkle tree continues to be downloaded from other nodes until a Merkle tree that matches the trusted Merkle Root is obtained.
Because the Merkle tree is branched step by step, it can be downloaded and verified from any branch. Consider the branch Root- > d063-> 09yk-> a8b5-> Block3. If the Hash value of this branch is verified, you can download the Block3 data. In HashList, you need to get the entire list of hash values before you can use Root Hash authentication.
In the blockchain system, the lowest leaf node stores transaction data, each middle node is the Hash of its two child nodes, and the root node is also the Hash of its two child nodes, representing the top of the Merkle tree. If an attacker maliciously tampers with the transaction data, or tampers with a part of the Merkle tree, it will inevitably lead to changes in the hash value of the upper node, and eventually lead to the failure of verification.
Now that we understand the structure of the Merkle tree, if we are looking for a transaction, what is the order? First of all, the specific block in which the transaction exists can be confirmed according to the timestamp in the block head. The Merkle Root is also placed in the block. If we start looking down from Merkle Root and assume that there are n transactions at the bottom, then the necessary step to find is log2 (n), which is actually the binary search in the algorithm. Simplified payment Verification (Simplified Payment Verification) is the use of this scheme to achieve a lightweight wallet client, just download the block and branches of related transactions to confirm the transaction. But it also has some disadvantages:
1. It is easy to be denied service by all nodes, so it is necessary to ensure more connections to all nodes, and to ensure that these nodes are trusted.
The transaction requested by the 2.spv client to the full node must be consistent with its key, so that the whole node will see the public key of the corresponding user of the client, resulting in privacy disclosure.
P2P network
In the BT architecture, we found that there is still a "central server", the role of the server is not to provide download services, but to manage the published torrent files. The torrent file is essentially an index file, which contains Tracker information (the location of the server where the resource is published) and file information (file name, size, hash value, etc.), which are encoded according to the B coding rules in the BitTorrent protocol. The Hash information in the torrent file is the result of encrypting the contents of each file to be downloaded. Use the text tool to open the .torrent file and take a look at it (garbled is the SHA1 check code):
At this point, the study on "how to understand the blockchain" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.