Bitcoin Explained Through Examples

Many people have attempted to explain bitcoin, I will try in my own way here, using a simple example to explain the fundamentals of bitcoin.

Imagine a town on Mars.

In this town no-one trusts anyone and  therefore everyone’s possessions are listed next to their name in a records book at the town hall. If someone reports a crime everyone’s house is searched and checked against their possessions recorded in the town hall (bear with it…).

Say Bob wants to buy a Martian Pear from Alice in exchange for a Martian Apple.

Rather than just do the swap they need to make sure they aren’t going to get caught out if the other claims ‘THIEF’.

So Bob and Alice both inform the Town Hall that the trade has taken place. The town hall then make the change in the records book (Alice: +1 Apple -1 Pear  &  Bob: -1 Apple +1 Pear). This is a good system, as if anyone wants to trade they just agree the trade and inform the town hall who make the change in the records book. If anyone wants to check this they just go to the town hall and can see what is listed by their name, and check that everything is in order.

This is similar to the system that is common now on earth across most of Earth, only instead of a single records book at the town hall there are banks and they keep track of your money for you (not Apples).

A bank can accept a $50 (USD) note and put it in their vault and then add $50 to your online ‘balance’.
If you want to transfer that $50 to someone else at the same bank then you just inform them (by making a bank transfer) and they deduct $50 from your balance and add $50 to their balance (Alice: +$50, Bob: -$50).

This seems like a great system, however this bank has costs, like a physical bank, and a vault, and guards for the vault, and accountants to keep track of the balances and so on.
This means that there are fees for using the bank services. (Alice: +$49, Bob: -$50, Bank: +$1)

However, the fees are not $1. Typical wire transfer fees are at least $15 to send and $15 to receive. This is not ideal, especially as the world becomes more globally connected and person to person payments increase further. (Alice: +$35, Bob:-$75, Bank: +$30)

So how about we go back to the idea of having a big list of everyone and their balance (the records book), only now we make that list publicly available for all! Thousands of copies are digitally distributed around the world and kept up to date.


Problem 1 : Privacy

The first problem is privacy. We don’t want anyone to be able to look at our balance, so instead of listing our names we list a kind of account number. No one can tell it’s us from looking at this kind of account number. We will call this number our Public Key. Public because anyone can see it. We are now pseudo-anonymous that is, the Public key does not reveal the identity of the user. 

Problem 2: Accuracy

The next problem is keeping the list up to date and accurate! This is what cost all the money for the banks which is precisely what we are trying to avoid.
We can start by splitting up all the effort of this task between as many people as we can get to help. This is done by making the software opensource and distributed. This way anyone who wants to support the new system can help! By using a standard method/format to record each transaction (a transfer from one person’s private key to another’s) the amount of storage needed is reduced too.
Something like person A transfers $2 to person B would be condensed down to A:2:B (really small!)


Explanation continued …

Importantly this is then sent to everyone on the network who is running this software.
Every 10 minutes or so we will gather all of these messages and use them to adjust the balance of everyone’s account. Then we do use something called hashing to store which group of transactions were included. To do this we take a hash of the transactions that we used to update balances and this forms a single hash of the group of transactions. We combine this with the hash of the last lot of transactions. This is to make sure that every 10 minute group gets combined with every group before it!

Hashing is considered practically impossible to invert. It takes an input for example abc and outputs a string of numbers and/or letters.


Hashing in Bitcoin

Bitcoin uses a SHA-256 Hash where

abc -> ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad  (think ba78....15ad)

SHA-256 is actually quite quick to calculate, so there is a real danger that someone could calculate billions and billions of hashes. This could be bad if we were hashing short things like abc, but as it turns out we are hashing long strings of numbers and letters (like the one that was generated from abc) and the longer the number of letters/numbers the more combinations so we are pretty secure.

But pretty secure is not good enough, we want to be practically possible to invert. So often in bitcoin we take the SHA256 Hash of the output of a Sha256 hash. That is

abc -> ba78....15ad -> dfe7a23fefeea519e9bbfdd1a6be94c4b2e4529dd6b7cbea83f9959c2621b13c

By hashing each lot of transactions with all those gone before we create a Merkle Tree

(It also uses something called salting, but that doesn’t need to be covered now)


Explanation continued …

This system of people running free software on many computers to allow people to transact tokens and every 10 minutes updating the balances of everyone’s account in a verifiable way by hashing with SHA-256 is the fundamental explination of how bitcoin works

  • The tokens are bitcoins
  • The lots of transactions are block
  • The list of all transactions (blocks) ever made is called the blockchain
  • The people running the software to keep track of everyones balance are called miners