Introduction to blockchain | Miners traverse all random numbers and still cannot get the correct answer. Is it because the love oath is wrong?

Introduction to blockchain | Miners traverse all random numbers and still cannot get the correct answer. Is it because the love oath is wrong?
In the article "Why are some blocks not packaged with transactions? Did the miners forget?", a reader left a message asking:

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 numbers

In 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 numbers

The 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 miners

If 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!

>>:  A 63-year-old woman traveled thousands of miles to sell the IPFS mining machine game that was broken

Recommend

Is it good for a woman to have thick palms?

Many people would ask whether a woman is more ble...

Is it true that a woman with a big face will bring good luck to her husband?

Physiognomy is a traditional Chinese physiognomy....

Bull vs. Bear: Bitcoin’s Peak Moment

Since the black swan event on March 12, Bitcoin h...

What does the mole on a man's wife mean?

The position of moles is closely related to a per...

Analyst: Bitcoin ETF may be approved or make Bitcoin hit a new high

On October 15, market analyst Mark Cranfield said...

How does a man's sword-shaped eyebrows look like?

People with sword-like eyebrows are usually heroi...

What are the most complete and rare palmistry?

In the theory of fortune-telling, palmistry is an ...

What are the explosion points of Filecoin in the future?

The FIL mainnet has been online for some time, bu...

Are men with widow's peaks destined to be rich? Their love luck is very smooth.

Analyzing the face does correspond to some states...

Physiognomy teaches you how to know and change your fate

Physiognomy teaches you how to know and change yo...

The length of your fingers tells you your destiny

The length of your fingers tells you your destiny...

Mole Physiognomy: What does black moles on the face mean?

Mole Physiognomy: What does black moles on the fa...