DID YOU KNOW?
BLOCK CHAIN PART 2
WHY DOES A MINER MINE THE BLOCK CHAIN?
Let’s get our feet a little more wet this time. So, how and why does a miner mine the blockchain? First, a mining node should have the horsepower to quickly generate a “hash” that meets the “difficulty” level set by the blockchain platform. This means, our everyday use computers may not cut it – at least in a public blockchain. If you do have a powerful computer, you will be competing with many others, potentially hundreds of others, to win the right to add a new transaction to the block.
To do this, you will have to come up with a hash that represents or validates the transactions in the block (this hash gets added to the blockchain to represent that transaction). In addition, this hash has to meet the difficulty target. Essentially, this difficulty target keeps changing dynamically based on the number of active miners – the more number of mining nodes, the greater the difficulty. If this difficulty stays static, the blockchain will get to a point where mining will be faster than the actual transactions coming in and will become a disincentive for mining nodes to participate. To prevent that, blockchain platforms such as Ethereum have a dynamic difficulty target.
So, the first node that succeeds in creating a hash that meets the difficulty target, processes the transaction and adds the block to the chain so all the nodes have a copy of the same. Ok – but what is in it for the miner? Every blockchain platform has a predefined unit for types of operations – this is called “gas”(as in gasoline – i.e. fuel). For instance, the base fee for an ethereum transaction is 500 units of gas. Every transaction comes with a gas limit and a gas price. Translation: the transaction owner needs to declare “for this transaction, I am willing to spend a max abc number of gas units and the price per gas unit is xyz”. The successful miner gets this amount (gas * gas price) in ether currency. If the transaction owner sets the gas limit too low, the transaction never gets processed.
Confused? That’s ok – it took me a while to digest this as well. It helps to simply think of it as – all the mining nodes compete to create a valid representation of every new transaction that comes in and the first miner to do so, gets to process the transaction, propagate it on the network and get paid for it. The power of distributed computing.