Blog

Bitcoin Mining

by Prajyot Patle


Posted on July 13, 2018 at 7:00 PM


Bitcoin Mining

Who is a miner?

A miner, also known as a node, is nothing but a computer in the Bitcoin network. It plays a critical role in the security and functioning of the Bitcoin system. Each miner has a ledger, which contains the list of all the Bitcoin transactions done since the beginning. This ledger is nothing but the blockchain, briefly speaking the blockchain is a number of blocks linked with each other, so that it forms a chain. Any transactions that happen over the Bitcoin network are added (recorded) in the blockchain.

What does a miner do?

  • A miner always keeps listening to any new transactions that happen in the network. Once a new transaction is made, the miner verifies the transaction, i.e. it checks if the transaction was actually made by the person mentioned as the payee, and not by any hacker who has just broadcasted a fake transaction. The miner does this with the help of cryptography. To make Bitcoin transactions, one needs a Bitcoin wallet. A wallet has a private key, which is like a password, which is used to make a new transaction, which as the name suggests is private to the person. The wallet also has a public key, which is like his account number, which he can share with others to receive Bitcoins as well as to let the miners verify the transactions. So when a person A makes a transaction of 10 Bitcoins to person B, he signs that transaction with his private key and broadcasts to all the miners. The miner, once it gets the transaction message, sees that the transaction was made by A, gets the public key of A, verifies if the transaction was really made by A, or by some other fraudulent person. If the transactions is verified, the transaction is eligible to be added to the blockchain.

  • The miner takes all the new transactions, which are successfully verified and adds them to a new block. A block is nothing but a bundle of transactions.

  • This block is added to the blockchain once the miner solves a complex mathematical problem. This mathematical problem is known as the Proof-of-Work problem. As the name suggests, a Proof-of-Work is a proof that the miner has done some work. We’ll soon see how this works.

  • When the Proof-of-Work problem is solved by a miner, it is known as mining a block. After successful mining of a block, the block is added to the blockchain. This Proof-of-Work solution along with the new block, is sent to all the miners in the bitcoin network. They all verify if the solution is correct, and also verify if all the transactions in the new block are valid. Once verified they add the new block to their respective blockchains. This works as a consensus for adding new blocks in the blockchain. i.e. if a miner broadcasts an incorrect Proof-of-Work solution in the network, other miners verify the solution, and once found to be incorrect, they just reject the solution and does not add the new block to the blockchain. The block is added to the blockchain only after the Proof-of-Work solution is correct and the transactions are verified.

Why mining?

  • As explained above, mining is a great solution to reach a secure and tamper resistant consensus. It makes sure that no fraudulent transactions are made in the network, and only verified transactions are added to the blockchain.

  • So far we’ve only talked about sending Bitcoin from one person to the other. But where do these Bitcoins come from in the first place? The answer is mining. With the help of mining, new Bitcoins are slowly and securely introduced in the system. When a miner successfully mines a new block i.e. when it solves the Proof-of-Work problem, a reward is generated in the name of the miner. The reward is nothing but new Bitcoins. Currently the reward is set at 12.5 Bitcoins for each new block. It halves every 210,000 blocks. The Bitcoin system is designed in such a way that a new block will be generated after every 10 minutes.

  • A miner can also be benefited by transaction fees. The payee of a transaction can assign some amount of Bitcoins to the miner as a transaction fee. Once the miner successfully mines a block, he gets the transaction fees of all the transactions in the new block.

  • Thus, mining serves the purpose of introducing new Bitcoins in a decentralized manner. It also motivates people to provide security for the Bitcoin system through mining.

In the next blog we’ll see:

  • What does blockchain look like and what does a block contain?

  • What exactly is a Proof-of-Work? And how does Proof-of-Work and Mining Difficulty together help to secure the blockchain, and make it tamper resistant?

  • How can you start mining Bitcoins?