Published on: December 12, 2016 by Siju Jacob
In Part 1 of the article, Bitcoin Introduction, we discussed how to send and receive Bitcoins. If you skipped or would like to read it again, you can find it here
Once Bitcoin transaction is propagated on the bitcoin network, it does not become part of the shared ledger (the blockchain) until it is verified and included in a block, in a process called mining.
The bitcoin mining process serves two purposes in bitcoin:
• Mining creates new bitcoins in each block, almost like a central bank printing new money. The amount of bitcoin created per block is fixed and diminishes with time.
• Mining creates trust by ensuring that transactions are only confirmed if enough computational power was devoted to the block that contains them. More blocks mean more computation, which means more trust.
The bitcoin system of trust is based on computation. Transactions are bundled into blocks which require an enormous amount of computation to prove, but only a small amount of computation to verify as proven, in a process called mining. BitCoin mining is intentionally designed to be resource-intensive and difficult so that the number of blocks found each day by miners remains steady.
I know this sounds confusing, but stay here and read the rest of the article with the rough idea which you now have and the working sould be clear for you in the end.
So, a good way to describe mining is like a puzzle that resets every time someone finds a solution and whose difficulty automatically adjusts so that it takes approximately 10 minutes to find a solution. The puzzle used in bitcoin is based on a cryptographic hash is asymmetrically hard to solve, but easy to verify and its difficulty can be adjusted.
Finding such a solution, the so-called Proof-of-Work requires quadrillions of hashing operations per second, across the entire bitcoin network. The algorithm for Proof-of-Work involves repeatedly hashing the header of the block and a random number with the SHA256 cryptographic algorithm, until a solution matching a pre-determined pattern emerges. The first miner to find such a solution wins the round of competition and publishes that block into the blockchain.
Every ten minutes, miners generate a new block, which contains all the transactions since the last block. New transactions are constantly flowing into the network from user wallets and other applications. As these are seen by the bitcoin network nodes, they get added to a temporary pool of unverified transactions maintained by each node. As miners build a new block, they add unverified transactions from this pool to a new block and then attempt to solve a very hard problem (aka Proof-of-Work) to prove the validity of that new block. The process of mining is explained in detail in (to come)
So, taking from where we left the previous article, our dinner guy Harry (who also happens to be a miner),is now sitting before his ASIC computers mining for bitcoins. The setup required for setting up a mining stack is not difficult, but Im not going into its details now. Hopefully I’ll do an article on that later.
So, Harry’s computers are now trying to find the proof of work like thousands of others at the same time. Lets say for the sake of luck, Harry finds the solution now before others on the network. As soon as the solution is found, it validates all transactions within the block and the block is not pushed publically to the network. All nodes now receive the new block and continue to find the Proof of work for the next block (with the new transactions)
Transactions are added to the new block, prioritized by the highest-fee transactions first and a few other criteria. Each miner starts the process of mining a new block of transactions as soon as they receive the previous block from the network, knowing they have lost that previous round of competition. They immediately create a new block, fill it with transactions and the fingerprint of the previous block and start calculating a the Proof-of-Work for the new block. Each miner includes a special transaction in their block, one that pays their own bitcoin address a reward of newly created bitcoins (currently 12.5 BTC per block). If they find a solution that makes that block valid, they win this reward because their successful block is added to the global blockchain and the reward transaction they included becomes spendable.
BitCoin Mining difficulty is a measure of how difficult it is to find a hash below the target value.
The Bitcoin mining network difficulty is the measure of how difficult it is to find a new block. It is recalculated every 2016 blocks to a value such that the previous 2016 blocks would have been generated in exactly two weeks had everyone been mining at this difficulty. This will yield, on average, one block every ten minutes.
As every new block added is based on the previous block added, it added even more computation on top of that block, thereby strengthening the trust in those transactions. One block mined on top of the one containing the transaction, is called one confirmation for that transaction. As the blocks pile on top of each other, it becomes exponentially harder to reverse the transaction, thereby making it more and more trusted by the network.
The blocks mined after the one that contains our transaction act as further assurance, as they pile on more computation in a longer and longer chain. The blocks above count as confirmations. By convention, any block with more than 6 confirmation is considered irrevocable, as it would require an immense amount of computation to invalidate and re-calculate six blocks.
Category : General