How Bitcoin actually works

Ok, so you read my 200-something word description of Bitcoin and you were like this is ridiculous. And you were going to send me hate mail. Which is why I wrote this page — to give at least a half-assed answer to the question for those who are interested, but are too lazy to read the longer descriptions that are out there.

Ok, like I said: Bitcoin is a transaction network with a public ledger. The basic unit of the network is the Bitcoin transaction, which is simply a digital file that describes an amount of currency as well as the identity of the individual who holds it.

These identities aren’t names — they’re public keys for a digital signature scheme (specifically, ECDSA). When Alice, owner of one transaction, wishes to transfer money to Bob, she simply appends a new transaction that references her original transaction, and contains the amount that she wants to give Bob, along with his public key. She then signs this new transaction with her secret key and gives it to Bob. Bob can give the new (and old) transactions to people, who can verify that the transfer is legitimate. But only Alice can actually cause such a transfer to happen.

It sounds great. But it should leaves you with two important questions:

  1. How did Alice get that original money, anyway?
  2. How do you keep Alice from paying the same money to lots of people?

Problem #2 is known as the ‘double spending’ problem. A sneaky Alice can pay Bob, then turn around and send exactly the same funds to Charlie, and then again to Dave. Sooner or later these guys will compare notes and realize they’ve been duped. But by this time Alice will be safely ensconced in a third world country — or on Wall Street. Either way, this is hardly a system you can rely on.

This isn’t a new problem, and one solution to this problem is to create a central database that maintains a record of every transaction that’s occurred in the system. Only transactions that appear in this database are considered valid, and they’re evaluated in the order they appear. This makes it easy for Charlie to detect that Alice is duping him — he just checks the database to see if she already transferred those funds to someone else.

Unfortunately, maintaining this ledger is tricky. Intuitively it seems to require some trusted server — which then becomes a single point of failure for the entire currency, not to mention a giant target for hackers.

Bitcoin’s innovation is to create a public ledger, but to do it in a completely decentralized fashion. This ledger, which is called the block chain, is maintained by consensus across many different (and mutually distrustful parties). No single party has control of the chain. In fact, nodes compete to be the one who gets to add new blocks to it.

The block chain consists of, well, blocks, each of which contains a bunch of transactions. Nodes called ‘miners’ pull these transactions off the Bitcoin network, which is essentially a peer-to-peer broadcast network. They then wrap a group of transactions up into a block and hash it together with the most recent block in the block chain. This ‘binds’ the new block to the end of the hash chain.

Now there are lots of miners who do this work and it’s important that one miner doesn’t get to make all the blocks, since he might start to cheat or include bogus transactions. To avoid this, Bitcoin creates a friendly competition by making the nodes solve a simple mathematical problem. The first person to find a solution sticks their solution into the block and broadcasts it out to the rest of the nodes. If it checks out, the remaining nodes drop their previous attempt and try to tack a new block onto the end of the one they just received. Ad nauseum.

There are two incentives for participating in this process. First, participants can add ‘transaction fees’, which are like a small voluntary tax that miners collect when they entomb a transaction into the block chain. Second, each node that succeeds in ‘mining’ a block (i.e., adding it onto the end of the chain) gets to add one more transaction that mints 25 brand new Bitcoin out of thin air. This new transaction is only recognized in newly mined blocks, and there can only be one per block. The node who mines it simply includes his own public key as the owner of the currency.

The reward for mining a block is currently 25 bitcoin, but it’s slated to drop every 210,000 blocks. Ultimately there will be no reward, which means that miners will be compensated by transaction fees alone, and that the supply of Bitcoin will reach a fixed point and never increase. Actually, it’s worse than that, since Bitcoin are being ‘destroyed’ all the time — essentially every time somebody loses the private key that controls one. This happens more than you’d think, thanks to hard drive crashes, for example. Moreover, it’s hard to tell if a given chunk of Bitcoin is defunct, or if someone out there controls the public key and is waiting to spend it. This makes investing in Bitcoin a very risky process.

There’s still lots more that isn’t in this description, like the way that transactions are distributed through the network, Bitcoin script, and a million other aspects of the design. But hopefully this has at least given you the flavor. Now please go read a much better description from the Bitcoin people themselves.

2 thoughts on “How Bitcoin actually works

  1. Your description, while sparse as intended, has one inaccuracy. Transaction fees can't be “charged” by a miner. When someone sends a transaction, they can choose to include a fee, which is essentially the opposite of the block-reward transaction: it contains a bitcoin input with no output, so it's just throwing it out there, allowing miners to direct those to themselves. Now, it's true that many miners will prioritize transactions with fees, and some may even ignore fee-less transactions. But they can't “charge” a transaction fee, per se.

Comments are closed.