Let’s say I send you a movie or song over the Internet. I attach a file to an email, and once I hit send, you have it. You can watch the movie or delete it. You can do what you want with the movie.
But keep this in mind: I still have a copy.
This is how digital information typically moves around the Internet. You don’t really transfer content, you copy it. And so far, this has worked out pretty well: Although it may not be legal or fair, copying a song or movie is unlikely to devastate the economy.
But now think about copying money.
If I send you a dollar, it’s important that I don’t get to keep a copy. Using email to make infinite digital money might seem attractive at first, but what happens once everyone starts doing it? There would be rampant inflation and the economy would fall down.
Traditionally, in the world of wire transfers and debit cards, digital money is tracked centrally to prevent duplication. A database, at your bank for example, verifies who owns what. This system relies on centralized authority, which is a familiar concept, so we “get it.” Of course, that central authority has complete control over your money.
But what if there’s another way? What if, instead of relying on an fallible centralized authority to assure us of who has what, we rely on distributed authority that isn’t controlled by a single party? What if our money has value not because we trust the power of a government to back it, but because we trust the power of math?
This takes us to Bitcoin.
Bitcoin is a system of digital currency that is not associated with any government or institution.
Somewhat confusingly, the word “bitcoin” (without capitalization) is also the name used for the currency itself. The system (Bitcoin) was created in 2009, but the units of currency (bitcoin) are being generated continuously through a process called mining. It’s sort of like gold mining, but for the digital 21st Century.
All transactions on the Bitcoin network are permanently recorded in a long list called the blockchain. This is not a secret list guarded by a central authority. It is a widely distributed public list, and every participating computer has a copy of it.
The Bitcoin blockchain is an immutable, public, distributed ledger:
By immutable, I mean that once a record has been in the blockchain for a couple hours, changing or erasing it becomes infeasible. This happens because so many other transactions have been built on top of it by then.
By public, I mean that anyone, not just a bank employee, can look at the blockchain. This doesn’t mean that you can see exactly who is sending or receiving money, because records are pseudonymous — identity is obscured through the use of pseudonyms, which are typically short-lived.
By distributed, I mean that synchronized copies of the blockchain are held by computers all over the world. There is no canonical master copy; all copies are created equal.
And finally, by ledger, I mean that the blockchain is a list of transactions. Think of it like your Venmo transaction list, if you know what that is.
This distributed ledger is called the “blockchain” because individual transactions get grouped into larger “blocks,” which are chained together in a sequence. This is faster than adding transactions one-by-one, and a new block of transactions is created every 10 minutes or so.
To better illustrate the power of an immutable, public, distributed ledger, let’s imagine a common but hypothetical situation involving $5 worth of bitcoin. (The value of a bitcoin can rise or fall, but $5 is likely just a fraction of a single bitcoin.)
In our hypothetical situation, my friend Elizabeth sends me $5 in bitcoin, a transaction recorded in the blockchain — because every transaction is. In turn, I send $5 to you because every copy of the blockchain now shows that I own the money that used to belong to Elizabeth. Nobody involved — me, you, or Elizabeth — needs to ask an authoritative central database who owns what, or for permission. Authority is decentralized; it is in every copy of the blockchain, everywhere.
You may be wondering: Where did Elizabeth get that bitcoin she sent to me?
The short answer is that someone probably sent it to her. This is how almost everyone gets their bitcoin.
But those coins had to be created initially. How did that happen?
How a Bitcoin is Born
U.S. dollars are born when the U.S. government prints them, and other traditional currencies are also issued by their respective governments. A long time ago, U.S. dollars were backed by an equivalent amount of gold in the U.S. treasury, and in those days creating additional currency required coming up with commensurate gold — hence the popularity of gold mining.
A bitcoin is also created through a process called mining. It’s digital mining, accomplished with computers and software rather than dynamite and shovels. In order for a new block of transactions to be added to the blockchain, a burdensome math problem must be solved, and the “miner” who solves the problem first is rewarded with brand new bitcoins. That’s how bitcoins are mined.
In other words, mining does two things: It adds blocks to the blockchain and it creates new bitcoin. And that math problem that the miners are racing to solve involves something called hashing.
A hash is a fingerprint for data, in that it uniquely identifies a piece of digital content — whether the content is a photo, a photo album, a movie, a password, text, or whatever. It is derived from the digital content, through a process called “hashing,” and it can take the form of a string of letters, numbers, and other symbols.
Hashing is a core concept in computer science, widely used behind the scenes. To enhance security, online services often store hashes of passwords rather than actual passwords, and compare hashes rather than passwords when you log in. Facebook uses hashes to check the appropriateness of uploaded images. Nobody at Facebook looks at every image to see if it is violent or pornographic. Instead, Facebook takes images that have been reported as inappropriate and hashes them, creating a list of fingerprints of bad content. Every time a new photo is uploaded to Facebook, it’s hashed using the same function. The resulting hash is compared to the list of hashes of banned content — and if they match, Facebook knows the photo is one of the inappropriate ones.
Typically, when software runs a hash function, it takes input data— like a photo — and outputs a gobbledygook string, which is the hash.
So for example, let’s give this picture of a puppy to a hash function called SHA-256:
Clearly this picture of a sweet puppy isn’t violating any Facebook rules! Anybody can tell that. But no person at Facebook is reviewing the picture. Instead, software at Facebook checks the hash of the picture, which is this:
That’s the SHA-256 result of that picture, expressed in hexadecimal. Not quite as cute as the puppy!
An interesting feature of a hash function is that if we change the input even slightly, the output will be entirely different. Let’s say, for example, that we change just one pixel of the photo of the puppy, by putting a 1-pixel black flea above his eye:
When we hash the photo, we get an entirely different hash, even though only one pixel changed:
Now, we could use real content and real hash values for the rest of this post, but hashes are unfriendly and hard to tell apart. Instead, let’s use emoji to represent these inputs and outputs. In the example below, the input (the content to be hashed) is represented by the cat’s face, and the output (which is the resulting hash) is represented by a ribbon:
Imagine that Facebook has run a hash function on two inappropriate images — let’s call them 🚫 and ❌ — and the resulting hashes are 💩 and 💀.
Later, somebody uploads a photo, which we’ll call ?, because Facebook don’t yet know what it is. Facebook hashes the photo, and the result is 💩.
Although no one looked at the mystery picture, Facebook knows it’s the inappropriate photo that we’re calling 🚫, because the hashes match. No one had to look at the newly uploaded input directly, because it has the same hash as a photo known to be inappropriate.
Photo identification is just one application of hashing. Bitcoin mining, which creates new bitcoin and adds new transactions to the blockchain, is another.