Proof of Work — The Bitcoin Mechanism in simple words
Understanding Proof-of-Work (PoW), the original consensus algorithm in a Blockchain network particularly in a Bitcoin Blockchain network.
Bitcoin is a blockchain-based system that is maintained by the collective work of decentralized nodes. Some of these nodes are known as miners and are responsible for adding new blocks into the blockchain.
Bitcoin is the most popular and well-established example of a mineable cryptocurrency.
Countries like China and Russia are in a pole position to launch the first within a couple of years.
Deutsche Bank recently published a report suggesting that cryptocurrencies could overtake national fiat currencies within ten years, envisaging that these state-backed versions will lead the charge.
Also, the Supreme Court recently struck down the curb on cryptocurrency and Bitcoin trade in India.
What makes the mechanism of the Bitcoin protocol different from the Banking system?
Like any other digital payments, there are plenty of user-friendly applications that let us send and receive currencies very easily.
The difference is the backbone underlying their network, this is not a bank verifying transactions, but a clever system of decentralized trustless verification based on some of the math born in cryptography.
Note: Please bear with any simplifications that I make. These algorithms have a lot of complex research behind them. I will be providing links as we proceed for the interested readers to do their further research.
In the blockchain industry, we hear a lot about consensus algorithms, to reach consensus on the network Bitcoin is using proof of work (PoW).
Before continuing, for the non-technical readers:
A hash function is any function that can be used to map data of arbitrary size to data of fixed size.
If a hash function is secure, its output is indistinguishable from random, when you slightly change the input, maybe editing just one character, the resulting hash changes completely and is infeasible to compute in the reverse direction.
Surprisingly if you dig into the details of how this function works, you could reverse engineer the input but no one has ever figured out a way to do that.
Let’s say you have a block-chain and this scenario is bound to happen with you in the present climate of block-chain networks.
You will have multiple nodes and all these nodes will have the same stake of the block-chain.
The general question now arises is that what happens when a new block is encountered. A smart person will reply that you inculcate this block in your block-chain.
Well, who is responsible for adding this block in the already existing and well-functioning system?
And that’s where consensus algorithm comes in play.
A consensus algorithm called “Proof-of-Work” is intrinsically tied to the list of transactions in the blockchain. Currencies such as Bitcoin and Ethereum use this algorithm each one with its differences.
A miner is a node in the network that collects transactions and organizes them into blocks.
What is the proof-of-work for?
The proof-of-work is a mechanism for reaching global consensus on the valid blockchain: since all nodes have a copy of the blockchain, each node must agree on the conditions that prove how much effort a node has spent on verifying transactions.
Every time one has to add a block in a blockchain he has to proof-of-work which will take some amount of time and computing power but the moment some miner is doing that some other nodes or some other blocks will be generated which will be added in the blockchain making his attack useless.
In other words: if the content of the blockchain is easy to change then everyone can tamper with it; instead, if each block is calculated with complex mathematical functions then it takes a lot of effort to tamper with the blockchain.
Bitcoin miners receive bitcoin as a reward for completing “blocks” of verified transactions which are added to the blockchain.
What kind of work does a miner have to do?
For a block to be accepted by the network, miners have to complete a proof of work to verify all transactions in the block.
The difficulty of this work is not always the same, it keeps adjusting so new blocks can be generated every 10 minutes. There’s a very low probability of a successful generation, so it is unpredictable which worker in the network will produce the next block.
A miner has to utilize computational power and solve some varying mathematical calculations by the Brute Force method. So if a person has huge computational power he may be able to solve it
or he may lose it is unpredictable.
So as the number of miners grows in the network, the challenge gets harder and harder so that there is a single miner who wins every 10 minutes. Bitcoin leverages this proof of work scheme within the context of creating that is known as transaction Blockchain.
If someone changes one of the transactions, it would completely change the hash so he’d have to go through another billion guesses to find a new PoW.
If everyone in the chain agrees to give preference to whichever blockchain has the most works put into it, we have a way to arrive at a decentralized consensus that is no central authority.
This System based on proof of work is more or less how the bitcoin protocol works.
Whilst traditional blockchain companies exist on a single consensus mechanism, some innovative ones are adopting multiple consensus protocols.
Opet foundation, for example, is building a unique blockchain to store data collected on its tuition companion chatbot app by applying both Proof-of authority and Proof-of-Work protocols.
Opet Foundation’s blockchain solution ensures privacy on student’s data while incentivizing both educational institutions and students when they contribute to Opet’s platform.
Proof of work is not perfect but it works
- We already know that every blockchain block requires a lot of computing power, so the longest chain has the highest amount of accumulated work invested in it.
- 51% attack: If more than 50% of validators had bad intentions. Someone could put wrong transactions on the block and someone else would have their funds stolen. The community would not believe in the network anymore but this situation is very less likely to occur.
In this article, we discussed Proof of Work, which is currently the consensus algorithms that is practically used in Bitcoin. Proof of work is an inefficient system, and the cost of keeping the network alive is high. There are better solutions, like proof of stake and some other consensus algorithms.
Refer the followings to gain insights:
Proof of Work — The Bitcoin Mechanism in simple words was originally published in Coinmonks on Medium, where people are continuing the conversation by highlighting and responding to this story.