Skip to main content

The Mathematical Puzzle - What do Bitcoin Miners Solve


Overview:
Often we hear that miners have to solve a difficult mathematical puzzle to add a new block to existing blockchain. Now the question is - what is this mathematical puzzle and how difficult it is.
Let us understand this in context of Bitcoin mining.

The Mathematical Puzzle:

A Bitcoin block basically consists of block header, a number of recent verified transactions and other details. The block header contains following fields:
FieldPurposeSize (Bytes)
VersionBlock version number4
hashPrevBlock256-bit hash of the previous block header32
hashMerkleRoot256-bit hash based on all of the transactions in the block32
TimeCurrent timestamp as seconds since 1970-01-01T00:00 UTC4
BitsCurrent target in compact format4
Nonce32-bit number (starts at 0)4
Courtesy: https://en.bitcoin.it/wiki/Block_hashing_algorithm
Here the Bits field is a target or threshold value. All one has to do is to find a Nonce for which the hash of the block header is less than or equal to the threshold value.

What is Block Hash:

It is an output of hashcash algorithm which takes a service string,

How to solve:
The miner has to produce a Nonce for which the hash of the block which is basically the hash of the block header is is less than or equal to the target. This is basically a guessing game. There is no way one can deduce the nonce analytically. Every possibility of the nonce has be tried until you get the required hash. This is where you need computational power The more computational power you have the chances of finding a nonce before everyone else is more.

Comments

Popular posts from this blog

What is Merkle Tree - How it is used in Blockchain

Overview: A Merkle Tree is a tree where every leaf node is hash of data block and every non leaf node is a cryptographic hash of its children. Following diagram demonstrate the structure of the Merkle Tree: Above diagram is an example of binary Merkle tree but the data structure is not restricted and it is possible to have n-nary Merkle tree as well. There have been extensive use of this data structure in blockchain technology especially in Bitcoin and Ethereum. How it is used in Bitcoin: Every transaction that happens on Bitcoin network is stored in blocks. These data blocks contain multiple transactions and each transaction is eventually hashed. Every two hashed values are again hashed together and stored in its parent node. The root of the tree also known as Merkle Root stores the hash based on all transaction in block. This merkle root of the block is stored in the block header and used as one of the input parameters to calculate the hash of entire block. Advantage of Mer