What is Proof of Work? A Closer Look
Proof of Work is an ingenious protocol that prevents anyone from simply “copy-pasting” Bitcoin and securing the entire network.
Everyone has heard of Bitcoin, but not everyone is entirely sure about how it works and whether or not to trust its security protocol — namely, Proof of Work. So, perhaps you or someone you know may have asked the following question:
“How can something that is digital and not controlled by any bank or government is secure?”
This is the question that I often hear whenever I talk about cryptocurrencies with my relatives or just anyone who has only ever heard of cryptocurrencies.
By ‘secure’ people can mean various things:
- Is it possible to copy-paste Bitcoins?
- How can we be sure that a transaction is confirmed?
- Is it resistant to manipulation by hackers, since it is a digital product?
This article is about proof-of-work, its importance in the crypto space, why it matters, and more.
What is proof of work?
The proof-of-work is an ingenious protocol that prevents anyone from simply “copy-pasting” Bitcoin, ensures that ALL Bitcoin transactions that have ever occurred are permanent and immutable – and best of all – it makes the Bitcoin network highly infeasible to be hacked.
Since Bitcoin was first circulated in 2009, it has never been hacked. I should be careful to say that while there are many instances where a wallet was hacked, the entire network itself is next to impossible to be manipulated.
Proof-of-work is a solution to a problem. In order to appreciate what proof-of-work actually does to Bitcoin and other cryptocurrencies, you need to know about the problem of digital duplication and many other ways that attackers will try to cheat the system.
More on Bitcoin: Click here to read our comprehensive guide on Bitcoin.
Is it possible to duplicate Bitcoin?
The music, film, and gaming industries struggle to make their products irreplicable. They’ve tried making them unreadable unless a license code is used, but until now no distributor has ever successfully protected them entirely from piracy.
This is because such works are not scarce. Think about it — the distributor can simply copy-paste the product, even if they will later secure the copy with a digital lock.
It is impossible to copy-paste Bitcoin to create more Bitcoins. This is because Bitcoin is not a string of data that can be replicated. It is actually represented by transaction information, and such information dictates the amount of wealth you have in Bitcoin.
Here is an example of a simplified transaction information:
- New wallet created: Antony
- New wallet created: Patrick
- Tio sends 10 BTC to Antony
- Antony sends 5 BTC to Patrick
Based on this ledger, we can be certain that:
- Antony now has 5 BTC (he previously had 0 BTC since he just made his wallet)
- Patrick now has 5 BTC (same case as Antony)
- Tio now has x – 10 BTC
(x represents, however, the amount of Bitcoin that Tio had, provided that it’s not less than 10 BTC)
You can copy-paste the transaction information as many times as you want, but this does not add the number of Bitcoins that I (Antony) have now, nor will the other participants benefit from it.
Notice that we don’t know how much Bitcoin that Tio had prior to his transfer. We need to look further into the ledger’s history to see how Tio got his Bitcoins in the first place. If this piece of information is missing or is modified, then the above ledger is not valid and I don’t actually have Bitcoins.
That being said, there are only two ways in which you can obtain Bitcoin — from mining, or from someone else.
What is double-spending and how can proof of work prevent it?
The Bitcoin network is super busy, and the more people use Bitcoin, the more transaction requests get broadcasted. Transaction requests don’t get processed instantly, and they have to wait in a queue, in a storage called the memory pool.
Transaction requests in the memory pool will remain unconfirmed and it is possible for a transaction to be rejected. When this happens, the transaction fails, and the Bitcoin returns to the owner’s wallet.
Miners choose which transactions they want to process, based on the transaction fees they can earn; the higher the transaction fees, the more favorable a transaction is to the miners, and the faster it can be processed.
If you are a mining node (a computer that is used by miners), your job is to listen to transaction requests all day long. More often than not, you will hear two contradictory transaction requests.
Most of the time, this is a normal phenomenon as a result of the RBF protocol, but occasionally, a purposeful attempt at double-spending can occur.
Let’s go back to the Bitcoin ledger that we saw earlier. An attempt at double spending is about to occur:
- Antony sends 5 BTC to Patrick (he previously had 5 BTC)
- Antony sends 5 BTC to Tio
If Transaction #1 gets confirmed first, the second one will be rejected (since I can’t spend anymore BTC).
But who determines which transaction goes first?
There are perhaps hundreds or even thousands of mining nodes that can do the same things — verify transactions, encode them using cryptography, and publish them into the distributed Bitcoin ledger (also known as the Bitcoin blockchain).
Proof-of-work is a protocol that helps determine which mining node will be selected to confirm transactions for the next block. All it does is to have the mining nodes compete with each other in a special computational race.
This race is won by being the first computer to solve a cryptographic hash puzzle. It takes a computer with significant computational power to solve one, and the more miners join in the race, the more difficult it becomes.
Finally, when a miner becomes the first to solve the puzzle, the miner is able to prove that one has gone through so much more computational work to deserve to command the history of the blockchain — and earn block rewards in Bitcoins (this is how new Bitcoins get circulated).
It is difficult to win in succession; since all mining nodes are more or less equally powerful, most miners just rely on luck, effectively making the puzzle race look more like a lottery than an actual contest of power.
More on Bitcoin mining: What are ASIC miners?
What if two miners win at the same time?
If two miners win at the same time, and that the miners submit their version of the next block, the blockchain splits. The next race begins, and the true potential of proof-of-work is about to be unleashed.
When a blockchain splits, winning miners have to choose which blockchain head to build on. In this scenario, it’s possible to have two winning miners, each building on one of the blockchain heads (if there are two splits).
The longest chain, that is, the chain which has the most computational work put into it, will be deemed to be the official continuation of the blockchain. The other version of the blockchain simply becomes stale and all transactions that were recorded in the failed blockchain returns to the memory pool.
Does the manipulative double-spending transaction go back to the memory pool? No, it is simply disregarded forever.
What is a double-spend attack?
Proof-of-work has served the Bitcoin blockchain faithfully and has prevented contradictory transactions from ever becoming a reality. This means nobody can ever spend the same Bitcoin simultaneously, and that the supply of Bitcoin can never exceed the 21 million cap.
However, this does not mean that people are safe from the double-spend attack:
- Antony sends 5 BTC to Tio to purchase a new but overpriced gaming laptop from him.
2. The transaction (Trx #1) is not yet confirmed.
3. Tio proceeds to ship the laptop to Antony anyway.
4. Antony sends 5 BTC to himself (to another wallet that he owns).
5. This manipulative transaction (Trx #2) is also not yet confirmed.
6. Antony, who is also a miner, abuses his machine to win the proof-of-work hash puzzle and includes Trx #2 into the next block.
7. The other mining nodes pick up Antony’s Trx #1, and discover a contradiction.
8. The blockchain splits in two, Head #1 and Head #2 which contains Trx #1 and Trx #2 respectively (contradicting transactions cannot share the same block),
9. Antony gets lucky again with the proof-of-work hash puzzle, and adds to Head #2.
10. Somehow other mining nodes agree on building up Head #2.
11. Head #1 becomes stale, Trx #1 is never official, and Tio never gets his 5 BTC.
12. Antony receives his overpriced gaming laptop, gets his 5 BTC back, and gets away with the crime.
The double-spend attack can occur under three conditions:
- If the receiver accepts an unconfirmed payment as valid.
- If the receiver accepts a newly confirmed transaction as valid.
- If the malicious miner is really lucky to win more than one proof-of-work hash puzzles in a row.
Of course, this can be easily prevented if the receiver had not rushed to accept an unconfirmed payment. Even if the first two conditions are met, the malicious miner still needs to rely on luck and higher-than-average computational power.
Generally, a good practice is to wait until six confirmations in a row, meaning that five blocks have been mined after the transaction (which takes roughly 1 hour with the highest transaction fee).
This gives the transaction greater strength, as the likelihood of rejection (and thus a double-spend attack) drops down to 0.1%.
Related: What are Bitcoin Network Fees?
What is the future for proof of work?
Although Bitcoin provides a living example of a successful and secure blockchain model, some experts argue that proof-of-work is energy inefficient and that there are alternative protocols that can offer the same level of security as proof-of-work without the exceedingly high electricity bills.
Cardano for example is implementing a protocol known as proof of stake, that allows it to execute and validate transactions on its blockchain in a much more efficient manner, while also reducing the computing power needed.
Now that you’ve got a general idea of the significance of proof of work, I highly recommend you dive deeper into its broader application in the crypto space.
Also, don’t forget to subscribe to our monthly newsletter to have the latest crypto insights, news, and updates delivered to our inbox.
Disclaimer: This is general information only and is not intended to be advice. Crypto is volatile, carries risk and the value can go up and down. Past performance is not an indicator of future returns. Please do your own research.
Last updated December 6, 2021