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...

Why can blockchain be tamper proof?

Time : 17/01/2022 Author : dqm4se Click : + -
        As shown in the figure, a block in the blockchain stores a batch of completed transaction information. In order to facilitate processing, the transaction information of the block is organized in the form of Merkle tree, and the hash value of the previous block is stored in the block header of the block. Assuming that transaction 3 on the leaf node is tampered with, the hash value corresponding to transaction 3 will change, and the change will be passed up level by level until the corresponding parent node, which will eventually lead to the change of the root hash of the block, and then the hash of the whole block. Due to the tampering of transaction 3, the hash of the whole block corresponding to transaction 3 will change, which will cause the hash of the previous block recorded on the next block to be out of line, so do you want to consider tampering with the following block? But the blocks behind the blocks should also be tampered with, and there will be endless pockets for children and grandchildren.
 
        In a word: the tampering of transactions requires a whole body. It requires tampering with the whole chain before it can take effect. The difficulty is conceivable (the tamperability of blockchain). If it is necessary to verify whether the block is online, how to verify it? In fact, we only need "hash 2" and "hash 01" to prove it. The verification steps are as follows. Step1: get the hash value of transaction 3, hash 3=hash (transaction 3); Step 2: get the hash value of the parent node through hash 2 and hash 3: hash 23=hash (hash 2 + hash 3); Step3: get the hash value of the root node through the hash values of hash 01 and hash 23: root=hash (hash 01 + hash 23); Step4: compare the root hash value root obtained in the previous step with the Merkel root hash value in the block header. If it is the same, it indicates that transaction 3 exists in the block, otherwise it indicates that it does not exist.
 
        With the passage of time, the chain is getting longer and longer, and the data of blockchain is also growing day by day. The magnitude of data is getting larger and larger, and the requirements for storage are certainly getting higher and higher. In fact, once the latest transaction has been covered by enough blocks, the previous payment transactions can be discarded in order to save disk space. As shown in the above figure, the transaction is hashed into the Merkel tree, and only the root node is included into the hash value of the block. Then the old block can be compressed by cutting off the branches, and the hash inside the branches does not need to be saved, which can save disk space without destroying the hash value of the block (it can be called a perfect design). When learning any technology, don't forget Gu Ge and Du Niang. Search it by typing "merkletree" in Google, and you will see the explanation of Wikipedia.
 
        Hashtree (merkletree) is a tree data structure in cryptography and computer science. Each leaf node is labeled with the hash of the data block, and nodes other than leaf nodes are labeled with the encrypted hash of their child node labels. Hash tree can efficiently and safely verify the content of large data structures, and it is a generalization of hash chain. The concept of hash tree was introduced by riff · Merck applied for a patent in 1979, so it is also called merkletree. 1. Originally, merkletree is also called hashtree (hash tree), because each leaf node of merkletree is labeled with the hash of the data block, and nodes other than leaf nodes are labeled with the encrypted hash of their child node labels, so it is also called hash tree; 2. Merkletree is translated into Merck tree in Wikipedia, and it is translated into Merkel tree in Nakamoto's paper.
 
        In fact, at this stage, there is nothing to call it. 1. The typical application scenario of Merkle tree is point-to-point network download. First, get the top hash of the trusted Merkle tree from friends or website sharing; After getting the top hash, you can download the entire Merkle tree from non trusted sources in the P2P network; After downloading the Merkle tree, you can verify it according to the trusted top hash to verify whether the data is complete and damaged; 2. Merkle tree can be used to quickly compare a large amount of data, because when the roots of two Merkle trees are the same, it means that the data represented must be the same; 3. Blockchain scenario mentioned at the beginning.
 
        Most of the pictures in the article come from the paper of Satoshi Nakamoto, the founder of bitcoin. Satoshi Nakamoto's paper suggests reading it when you have time. After all, it is a subversive work. Ethereum, the representative technology of blockchain 2.0 (not a clone of bitcoin, but a completely independent design and Implementation), is recommended to understand it when you have time. The original plan for today's sharing is to share the tree in my heart from the tree used in the Java source code - the tree used in the bottom layer of MySQL - the tree in the blockchain. But at the end of the year, there are too many things to summarize and plan, and there is not enough time. I hope you can make up for it later.
 
        
Previous:How much upside is there for the market to successfully break through this important pressure zone for the first time? Pay attention to this blockchain concept stock next week
Next:No more

Related articles:



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