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.
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.
The specific process is as follows:
- Interview RichPaxos Asia CEO Rich Teo: BTC is not really digital gold
- Li Qiang, Secretary of the Shanghai Municipal Committee, investigates Wanxiang Blockchain Company
- Bella Fang: The exchange is at the top of the food chain. How can small and medium-sized projects seize this channel?
- Science | Three Principles of Bitcoin Mining: A Brief History of Cryptography, Hardware Knowledge, and Development
- Ethereum Enterprise Alliance, in conjunction with Microsoft, IBM, etc., launched a general classification of standards to promote cross-platform transactions
- Plunging 20%, breaking the bible of billions of dollars, BTC blood wash night actually has a clue
The block header and block size, the block transaction number and the transaction list form a bitcoin block.
- Trading is never determined in the trading pool, and usually as many priority transactions as possible are preferred.
- 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).
- 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.
- Perform a hash operation on all transactions (including coinbase transactions) to get MerkleRoot.
- Fill in the Nouce yourself, fill in the current environment, Version, PrevBlock, Time, Bits, together with the obtained hashMerkleRoot to form the block header.
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.
"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!
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!