“Crypto” “Bitcoin” “ICOs”. Fake & bubble OR Real & revolution?
Let’s talk about how it works and you can get a click closer to deciding for yourself.
Introduction
To get there we will need to do some setup, first a story. Once there were 3 great friends: Han, Luke, & Leia. They loved hanging out and because they were connected by some sort of cosmic power or, like, force or something, they really trusted each other even on contentious things like finances. On any regular night Luke would pay for the dinner (say 3 credits), Han would pay for the ride in the cruiser (say 5 credits) & Leia would pay for the movie (say 8 credits). At the end of the evening they would all take out their one trusty master scroll and copy it all down to their own scroll so they had an exact copy: yep – Luke 3, Han 5, Leia 8. They’d rest easy never worrying about their finances because of some basic principles:
- They didn’t need anyone else to track it for them
- They could all see any entry they’d ever made
- Their process was very doable for the 3 of them
Cryptocurrencies, like Bitcoin, work on the same principles.
- it is a peer to peer network and doesn’t require a bank
- anyone can see any transaction anyone else has ever made
- The process is very doable for not just 3 but an extremely large number of people
To start, think of it as “just” a shared database that everyone gets a copy of.
The entries would look like this:
And in non-database speak that would say: “Entry ID Txn340 states that on March 4th at 3:14 PM Luke gave to Leia these 3 credits”. This is called a transaction.
All the transactions gets shared with everyone on the network and anyone can look it up whenever they want and it never goes away. Groups of transactions are called “blocks”. When all of the blocks of transactions that have ever happened are stacked on top of each other that is called the “blockchain”.
Congratulations you now understand the basics of cryptocurrencies … but you probably wouldn’t be here if you didn’t want some more gritty detail….so:
Hmm, our galaxy friends from the beginning just met at the end of their spending and copied all the separate transactions – how in the world does everyone copy everyone else’s transactions?
Making copies is not hard. Getting everyone to do it is the hard part. There are three incentives that are compelling enough that people all over the world are willing to spend a ton of computing power to make the copies of this blockchain of transactions.
- There is a nominal fee that is shared among computers working on copying transactions.
- There is a big award of a new whole bitcoin that you get when you are the first to confirm a new block of transactions.
- There is the award of the bitcoin becoming more valuable themselves. 1Bitcoin becomes valuable because more people want Bitcoin, there are a limited number of them, therefore the people who have them require more dollars to sell one of them, which makes the price go up.
Ok so we know why…but how does that work?
This gets super deep and completely mind-blowing but I’m going to keep it at a similar level as the rest of the series, but I understand why people use words like beautiful in describing the math and design that went into the entire Bitcoin project. I’m also fairly convinced that betting against the people whose minds and passion are driving this whole project is similar to betting against the internet in the 90’s.
But How Does It Work?
What is hashing?
We need to pay a quick learning tax on a new term called “hashing”. Hashing takes an input of data and mixes it through a really complex algorithm so that on the other side it turns into a string (also reading this string is a great sleeping pill if you need it.) Go here and enter your name. You will get a string of letters and numbers that look like this:
B123A49B8C8B17BBD90F65A6137841E17CD6FC63FB4B594A1A2F687A78CF17BC
Anytime you enter the same data you will get exactly the same output, change it by 1 character or space and you will get a completely different number.
The way the math works is amazing, think of it like this. Start from wherever you are and take 10 steps to the north, then dig a hole 40 feet deep, pick a rock that is nearest to you, measure it in millimeters, climb out of the pit you are in and take that many steps to the south east, pick up the nearest blade of grass measure it’s width in centimeters and divide it by 15: that is the first number (say 11). Using that number start from where you are and find the nearest tree, measure it…and the steps just keep going and going. This of course is done with math not human-level moving and measuring, the key part is that it is super complicated & the number you ended with becomes part of the next number so the only way to get the 2nd number is to have the one before and therefore impossible very difficult to guess backwards using the final output. Every hash-ed transaction in the blockchain is connected to the prior all the way back to the first or genesis block.
This turns out to be extremely useful to many things especially to a transaction line like we have listed at the beginning – each transaction can translate into an exact hash and if there is a single character different it will not match.
Now Deeper
Wallets
Well first, we’ll start with our fictional “Luke” owning some Bitcoin instead of the credits we referenced in the above story. Luke keeps that bitcoin in a wallet. Instead of a stinky leather or the velcro one to match your shoes, this wallet is another software program (think robot brain). This “robot” creates a public and a private key for your wallet just like the robot in the encryption post. It takes the public key number and hashes it into your bitcoin address. Now you can share this number with anyone and something like an email, they can send you bitcoin from their wallet.
Signatures
To give “Leia” a bitcoin, Luke has to “sign” or approve the transaction by entering his secret key (think password). Since this is often a bit more serious than email, folks often enter that key for each transaction. Otherwise your wallet robot will need to be trained to have that ability. When that transaction is executed, the value gets transferred to Leia’s address and submitted to the network of computers to make it part of the master blockchain.
The only way to give that bitcoin (and it can be small fractions of it) is to enter that secret key, full stop. If you lose it – it is lost forever. If someone else gets your secret key – there is no way to stop them from spending your coin.
Why is it lost forever? Because it is damned near impossible to guess that number before the heat death of the universe, let alone your life time.
Security
Let me explain…no there is too much let me sum up. 2Princess Bride, right? anyone?
Let’s go back to beginning and talk binary for a second. If you have to guess a number that is only one digit long and is limited to either a 1 or a 0 it is pretty easy since there are only two possible guesses. But it starts getting crazy fast.
We are still outside cuckoo land through 8 possible guesses, but at 256 we are in full mental breakdown even with a computer.
There are 115 quattuorvigintillion possible guesses there. gulp. The only way to guess your secret key using a computer is to just program the computer to keep guessing until it gets it right even for a computer that takes a trillion, trillion, trillion, trillion –lost you already didn’t I–years.
But with the number, voila, instant unlocking, verifying & moving forward. So don’t lose the key:).
Blockchain-ing
Ok let’s follow Luke & Leia’ transaction for a bit to see how it gets married into the blockchain like a life being in the borg.
The transaction get sent out to the network for the hungry computers to confirm and make the transaction official. The first computer to pick it up will note the time stamp and sort it next to the transaction that happened immediately before. Using the hash of the last transaction + the hash of Luke & Leia’s they will fuse a new entry into the chain. Since the same hash will produce the exact same output, if any other computer gets something different it throw everyone off and the transaction gets rejected. Everyone’s entry must agree everywhere.3There is a fascinating principle called proof of work that declares that when there is a conflict the majority wins on any disagreement. This ensures that as long as most computers in the network are not bad guys that the system wards off cheaters
last transaction: Jabba pays Boba 100 credits =hash of
9A4CF5DF195C3D561A349FB28B0CDB2AAC846A25BE9051FDEDD7B33E1F272BA2
Luke & Leia’s transaction: Luke pays Leia 3 credits =hash of:
4E22E1ED8CDA61B78C97299395794827865C8102BC17BB969E056005AB8C334A
Both of them combined & therefore the next link in the blockchain = hash of:
610B3662255FF832AA7A335D918BEBD30735B1460893BC4819D70CFE553C004F
Try it at: https://passwordsgenerator.net/sha256-hash-generator/
If you start getting hashes that don’t match up with everyone else the computers keep working on both chains until one gets longer based on more people confirming the transaction upon which everyone defaults to the longest chain. Of course these are robot brains doing all of this work so it is happening at a speed incomprehensible to us.
New Blocks
Every 2,000 transactions or so a new block is created (this is kind of like a new page in the ledger) at this point a new bitcoin is released into the network, the miner who starts the new “page” gets it, wahoo! It is a game of odds so the more computer power you contribute to the network the more likely you are to get that shiny, new bitcoin. At varying prices & future hopes this is a big incentive to contribute to the transaction confirming.
This whole topic goes fascinatingly deeper into:
- how the rules prevent double spending
- how to see any transaction in the blockchain: https://www.blockchain.com/explorer
- how computers join and leave the network
- much more …
Why is Bitcoin (& Other Cryptocurrencies) a big deal?
The most technical & most passionate are as excited about this as the same (now older crowd) was about the internet. If there is a currency that cannot be manipulated, is immune to borders & exchange, is controlled by math vs people & is more universally trusted – it could change everything. I’ll write more about the implications as time goes on, but it is a bit beyond the scope of the tech journey that this series has been focused on!
Concluding the Tech Series
Alright, if you’ve hung out this long, congrats – I sincerely hope getting a birds eye view of tech is helpful in your ability to build & be a creative force in making the world a better place. This is obviously a bit like flying over the country – important but just a start to the depth that is inside each of these areas, I find it fascinating & encouraging to think about the possibility that we can create the world to be – happy building!
Don’t be a stranger & sign up for future posts!
If this series has been worthwhile, you can cast your vote here:):