is the process through which cryptocurrency
transactions are gathered, verified and recorded into a digital ledger known as blockchain
. The work done by miners is essential for maintaining the integrity of the network and is also responsible for introducing new coins into the system.
Within the traditional banking system, fiat currency
is printed and distributed by financial institutions and governmental authorities - but for most cryptocurrencies, the issuance of new coins is not in the hands of centralized entities. Instead, new cryptocurrency units are generated through the process of mining, which follows a predefined set of rules established by the underlying protocol. While the protocol defines what the primary rules are, the so-called consensus algorithms
outline how these rules will be followed (for instance, during the validation of transactions).
Taking Bitcoin as an example, the participants involved in the process of mining are called mining nodes
(or just miners), and they play a key role in the security of the blockchain network. The job of a miner is to gather unconfirmed transactions from the memory pool and organize them into a candidate block
that they will try to validate.
When creating a candidate block, a miner includes a transaction where they send the block reward
to themselves. This transaction is known as a coinbase transaction and is often the first to be recorded in a block.
After the list of unconfirmed transactions is formed, each transaction is hashed, and their outputs are organized into pairs. These pairs are then hashed, producing new outputs that are also organized into pairs and hashed once again. The process is repeated until a single hash is produced, which is referred to as the root hash or Merkle tree
The root hash is then combined with the hash of the previously confirmed block, along with a pseudo-random number called nonce
(plus some other parameters). These elements are then hashed, producing the block hash for that candidate block.
However, the miner will only be successful if the resulting output (block hash) for their candidate block is below a predetermined value (target). Consequently, the process is based on trial and error and they need to perform numerous hashing functions with different nonces in order to find a valid result. The first miner to find a valid hash validates their candidate block and get the block reward. The whole process takes ten minutes, on average.
Once a block gets validated, it is added to the blockchain and miners start to work on the next block. The valid hash produced by miners functions as the proof for their work and this is why the Bitcoin consensus algorithm is called Proof of Work
. Each confirmed block has a unique block hash that acts as an identifier.
The block reward
is defined by the Bitcoin protocol and decreases every 210,000 blocks (around four years). Initially, the block reward was 50 BTC and is now 6.25 BTC.