Let’s say I send you a movie over the internet. I attach a file to an email, hit send, and you have it moments later. You can download and watch the movie, or delete it. You can do what you want with it.

But keep this in mind: I still have a copy of that interaction.

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.

At first, using email to make infinite digital money might seem attractive, but what happens once everyone starts doing it? There would be rampant inflation and the economy would fall down. If I send you a dollar, it’s important that I don’t get to keep a copy.

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.

Introducing Bitcoin

Bitcoin is a system of digital currency not associated with any government or institution.

Somewhat confusingly, the word “bitcoin” (lowercase “b”) is also the name of the currency itself. The system and overall concept (capital “B”) 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 though, because records are attached to pseudonymous, meaning a recipient or sender’s identity is obscured through the use of fake names, which — in the case of Bitcoin — are long strings of numbers and 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 transaction history on Venmo or with your banking institution.

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 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, as every transaction is. In turn, I send $5 in bitcoin to you, and every copy of the blockchain now shows that you now own the money that used to belong to me, which used to belong to Elizabeth. Nobody involved — me, you, or Elizabeth — needs to ask an authoritative central database who owns what, or for permission to make these transactions. 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, so how did that happen?

How a Bitcoin is Born

Dollars are born when the United States government prints them, just as 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,Though this is 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. That math problem the miners are racing to solve involves something called hashing.

Hashing 101

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, etc. It is derived from the digital content itself, through a process called “hashing,” and 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 the 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 on the platform 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 signaling “bad” content. Every time a photo is uploaded to Facebook, it’s hashed using the same function. The resulting hash is compared to the list of hashes for banned content ,and, if they match, Facebook knows the photo is inappropriate.

Typically, when software runs a hash function, it takes input data — like a photo — and outputs a string of gobbledygook, which is the hash.

As an example, let’s give this picture of a puppy to a hash function called SHA-256:

“Puppy” by Jonathan Kriz is licensed under CC BY 2.0.

Clearly this picture of a sweet puppy isn’t violating any Facebook rules. Anybody can tell that. But no one at Facebook is reviewing the picture. Instead, software at Facebook checks the hash of the picture, which is this:

8EC9D4718F919C6087CA589EDA09E7DD9A7ACCDB820F42B4196E1D0D4BEDE77A

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-size black flea above his eye:

Can you see the flea?

When we hash the photo, we get an entirely different hash, even though only one pixel changed:

039E1AF92F7D00775ECE35C2216FC3F7F0BBCD31F912A105D2601380D8DEABA2

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.