BTC
ETH
HTX
SOL
BNB
View Market
简中
繁中
English
日本語
한국어
ภาษาไทย
Tiếng Việt

Popular Science: The Process of Bitcoin Mining

闲话挖矿
特邀专栏作者
2020-07-12 07:55
This article is about 2689 words, reading the full article takes about 4 minutes
The Bitcoin mining popular science album is coming to an end here. Combining the "Bitcoin transaction process" and "Bitcoin new block generation process", after reading these three articles, I believe that readers and friends will hav
AI Summary
Expand
The Bitcoin mining popular science album is coming to an end here. Combining the "Bitcoin transaction process" and "Bitcoin new block generation process", after reading these three articles, I believe that readers and friends will hav

The bitcoin mining popular science album is coming to an end here. After the first two articles have laid the groundwork, I believe that readers and friends have already understoodandandblock generationhave a certain understanding of the process. So what do they have to do with "mining"?

first level title


Miners crack mining tasks

random numberrandom number. Every time it is adjusted, it will be used in accordance with the Bitcoin protocol.SHA256 algorithmCompute the hash of the block header. If the hash value of the block header is greater thantarget hashfirst level title


Mining nodes verify blocks, extending the local blockchain

When the miner finds a random number that can make the hash value of the preparatory block header smaller than the target hash, it will immediately report the mining result to the mining node. After the mining node receives the information, it immediately reorganizes the block according to the information reported by the miners and verifies the block. After the verification is correct, the mining node saves the new block to the node's local database and adds it to the node's local blockchain.

The verification information of the block includes:

  • Whether the block header is legal (block header hash ≤ TargetHash);

  • Whether the MerkleRoot hash of the block header is consistent with the MerkleRoot hash of the transaction data in the block (verify whether the transaction has been tampered with);

  • Whether the first transaction in the transaction data is a Coinbase transaction;

  • first level title


Broadcast new blocks to the whole network

first level title


secondary title

Cluster mining - mining pool:

For Bitcoin mining, theoretically, anyone can build their own Bitcoin mining node, participate in mining, and even manually verify the hash of the block header, crack the mining task, and compete for bookkeeping rights.

But the blogger mentioned in the previous article that according to the current difficulty of mining, even with the current mainstream mining machines, it would theoretically take 42 years to find a new block that meets the requirements of the Bitcoin network. If it is calculated by hand, it will take tens of thousands or even millions of years.

secondary title

Among the mining tasks actually received by the mining machine, the TargetHash is much larger than the TargetHash required by the Bitcoin network:

The process of mine pool and miners mining together also follows the above process. The mining machine communicates with the mining pool through the network to request a mining task. The mining pool sends the mining task (including block header data) to the mining machine. The mining machine changes the random number of the block header and verifies the block hash. Random numbers that meet the TargetHash requirements of the mining task will be submitted to the mining pool in accordance with the format of the mining agreement, and the mining pool will calculate the income from the mining results submitted by the mining machine.

It should be noted that if the TargetHash in the mining task issued to the mining machine is the TargetHash of the Bitcoin network at this time, then the TargetHash is too small, and it is basically impossible for the mining machine to find a random number that meets the requirements and submit the mining result. It is also impossible to obtain mining income.

secondary title

The computing power of the mining pool is different from the local computing power of the mining machine:

When it comes to mining, there is always a noun that cannot be avoided: computing power. What exactly is computing power?

Computing power is actually the speed at which miners verify the hash value of the block header. After the mining machine obtains the mining task, it will increase the random number of the block header according to the information of the mining task. Every time the random number is adjusted, the hash value of the block header will be verified once. It can be seen that the only factor that limits the mining speed of the mining machine is the speed at which it verifies the hash value of the block header, so there is an indicator of "computing power".

At present, the computing power unit of conventional Bitcoin mining machines is TH/s, which means that 1T hashes can be verified per second, 1T=1×103G=1×106M=1×109K=1×1012 times.

Friends who have mining experience will find that there is always a difference between the computing power displayed locally by the mining machine and the computing power displayed by the mining pool. This is because the computing power displayed locally by the mining machine is the speed at which the mining machine verifies the hash. exist. However, the computing power displayed by the mining machine in the mining pool is different. It is calculated by the mining pool based on the actual mining results submitted by the mining machine. If the required random number cannot be submitted to the mining pool, the computing power of the mining machine in the mining pool will be reduced.

But after a long time, the impact of luck on the mining machine's ability to crack the mining task will be reduced, and the average computing power of the mining pool for a long time is not much different from the local computing power of the mining machine.


The above is the basic knowledge of Bitcoin mining. If you can understand these three articles, I believe that readers and friends will have a preliminary understanding of Bitcoin mining. If you want to communicate with bloggers and discuss more mining issues, welcome to pay attention to the WeChat official account of "Gossip Mining", and at the same time, you can learn more about bloggers' updated mining knowledge in a timely manner.

block height

block height: Also called Block Height, which is equivalent to the number of the block, and its value is equal to the number of all blocks before this block in the blockchain. The first block of the blockchain is the genesis block with a block height of 0, the second block has a block height of 1, the third block has a block height of 2, and so on. The total number of blocks in the blockchain is the block height of the latest block + 1.

PoW: The full name is Proof of Work, and the Chinese name is Proof of Work. It is a method used by the Bitcoin network to solve the problem of confirming the rights of new Bitcoin blocks. In the Bitcoin network, everyone can participate in the creation of new blocks. The PoW mechanism stipulates that whoever can find a new block whose hash value is less than the TargetHash specified by the Bitcoin network in the shortest time will own the official block. Accounting rights for new blocks.

bookkeeping rightReferences:

References:

  • proof of work

  • Block Height

  • proof of work

PoW
BTC
矿业