Copyright © 2019-2021 Shenzhen beibeizhu Investment Holding Co.,Ltd. All rights reserved.Site MapPowerd by Designed by
Cryptocurrency mining is the process of validating transactions on the blockchain and creating new coins of cryptocurrency. Miners require a lot of computing resources, which also ensures the security of the blockchain network. Honest and successful miners can earn newly created cryptocurrency and transaction fee rewards.
After a new blockchain transaction is concluded, it will be sent to the mining pool, which we call the mempool. The job of the miners is to verify the validity of these pending transactions and integrate them into blocks. You can think of blocks as pages of a blockchain ledger, where transactions are recorded.
Specifically, mining nodes are responsible for collecting unconfirmed transactions from the mempool and integrating them into candidate blocks. Subsequently, miners attempt to convert this candidate block into a validly confirmed block. But they need to be able to solve complex Maths problems. This requires a lot of computing resources, but miners are issued a block reward for each successfully mined block, including the newly created cryptocurrency and transaction fees. Let's take a closer look at the mining process.
To mine a block, the first step is to operate the pending transactions one by one from the mempool through the hash function and submit them. Every time we submit a piece of data through a hash function, we generate a fixed-length output called a hash. During the mining process, the hash of each transaction consists of a string of numbers and letters used as an identifier. The transaction hash value represents all the information contained in that transaction.
In addition to hashing and singling out each transaction, miners add custom transactions that send block rewards to themselves. This transaction, called a Coinbase transaction, enables the creation of new coins. In most cases, Coinbase transactions are the first to be recorded in a new block, followed by pending transactions that they want to verify.
After each transaction is hashed, the hashes are combined into a structure called a Merkle tree. Merkle tree, also known as hash tree, works by combining transaction hashes into pairs and then hashing them. The new hash outputs are combined into pairs, hashed again, and the whole process is repeated until a single hash is created. The last hash also called the root hash (or Merkle root), basically represents all previous hashes used to generate the root hash.
The block header is used as the identifier of each independent block, representing that each block has its own hash value. When creating a new block, miners combine the hash of the previous block with the root hash of the candidate block to generate a new block hash. In addition to these two elements, they also need to add a random value called nonce.
Therefore, when miners try to validate their candidate block, they need to combine the root hash, previous block hash and nonce and submit it through the hash function. Its goal is to create a hash that is considered valid.
The root hash and the hash of the previous block cannot be changed, so miners need to make multiple changes to the nonce until a valid hash is found.
The output (block hash) must be less than some target value determined by the protocol to be considered valid. In Bitcoin mining, the first few digits of the block hash must be zeros. This is what we call mining difficulty.
As we can see, miners need to repeatedly hash the block header with different nonce values. They keep repeating this work until they find a valid block hash. The miner will propagate his block to the network. All other nodes will check if the block and its hash are valid, and if so, add the new block to the copy of the blockchain.
At this point, the candidate block becomes a confirmed block and all miners move on to the next block. Miners who cannot find a valid hash in time will discard their candidate blocks and continue mining.
Shenzhen Beibeizhu Technology Co., Ltd. (BBZ), founded in 2017, is a leading ADC housing and peripheral supplying company in the field of blockchain. BBZ has two affiliated hosting centers, Wisconsin hosting center and Texas hosting center. Our business mainly focuses on mega data computing services, supercomputing center data box production and blockchain mining hosting services. For more information about cryptocurrency mining, please kindly contact us directly.