Jan 8, 2022
Using computational work as a basis for what to trust
Suppose I give Alice 10 dollars and she later gives 5 dollars to Bob. Historically, we represented such transactions by transferring an object - cash. With the internet, transacting via physical cash became impractical, so we came up with ledgers. Then the problem was who maintains the truth-ness of the ledger? Historically, we trusted the banks, and governments with the ledger. This gave them immense power and control over the flow and creation of money. But now Bitcoin has the craziest answer you could imagine - everyone maintains a copy of the ledger.
Anyone running a node maintains a copy of the ledger since it's dawn, keeping track of Bitcoin's history and incoming transactions. Keeping power over the system in the hands of users.
Every transaction is broadcast out into the world, where nodes add it to their own copy of the ledger.
Problem: How to agree on the right ledger? When nodes receive transactions, how can they be sure that everyone else also received the same transaction.
We need a protocol for how to accept or reject transactions, and in what order, so that you can be sure that anyone else in the world following the same protocol, has the same ledger as you.
If we use computational work as a basis for what to trust, you can make it so that fraudulent transactions are computationally infeasible.
Proof of work is a cryptographic proof in which the prover proves to others that a certain amount of computational effort has been expended.
Suppose that someone shows you a list of transactions, and they say "I found a special number so that when you put this number at the end of the list of transactions, and apply SHA-256 to the entire thing, the first 100 digits of the output are all zeros". How hard do you think it was for them to find that number? It must have been really hard.
But once you know the number, you can quickly verify that this hash really does start with 100 zeros. You can verify that they went through a large amount of work without having to go through that same effort yourself. This number is called a proof of work.
NOTE: The purpose of proof of work algorithms is not proving that certain work was carried out, but deterring manipulation of data by establishing large energy and hardware requirements to be able to do so. [ 51% Attacks ]
For our decentralized ledger, we want a way for everyone to agree on the correct state of the ledger.
The core idea behind the bitcoin is to have everybody trust whichever ledger has the most computational work put into it. So even though there is no central authority, and everyone is maintaining their own copy of the blockchain, if everyone agrees to give preference to whichever blockchain has the most work put into it, we have a way to arrive at decentralized consensus.
If you hear two miners broadcasting distinct blockchains with conflicting transaction histories, you defer to the longest one, i.e, the one with the most work put into it. If there's a tie, wait until you hear an additional block that makes one longer.
Technically it's not the longest chain, it's the chain with the most work invested in it, it usually happens to be the longest chain. Learn about the difference here.
A miner can claim a block reward if they are able to mine a block. Plus, the coins from this block reward can only be spent if the block is in the longest chain. The block reward incentivizes miners to always try and mine new blocks on top of the longest chain.
The usual framework of coins made from digital signatures, provides strong control of ownership, but is incomplete without a way to prevent double-spending. To solve this, Satoshi introduced a p2p network that uses Proof of Work to record a public history of transactions which quickly becomes computationally impractical for an attacker to change if honest nodes control a majority of CPU power.
It allows human who don't know, trust each other who never reveal identities, location etc to transact securely.
Thanks for reading :)More by yashKarthik
All text licensed under the Creative Commons Attribution 4.0 International License (more)