Blockchain Academy
We'll get together for networking with people interested in Blockchain including developers and anyone curious about Blockchain.

Mining

Mining in a blockchain using the PoW (proof of work) algorithm is a term for acquiring a coin in return for generating a block. The block chain adopting PoW consensus such as ethereum, bitcoin, etc., gives a block generation right to the miner who finds the fastest answer through complicated calculation, and pays a certain amount of coin in return for finding the answer.

The mining of PoW is performed as follows.

  1. Minor sorts the transactions in the order of the highest commission to create the next block and puts the transaction in the block.
  2. To register the new block, hash value of the previous block header, root hash of transaction, nonce are hashed, and the hash is repeated by randomly changing the nonce until the value is less than or equal to the target threshold (Target Threshold).
  3. When a nonce that derives a hash value lower than the target value is found, the calculated nonce value is stored in the corresponding block and the block is propagated to the surrounding nodes.

Mining at Ethash, the consensus engine of Ethereum, is as follows. Hash the previous block header and Nonce value to create the first Mixhash, and use this Mixhash to extract the first page from the DAG. Create a Mixhash from the first DAG page and the first Mixhash extracted using the Mixer function of Ethereum. Repeat this process 64 times to create the 64th Mixhash. This value is used to construct a 32-byte Mixdigest. If this value is less than or equal to the target value, it is regarded as a successful block generation and propagated to neighboring nodes. If it is large, repeat this process by changing the nonce.



The hash value of the block to be mined is different for each miner, and It is not always the case that a miner with good computing power always succeeds in mining first. The hash of the block will be affected by several components, such as the timestamp, the miner address, and so on. Since it is probabilistic to succeed in mining, the faster the hash calculation, the higher the probability of mining, but it does not always succeed in mining.