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

Analysis: How does the value chain of the blockchain industry work?

Over the past few years, blockchain technology has evolved from a purely technology to a multi-billion dollar industr...

Market

FTX's approval for liquidating $3.4 billion worth of tokens this week, what impact will it have on the market?

FTX may obtain court approval for asset liquidation on September 13th. Under the pressure of 3.4 billion sell-off, th...

Opinion

Web3 Public Legal Education | Why is it best for blockchain startups to not issue tokens?

If traditional internet entrepreneurship is considered a high-risk endeavor, then starting a business in blockchain i...

Blockchain

In those years, the traditional financial sponsorship system practiced on the trading platform

This article is probably: 6900 words Reading needs: about 13 minutes (Deep long text, it is recommended that the coll...

Blockchain

Value capture in the crypto world: who are the supercapturers?

The crypto world is still very early, and the entire industry is still in its infancy. In this case, which tracks are...