How do I know which version of the list is correct?

You might be thinking that this bitcoin list sounds pretty chaotic.

People are constantly editing the list and then sending around their new copies. How could there possibly be a unified version? Especially if we aren’t sure we can trust everyone on the list?

nodesend.png

When every participant is trustworthy, it’s fairly straightforward. Alice will make her edit, send her copy around, and everyone knows the updated balances.

But what if Alice isn’t trustworthy?

nodesenddoub.png

In the scenario above, you can see how Alice is trying to cheat Erin and Bob.

  • In copy #1, Alice is trying to pay Bob by subtracting $3 from herself and adding $3 to Bob.

  • In copy #2, Alice is trying to pay Erin by subtracting $3 from herself and adding $3 to Erin.

The problem is Alice just “spent” $6… when she only has $5!

Since anyone is allowed to edit the list and send their copy around, this seems like a very easy way to spend more money than you have.

The solution? Order the transactions in time.

Technical terms like mining and blockchain are responsible for solving this problem of “double-spending”. We’ll save the details surrounding these for another lesson, but below is the general idea.

All we need to do is decide which of Alice’s copies we’re going to count as the “first”. We’ll consider that one the only valid transaction. Seem’s easy enough. Just look at what time she sent each copy, right?

That could work, but Alice is too clever to let that stop her from cheating the system. She can just send conflicting copies at the exact same time.. then how do we decide which one was first?

In this case, we need someone to decide for us.

bankvp2p.png

In our traditional banking system, the bank keeps track of all transactions. If you only have $5 and try to spend more, the bank will just block your transaction. But bitcoin removes this middleman.. so how do we resolve conflicts between our group of five different individuals?

Bitcoin takes the power from the middleman and gives it to its users. It does this by randomizing who gets to choose the valid version of the list at a point in time. Let’s demonstrate.

minenonceguess.png

Every few minutes.. people with the bitcoin list will be asked to play a number guessing game. Whoever guesses the correct number wins the game, and gets to submit their version of the list as the valid one! This number is so hard to guess, that it effectively randomizes who is in control at any given moment.

minenonceguessright.png

Look at that, Dave guessed the right number! Now Dave’s copy of the list will become the valid version and everyone can continue transacting using that copy.

nodesenddoubcorrect.png

Alice’s other copies are now considered invalid. Everyone will check with Dave to see what the actual list should look like.

daveblockfind.png

Since Dave’s copy includes the $3 that Alice sent Erin and not Bob, Erin’s updated balance will be the one that is saved. Because of this, you want to make sure someone has already saved the list before you consider any money that was sent to you as final.

Look at that! We just got five random people to agree on what the list should look like, without any central authority.

This random and constantly changing leadership allows a large group of strangers to always have the correct version of the list.