Author: Carter Woetzel
This article was initially published at: https://medium.com/@caw34769/stranded-on-an-island-blockchain-cryptocurrency-explained-396997d9644
After a long day out sailing, a storm strikes your boat. The idyllic evening with your friends took a harsh turn for the worse. Massive waves crash up against the harrowed crew of accountants and financial analysts. These are experts of navigating volatility and chaos, but not this kind. After multiple hours of close calls and near deaths, you and your twenty friends bail. You are lucky enough to get washed up on an island — a perfect one at that.
Your group quickly splits up, explores the island, establishes shelter, and begins distributing tasks (in a business esque manner). You are all professionals and it quickly becomes apparent you are all going to be on the island for a while. It would no longer be about survival, it would be about overcoming boredom and staying comfortable.
After a month or two, as a group you realize something distinct is missing.
Now, there are many finance savants in this group. The currency system would be started from scratch. It would need to be bullet proof or else someone would end up the tyrant of palm street.
Your friend group of twenty people decide the risk is worth it, and it is time to make a currency for the island. We will conveniently call this currency “cryptocurrency.” Everyone is given 100 “Coconut Coins” on everyone’s personal (and yet shared) identical ledgers. You’ve decided the only way anyone is allowed to transact with each other is if everyone is present for the transaction, and the majority of the people will allow the transaction to be made. Everyone records the same transaction on their own personal ledger. Using this system, everyone has an identical ledger, and consensus is maintained. If Tony purchases an item for ten dollars from Dakota, all twenty people will record this transaction in their own ledger.
If anyone attempts to change their balance on their ledger from ninety to one hundred dollars, the next time they attempt to trade or transact with someone else in the group, all other parties individually own their own identical “shared” ledgers that point to the fact that the individual does not have a ledger that matches the rest of the group. Because the group catches a mismatch in ledgers, the person is then punished with some sort of fee and is not allowed to trade with anyone else until they adopt the ledger that the rest of the group is using. This is another feature of blockchain: it eliminates the danger of any single party manipulating the ledger in their favor — creating a more secure network of transactions than a traditional centralized system.
We have highlighted the following valuable features of a blockchain ledger: consensus, enhanced security, corruption resistance, distributed ledger (by design), and decentralization of power.
The council of twenty friends decides to sit down and figure out a way to make the process of seeing if everyone’s ledgers match easier. You are three years in, and what was once a small notebook for a ledger has now turned into a thick dictionary of transactions. People are concerned a majority of the twenty individuals could collude to make a series of changes in the ledger from the past and have that corrupted ledger become adopted, robbing the innocent and enriching the nefarious actors.
What if there were a mathematical way to ensure no entries in the past could be changed? This guarantee would give the decentralized ledger the property of immutability. What’s more, could that mathematical surety become a part of the protocol “law” that automatically and “trustlessly” ensures no one can game the island’s system of currency?
This is where the power of programming and mathematics crosses over. A “hash” function is the perfect mathematical solution to this exact problem. Hashing is the algorithmic process of turning a given set of data into a unique digital fingerprint in the form of a perfectly unique string output. This function works no matter how big or small the data input is.
An example of using Secure Hashing Algorithm 256 (SHA256) is as follows:
“[Austin = $10 Carter = $5 Tony = $20 Dakota = $173]” as input.
SHA-256 hash of the input = 19409681d75421fd47fa76f9eb0c47051af27a9a64fcbcabaafc4a06d9c3b03c
“[Austin = $10 Carter = $5 Tony = $20 Dakota = $100]” as input.
SHA-256 hash of the input = 1dfcffc46e60f433d29381efe48e798efd402c7d70ab998591f4f859cdac5b6c
Any changes to the data, in this case Dakota’s total money as $100 instead of $173 (sent in as input to the hash function), produces a drastically different fingerprint. That is remarkable. You could enter a one hundred thousand-page dictionary into a hash function, and if someone changed even a single word in the dictionary or character anywhere in the dictionary, the output will be visibly different than the original hash of the entire dictionary. This is jaw dropping. It is utterly shocking — the type of fact that makes me pause and ponder the beauty of mathematics and research that makes this possible. Hashing gives a mathematical guarantee; a way for computer systems and people to know with 100 percent confidence that a given set of data has not been tampered with in any capacity.
Before we incorporate “hashing” into our circle of friends, we need to think about the difficulties. Hashing an entire ledger or dictionary of transactions takes a significant amount of time. What if a quicker way existed? This is where “blocks” enter the playing field. We make a simple rule. No one is allowed to go back into the history of the ledger to change any records. If you break this rule, it will be easy to spot.
Here is how: Everyone starts a new distributed ledger, same as before. Every page of this new ledger contains a set of records and account balance updates. When a new page or “block” is created, the hash of the previous page of data is stamped onto the new page. We do this again and again as more transactions and pages are added to everyone’s identical ledgers/books. This means every new page contains a perfectly unique fingerprint created by the fingerprint from the previous page of the ledger.
You cannot recreate these “hashed” fingerprints on each page unless you have an identical history of data and fingerprints from all of the previous pages or “blocks.” This is the guarantee generated from these blocks/pages “chained” together using a hash function. Thus, the name “blockchain” is used.
This chain of records, known as blockchain, is a mathematical guarantee that gives an extremely convenient method for checking that the decentralized digital ledger has been unaltered. Instead of comparing every single page and entry, we now have a single value on the most recent page of the ledger all twenty friends can compare with. Simply compare the most recent hashed page of transactions. No human party needs to be trusted with making an error during the check. It’s math. One plus one equals two. Forever and always. Trustless trust.
This mathematical guarantee, in combination with the design of decentralized ledgers, creates trust — simultaneously giving the property of both immutability and auditability. The blockchain is immutable because the past financial records cannot be altered without destroying the chain of fingerprints, and thus the validity of any nefariously changed ledger (in comparison to the agreed upon distributed ledger everyone else is using) is destroyed and ignored. Because the past is unalterable, you can easily flip through the pages/blocks of the ledger and observe the entire perfect unaltered history of transactions and balances within the ecosystem. Zero arguments result about who traded with whom and for what amount. All transactions are in the blockchain ledger. Publicly visible. Perfectly auditable. Concrete in immutability.
The island continues to thrive. The system of cryptocurrency is established, and the economy is built on the back of the blockchain ledger’s guarantee of trust. Heck, even a couple of your friends are trying to establish a derivative market for coconuts-falling-from-the-palm-trees.