What is a distributed ledger?
The first step to understanding how Bitcoin works is to become familiar with the concept of a “distributed ledger“.
In the previous lesson, I explained how Bitcoin is a new type of recordkeeping system that Satoshi Nakamoto created to be able to move money around on the internet.
Bitcoin is a new kind of system that creates digital money designed to achieve two major goals:
- Prevent the double spending problem
- Achieve the first goal without a centralized financial institution like a bank.
Bitcoin achieves these two goals by using an innovative approach on how it keeps a record of transactions and constantly maintains its accuracy.
What is a ledger?
In order to understand Bitcoin’s approach, let’s review how digital transactions work with a traditional bank.
In order to prevent double spending, a ledger is needed.
The ledger keeps track of account balances.Before Bitcoin, this ledger was always stored by a centralized financial institution like a bank.
Let’s dig a tad bit deeper into WHY a bank is even needed in the first place.
A cool way to explain this is to show an example that attempts to perform a digital transaction without a bank and see how a potential sh*tshow can occur.
Rather than rely on a bank, what if Ursula and Molly keep their own copy of the ledger on their own computers?
This ledger is simply a text file stored on their computer’s hard drive.
When Molly the Mermaid pays Ursula the Unicorn for her magical cupcakes, they both update their digital ledgers (the text file).
If Ursula and Molly both trust each other and promise to keep their ledgers accurate, then this approach could work.
But what if Ursula and Molly do NOT trust each other?
What if Ursula is shady and edits her ledger to show that she never received payment from Molly and tries to ask for another $1?
Imagine Ursula accusing Molly of not paying and showing proof by taking a screenshot of her ledger and sending it to Ned.
Molly rejects her accusation and claims she is lying and shows proof by sending a screenshot of her ledger that clearly shows that $1 was transferred to her.
Whose ledger is correct?!
This will be a never-ending argument. They will never come to an agreement on who is telling the truth.
This is why you need a trusted third party like a bank.
The bank handles the record-keeping of transactions so all parties can agree on who really owns what.
But we don’t want to rely on a bank. We need a different solution.
Here’s an idea…
What if they share the ledger with another friend?
So let’s add Pablo the Polar Bear.
Now we have a network of three friends, instead of just two.
When Molly pays Ursula, everyone’s ledgers get updated at the same time.
In this scenario, if Ursula tries to accuse Molly of not paying, by showing her ledger with a $0 balance, it will be different from Molly’s and Pablo’s ledgers.
Ursula will have a tougher time proving she’s right because Molly can ask Pablo to share his screenshot of the ledger with both of them.
Two out of three ledgers show that Ursula has a $1 balance.
Their ledgers do not agree with her ledger.Seeing that a majority of all ledgers show that Ursula has a $1 balance, Molly and Pablo come to a consensus and agree that their ledgers are the correct ones and Ursula’s ledger is incorrect.
Sensing defeat, Ursula confesses that she tampered with her ledger.
Now everybody is in consensus that Molly really did transfer ownership of her $1 to Ursula, which means that Ursula does indeed have a $1 balance.
In hopes that both Molly and Pablo would still buy cupcakes from her in the future and to win back their trust, she deletes her ledger and asks them for a copy of their version of the ledger so all three ledgers are back in sync.
This is an example of a distributed ledger.
Not just one person holds the ledger, it’s distributed across multiple people in different locations.
(Technically, since the ledger is stored on a computer, it’s distributed across multiple computers which are owned by the people. 🤓)
What is a distributed ledger?
A distributed ledger works because everyone is holding a copy of the SAME ledger. The more trusted people that hold the ledger, the stronger it becomes.
A “distributed ledger” is a ledger that is replicated and stored across multiple locations instead of a single central location.
With a distributed ledger, there is no more need for a bank to keep records. Instead, everyone (collectively) is the bank!
This is the approach that Bitcoin takes.
The core idea behind Bitcoin was to create a single distributed ledger of transactions that is accessible to everyone, where anyone in the world can view balances and submit transactions at any time, but where the ledger is not controlled by any single person, corporation, or government.
In other words, a “distributed ledger” that is “permissionless” and is maintained on a “decentralized” basis.
In reality, this is easier said than done. Let’s see why….
In the example above, because they were all friends, Pablo the Panda held a copy of the ledger, even though he wasn’t part of the transaction.
Without him though, there would be no agreement on the correct ledger. And shady Ursula might attempt more dishonest transactions.But what if they weren’t friends? Why would Pablo make the effort to store a copy of the ledger on his computer and help validate transactions with no benefit for himself?
While keeping track of transactions on a distributed ledger with just three people on a network is pretty manageable, what if there are thousands of people who want to join the network and send each other money?
You can start to imagine the challenge that arises.
Bitcoin’s network is entirely public, and anyone can participate. While a public ledger allows for many more participants. which potentially strengthens the ledger, it also opens itself up to more shady participants trying to corrupt the ledger.
When a lot of people have a copy of the same ledger, it makes it hard to cheat. But it doesn’t mean cheaters still won’t try.
Within those thousands of people, there are probably going to be a bunch of shady Ursulas so you’re going to need a lot of Pablos to ensure an accurate ledger is used by everyone.
What if there were more people like Ursula? What if there were thousands of shady Ursulas editing their ledgers?
Unlike Ursula, Molly, and Pablo who may know and trust each other, with a totally open and public network like Bitcoin’s, you pretty much can NOT trust anybody.
So with a distributed ledger, the challenges are this:
- How do you incentivize other people who aren’t making transactions to hold a copy of the ledger on their computer and constantly check to make sure transactions are accurate and nobody is cheating?
- And if you have copies of the same ledger floating around on a thousand different computers and no one is in charge, how do you make sure all copies are identical, are updated synchronously, and reflect only honest transactions?
In other words, how do you get a bunch of people who don’t know each other, who don’t trust each other to coordinate and come to a consensus on which ledger is accurate and true?
Consensus is defined as a general agreement on the answer to the following question:
“Which version of the ledger does everyone follow?”
With thousands of people all holding their own copy of the ledger, some of which, like Ursula, may have made malicious edits, what is the consensus mechanism needed to get everyone to agree on the “correct ledger” to keep a copy of and follow?
What makes Bitcoin special is how it figured out how to get these thousands of computers to AGREE in real-time which ledger to hold.
Satoshi Nakamoto figured out a technical solution to overcome these challenges of using a distributed ledger and it was considered a game-changer!
In order to understand HOW, we’ll need to look under the hood of Bitcoin. In the next lesson, we’ll start with a high-level overview of the Bitcoin system.