Mining from entry to mastery (3): POW mining logic process

The essence of POW mining is the process of constructing the required blocks and verifying them. This tutorial will explain the logical process of POW mining by introducing the structure of the Bitcoin block and its packaging and verification process.

Block structure

2019-09-19 14:49:20 Bitcoin block from BTC.com

The Bitcoin block is divided into four parts, the block header Blockheader, the block size Size, the block transaction number Tx counter, and the transaction list.

The block header contains six fields, Version, PrevBlock, MerkleRoot, Time, Bits, Nonce.

Block packing process

The specific process is as follows:

  1. Trading is never determined in the trading pool, and usually as many priority transactions as possible are preferred.
  2. Construct a coinbase transaction, calculate the mining fee in the packaged transaction, and send it to the package miner's address along with the coinbase reward (currently 12.5 BTC).
  3. From the package transaction and the coinbase transaction, the block size, the block transaction number and the transaction list in the block structure are obtained.
  4. Perform a hash operation on all transactions (including coinbase transactions) to get MerkleRoot.
  5. Fill in the Nouce yourself, fill in the current environment, Version, PrevBlock, Time, Bits, together with the obtained hashMerkleRoot to form the block header.
The block header and block size, the block transaction number and the transaction list form a bitcoin block.

Packing a bitcoin block, the mining machine can be completed in a flash, but the bitcoin main chain will only allow the block that meets the difficulty requirements to broadcast, then how to verify that the block meets the difficulty requirements?

Block difficulty verification

20190919 Bitcoin Difficulty Source: BTC.com

The verification process is as follows: after the block is successfully packaged, the block header in the block is hashed, and the operation result is compared with the current network difficulty. If the operation result is less than the difficulty of the whole network, the broadcast is successfully performed. However, if the result of the operation is greater than the difficulty of the whole network, you need to reconstruct the block header and loop again.

Due to the irreversible nature of the hash algorithm, miners can only try to change the structure of the block head to meet the difficulty requirements. The greater the computing power, the greater the possibility of meeting the difficulty requirements. This is the POW workload proof mechanism.

The miner needs to constantly change the information of the block header, making SHA256D (BlockHeader) <all network difficulty, then how to change the block header information after the first verification failure?

The data in the block header, Version, PrevBlock, Bits, and Time are fixed at the same time and will not change. The parts that miners can modify are Nonce and MerkleRoot.

Nouce is a four-byte random number, and may take 2^32 values. In the early days of using the CPU and GPU for bitcoin mining, the miner only had to reconstruct the block header by changing the value of Nonce to get the new SHA256D (BlockHeader).

MerkleRoot is a 256-bit hash value that hashes all transactions in the block. Changing the input information of the coinbase and changing the order of the transactions can change the MerkleRoot to change the block header to get the new SHA256D (BlockHeader).

After the emergence of the ASIC mining machine, the 2^32 value that Nonce provided could not control the burst time to 10 minutes. At this stage, the miner reconstructed the block head by modifying the Nonce and MerkleRoot methods.

Pick Sir

"Drilling from entry to mastery" is tailor-made for mining white, and will carry out systematic professional digital currency mining teaching guidance through the three stages of "entry", "real combat" and "advanced".

"Getting started" to master the core mining knowledge / resource library, from now on is not mining white!

"Practical" picks Sir to take you to experience the mining process for free, and active interaction will have the opportunity to qualify for the Sir Mine experience in the "real combat" phase!

"Advanced" masters the core skills of mining inside the mining industry, you can also become a mine!

Next notice:

Mining from entry to proficiency – entry section

How does the mining pool issue tasks to the mining machine?

Pay attention to the "Scientific Mining" public number and get the latest mining assessment information!

We will continue to update Blocking; if you have any questions or suggestions, please contact us!

Share:

Was this article helpful?

93 out of 132 found this helpful

Discover more

Blockchain

Interpretation of wallet data: The exchange holds more than 12.4 billion mainstream currencies, who is the largest Holder?

QUICK TAKE The cryptocurrency exchange currently holds at least $12.4 billion in Bitcoin, Ethereum and USDT (Tether) ...

Blockchain

Hong Kong's HashKey is Leaving its Mark on Retail with a Sleek Trading App, and Brace Yourselves for the Arrival of the HSK Token!

HashKey, the Hong Kong-based cryptocurrency exchange, has officially launched its trading app, marking its venture in...

Blockchain

Long text: the change of the encrypted asset exchange and the risk challenge

Encrypted asset exchanges, like traditional exchanges, are products that develop to a certain period of time. With th...

Market

Three days after listing, trading volume is lackluster. The first-ever leveraged BTC ETF in the US did not have a good start.

First leveraged cryptocurrency ETF in the US underperforms expectations three days after listing.

Blockchain

How does the derivatives market fight on the platform of the 5-year-old exchange?

Derivatives trading has become a battleground for the military, and OKex, Huobi, Gate, Fcoin, which are well-known ex...

Policy

The Shocking Revelation: When Alameda Research Borrowed More Than Just a Cup of Sugar from FTX

Exclusive Leaked Audio from Alameda Research Meeting Exposes Caroline Ellison's Disclosure of Misuse of FTX Deposits ...