Merkletree bitcoin
Publish: 2021-05-05 13:44:35
1. blockchain is a technology, but it is not a single technology, but the result of the integration of a variety of technologies, including cryptography, mathematics, economics, network science and so on. You can think of it as a distributed shared accounting technology, or as a database, but the database is jointly maintained by all nodes in the chain, and each node has an account book. Because the account books of all nodes are consistent, different nodes can trust each other, and there is no doubt about the data, so we all say that the blockchain has realized trust technically. For detailed professional technology, you can consult some professional technology companies, such as Jinbo technology, which focuses on the development of blockchain related procts, professional R & D team and perfect after-sales service, and you can consult by telephone.
2. bitcoin was born in a paper in 2008
a person signed by Nakamoto Tsui has put forward a revolutionary idea: let's create a currency that is not controlled by the government or anyone else! This idea is crazy: there is no asset support behind a string of figures, and no one is responsible for it. How can anyone accept it when you pay it to the other party as money
Merkle tree
looks like a binary tree, but this is the lower two nodes. Take the hash value to get the upper node. Just remember the root node to detect whether the whole tree has been tampered
the root hash value is stored in the block header, and the transaction process is stored in the block body. All nodes include block header and block body, but light nodes (such as bitcoin wallets on mobile phones) only include block header. This tree can prove that a transaction has been written into the blockchain
3. Consensus agreement
two issues should be paid attention to in decentralized currency:
1. Who can issue digital currency: mining
2. How to verify the legitimacy of transactions: blockchain
double spending attack
double spending attack is a major challenge of digital currency
all transactions in bitcoin have input and output. Where does bitcoin come from and where does it go
under normal circumstances, there may be two bifurcations, because two nodes obtain the bookkeeping right at the same time, and the two nodes package the block and calculate the random number at the same time. At this time, the two bifurcations will coexist temporarily until one of the blocks finds the next block first, which becomes the longest legal chain, and the other one is discarded<
Sybil attack
a malicious node keeps generating accounts. If the total number of accounts exceeds half of the total accounts, it obtains the control of the blockchain
consensus protocol in bitcoin
some nodes are malicious, and most nodes are good
idea 1: pack some transactions into blocks as candidate blocks, let each block vote, and write them into the blockchain if they pass
No, because some malicious nodes have been publishing blocks containing malicious transactions, and they have been voting and occupying resources. And some nodes don't vote<
idea 2: vote not by the number of accounts, but by computing power. Each node can generate legal transactions and put them into the block. These nodes start to try random numbers until H (block header) ≤ target is found, then this node has the right to account
the only way to generate bitcoin
coinbase transaction. There is no need to point out the source of the currency. If you have the bookkeeping right, you will get a reward< br />
50BTC-> 25BTC-> 12.5btc, the reward will be halved for every 210000 bitcoins
the process of bitcoin competing for bookkeeping rights is called mining. The node competing for bookkeeping right is called miner.
a person signed by Nakamoto Tsui has put forward a revolutionary idea: let's create a currency that is not controlled by the government or anyone else! This idea is crazy: there is no asset support behind a string of figures, and no one is responsible for it. How can anyone accept it when you pay it to the other party as money
Merkle tree
looks like a binary tree, but this is the lower two nodes. Take the hash value to get the upper node. Just remember the root node to detect whether the whole tree has been tampered
the root hash value is stored in the block header, and the transaction process is stored in the block body. All nodes include block header and block body, but light nodes (such as bitcoin wallets on mobile phones) only include block header. This tree can prove that a transaction has been written into the blockchain
3. Consensus agreement
two issues should be paid attention to in decentralized currency:
1. Who can issue digital currency: mining
2. How to verify the legitimacy of transactions: blockchain
double spending attack
double spending attack is a major challenge of digital currency
all transactions in bitcoin have input and output. Where does bitcoin come from and where does it go
under normal circumstances, there may be two bifurcations, because two nodes obtain the bookkeeping right at the same time, and the two nodes package the block and calculate the random number at the same time. At this time, the two bifurcations will coexist temporarily until one of the blocks finds the next block first, which becomes the longest legal chain, and the other one is discarded<
Sybil attack
a malicious node keeps generating accounts. If the total number of accounts exceeds half of the total accounts, it obtains the control of the blockchain
consensus protocol in bitcoin
some nodes are malicious, and most nodes are good
idea 1: pack some transactions into blocks as candidate blocks, let each block vote, and write them into the blockchain if they pass
No, because some malicious nodes have been publishing blocks containing malicious transactions, and they have been voting and occupying resources. And some nodes don't vote<
idea 2: vote not by the number of accounts, but by computing power. Each node can generate legal transactions and put them into the block. These nodes start to try random numbers until H (block header) ≤ target is found, then this node has the right to account
the only way to generate bitcoin
coinbase transaction. There is no need to point out the source of the currency. If you have the bookkeeping right, you will get a reward< br />
50BTC-> 25BTC-> 12.5btc, the reward will be halved for every 210000 bitcoins
the process of bitcoin competing for bookkeeping rights is called mining. The node competing for bookkeeping right is called miner.
3. The subversive characteristics of blockchain lie in the following four aspects: first, transparency. The data record of the blockchain system is transparent to the nodes of the whole network, and the update operation of the data record is also transparent to the nodes of the whole network, which is the basis of the trustworthiness of the blockchain system. Because the blockchain system uses open source programs, open rules and high participation, the data records and operation rules of the blockchain can be reviewed and traced by the nodes of the whole network, with high transparency< Second, openness. The blockchain system is open. In addition to the fact that the private information of the parties directly related to the data is always encrypted, the data of the blockchain is open to all (except the blockchain system with special permission requirements). Anyone or participating nodes can query blockchain data records or develop related applications through the open interface, so the information of the whole system is highly transparent< Third, information can not be tampered with. Once the information of the blockchain system is verified and added to the blockchain, it will be permanently stored and cannot be changed (except for private blockchain systems with special change requirements). Unless more than 51% of the nodes in the system can be controlled at the same time, the modification of the database on a single node is invalid, so the data stability and reliability of the blockchain are extremely high
Fourth, decentralization. Decentralization is the most basic feature of the blockchain, which means that the blockchain no longer depends on the central processing node and realizes the distributed recording, storage and updating of data. In the traditional centralized network, attacking a central node can destroy the whole system, while in a decentralized blockchain network, attacking a single node cannot control or destroy the whole network. More than 5% of the nodes in the master network are just the beginning of gaining control. 2019 is the first year for the commercial application of blockchain technology, and the stimulation of favorable policies will make the development of blockchain technology more stable
with the application of blockchain technology graally penetrating into many fields such as digital finance and Internet, we have a clearer understanding of the value of blockchain
blockchain has formed a situation of global competition, and all countries are seizing the development opportunities, let alone China; Therefore, there is no doubt that blockchain has become a national strategy.
Fourth, decentralization. Decentralization is the most basic feature of the blockchain, which means that the blockchain no longer depends on the central processing node and realizes the distributed recording, storage and updating of data. In the traditional centralized network, attacking a central node can destroy the whole system, while in a decentralized blockchain network, attacking a single node cannot control or destroy the whole network. More than 5% of the nodes in the master network are just the beginning of gaining control. 2019 is the first year for the commercial application of blockchain technology, and the stimulation of favorable policies will make the development of blockchain technology more stable
with the application of blockchain technology graally penetrating into many fields such as digital finance and Internet, we have a clearer understanding of the value of blockchain
blockchain has formed a situation of global competition, and all countries are seizing the development opportunities, let alone China; Therefore, there is no doubt that blockchain has become a national strategy.
4.
In today's era of high development of the Internet, we are using the Internet more and more frequently, which has become an indispensable and important tool in our life. In particular, the mobile phone used for Internet communication has been used as a medium. In today's era, we are using mobile payment more and more, There are more and more ways to move. So what is digital currency? What do you know about it{ But generally speaking, it is a form of money< p> Finally, for such a form of transaction, it's all for the convenience of our daily life, and it's also for serving our own broad masses of people, so we don't have to worry about the advantages and disadvantages of digital currency and mobile payment
5. Proof of work (POW) is a proof to confirm that you have done a certain amount of work. The whole process of monitoring work is usually extremely inefficient, and it is a very efficient way to prove that the corresponding workload has been completed through the certification of the work results. For example, in real life, graation certificate, driver's license and so on, are also obtained through the way of test results (through the relevant examination)
proof of equity mechanism
POW is a way to reach a consensus, but it is not the only way. There are other ways for each node to reach a consensus, such as POS
POS is different from POW in that mining on POS system is based on the amount of money held. In other words, in the case of POS, the effect of a person owning 5% of the virtual currency is the same as that of a person owning 5% of the computing power on bitcoin system
the basic principle of workload proof the main feature of workload proof system is that the client needs to do some difficult work to get a result, but the verifier can easily check whether the client has done the corresponding work through the result. A key feature of this scheme is asymmetry: the work is moderate for the requester and easy for the verifier. Different from captcha, captcha is designed to be easily solved by human but not by computer. The following figure shows the process of workload proof:
for example, given a basic string & quot; Hello, world!& quot;, Our workload requirement is that an integer value called nonce can be added after the string to perform sha256 hash operation on the changed (nonce added) string. If the hash result (expressed in hexadecimal) is & quot; 0000" At the beginning, the verification is passed. In order to achieve this goal. We need to continuously increase the nonce value to perform sha256 hash operation on the new string. According to this rule, we need to go through 4251 calculations to find the hash with exactly the first four bits of 0
. In the process of workload proof, we can roughly summarize the steps of bitcoin miners to solve this puzzle of workload proof as follows: generate coinbase transaction, and form a transaction list with all other transactions that are ready to be packaged into blocks, generate Merkle root hash through Merkle tree algorithm, and assemble Merkle root hash and other related fields into blocks, The 80 byte block header of the block header is used as the input of workload proof, and the random number in the block header, that is, the value of nonce, is constantly changed, and the block header after each change is double sha256 operation (that is sha256 (sha256 (block)_ If it is less than the target value, the problem is solved successfully and the workload is proved to be completed. The process can be shown in the following figure:
the workload proof of bitcoin is the main work we commonly call "mining". Understanding the workload proof mechanism will lay a foundation for us to further understand the consensus mechanism of bitcoin blockchain.
proof of equity mechanism
POW is a way to reach a consensus, but it is not the only way. There are other ways for each node to reach a consensus, such as POS
POS is different from POW in that mining on POS system is based on the amount of money held. In other words, in the case of POS, the effect of a person owning 5% of the virtual currency is the same as that of a person owning 5% of the computing power on bitcoin system
the basic principle of workload proof the main feature of workload proof system is that the client needs to do some difficult work to get a result, but the verifier can easily check whether the client has done the corresponding work through the result. A key feature of this scheme is asymmetry: the work is moderate for the requester and easy for the verifier. Different from captcha, captcha is designed to be easily solved by human but not by computer. The following figure shows the process of workload proof:
for example, given a basic string & quot; Hello, world!& quot;, Our workload requirement is that an integer value called nonce can be added after the string to perform sha256 hash operation on the changed (nonce added) string. If the hash result (expressed in hexadecimal) is & quot; 0000" At the beginning, the verification is passed. In order to achieve this goal. We need to continuously increase the nonce value to perform sha256 hash operation on the new string. According to this rule, we need to go through 4251 calculations to find the hash with exactly the first four bits of 0
. In the process of workload proof, we can roughly summarize the steps of bitcoin miners to solve this puzzle of workload proof as follows: generate coinbase transaction, and form a transaction list with all other transactions that are ready to be packaged into blocks, generate Merkle root hash through Merkle tree algorithm, and assemble Merkle root hash and other related fields into blocks, The 80 byte block header of the block header is used as the input of workload proof, and the random number in the block header, that is, the value of nonce, is constantly changed, and the block header after each change is double sha256 operation (that is sha256 (sha256 (block)_ If it is less than the target value, the problem is solved successfully and the workload is proved to be completed. The process can be shown in the following figure:
the workload proof of bitcoin is the main work we commonly call "mining". Understanding the workload proof mechanism will lay a foundation for us to further understand the consensus mechanism of bitcoin blockchain.
6. A way to package data so that you can effectively store and validate it later. Merkletrees allows transactions to be packaged into blocks, making it tamper resistant, and can be easily verified by any node (especially light nodes). The merkelgan of maintains a compact representation of the data.
Hot content
