This question can be summarized as follows: Assume that the latest block height is 10,000 and it was mined at 10:00. The miner quickly built a block with a block height of 10,000 and 1. Then at 10:05, Dabai published a transaction. At 10:06, the latest block was mined and packaged with Dabai's transaction. Why is this? In theory, when this new transaction was published, the miner had already built a candidate block, and this transaction was definitely not in the candidate block he originally built. Let’s try to answer this question today. 01 Mining is to continuously try random numbersIn the article "A Classic Story to Help You Understand Bitcoin Mining in 3 Minutes", Plain Language Blockchain introduced that the mining process is the process of constantly trying random numbers to try to find a solution that meets the requirements. After the miners build a block, they continue to try random numbers until someone finds a random number that meets the requirements (the hash value of the block header ≤ the target value), the new block is mined, and the miner receives a block reward. 02Limited random numbersThe number of random numbers that can be tried in the Bitcoin system is limited, with only 2^32 possible values. After the miner builds the block, it is very likely that it still does not get a solution that meets the requirements after traversing all the random numbers. In this case, what should the miner do? The characteristic of the hash function is that if the input value changes even a little bit: it can be a change in order, increase in content, decrease in content, etc., the output value will change drastically. So in this case, the miner can rebuild the block, for example, keep other contents unchanged, pack a newly released transaction into the block, and then try the random number again. In this case, if a solution that meets the requirements is found, a new block will be mined, and the newly released transaction will be confirmed. This also answers the question we started with. 03Other adjustment methods for minersIf no satisfactory solution is found after traversing all random numbers, what other adjustment options do miners have besides adjusting the transactions packaged in the block? We know that the condition for mining a new block is: the hash value of the block header ≤ the difficulty target. The block header content includes: Apart from the random number field, the version field, parent block header hash value, and difficulty target in the block header are fixed and cannot be adjusted, and the timestamp field has a very limited adjustable range. In this way, the only part that is easy to adjust is the Merkle root field. The block header does not contain the transaction data of the block, but takes the hash value of these transaction information, and then merges the hash values of the transactions in pairs and takes the hash value again until a field is formed. This field is the Merkle root field, which will be stored in the block header. ▲Picture from the Internet: Merkle Tree Therefore, when no suitable solution is found after traversing all random numbers, miners can adjust the transactions in the block: including the order of transactions, increasing or decreasing the number of transactions packaged, etc. These adjustments will eventually cause the Merkle tree root hash value in the block header to change, thus affecting the hash value of the entire block header. However, such processing is only an auxiliary method. The more common method for miners is to modify the extra random number (Extra Nonce) of a special transaction, which is relatively more efficient. This special transaction is the coin creation transaction for Bitcoin block rewards. This transaction is "created out of thin air" by the system, so this transaction has no input, that is, its input field is empty by default. Miners can modify this field in order to find a solution that meets the requirements. The coin creation transaction input field provides 8 bytes of space for additional random numbers. In other words, this expands the random number possibilities from the original 2^32 to 2^96 possibilities. Miners can generally find a solution that meets the requirements by traversing 2^96 possibilities. It is also worth mentioning that the input field of this special transaction is also the "window" for many people's information to be uploaded to the chain. For example, Shenyu's "Hold your hand and grow old with you. Shenyu to Dongdong" is written in the input field of the coin creation transaction. If you are a miner and want to "show your affection" in the Genesis transaction input field, should you write the "show your affection" message before the block is mined, or after the block is mined? Why? Please leave your opinion in the comment area. ——End—— Author | Produced by Yan Wenchun | Vernacular Blockchain (ID: hellobtc) " statement : This series of content is only for blockchain science popularization and does not constitute any investment advice or suggestions. If there are any errors or omissions, please leave a message to point them out. 』 |
<<: CAL coin - is a new Monero fork, the latest V8 algorithm, both graphics cards and CPUs can mine!
Characteristics of the Jishi nose <br />The...
For some people, they actually need to consider t...
Rage Review : MIT released a new report exploring...
Every man hopes to achieve something, to be a man...
Bitcoin House News , November 12 , CoinDesk repor...
Many people must be very concerned about their ca...
Bloq CEO and co-founder Jeff Garzik has been elec...
What does it mean to have no fate line? Many peop...
Litecoin founder Charlie Lee has officially annou...
Some people have a happy life, good fortune, weal...
Girls' kindness and innocence can easily attr...
Compilation | Satuoxi Litecoin’s second block rew...
According to Bitcoinist, Apple has explicitly ask...
Rage Comment : The Ethereum blockchain version cl...
Original title: Popular Science "Blockchain&...