I spent some time last night wrapping my head around how bitcoin works. Here’s a summary that I wrote up for a friend earlier today. The summary is a bit on the technical side.
The heart of the system is a global, public ledger listing all transactions on the network. The ledger is called the “block chain”, a term derived from the underlying tech.
Balances are held by ‘addresses’ which function much the same way as bank accounts.
- An “address” is the public side of a public key / private key pair.
- Transactions can only be initiated by the address owner, who has the private key.
- Transactions are authenticated by any number of peers on the network, using the address’ public key.
- New addresses are cheap to create, and can be created by anyone at any time. It is common for people to use many many addresses.
- The balance for any address may be derived by locating the first appearance of that address in the block chain, and rolling forward all transactions in the block chain involving that address.
Transactions are committed in batches called “blocks” about every 10 minutes.
- The network requires an expensive computation to be performed in order for the for transaction set to be committed to the public ledger.
- The computational cost protects the network against fraudulent transactions.
- The computation is a hash of the transaction data, the previous block’s hash, and a number called a “nonce”.
- The fun part: the hash must begin with N zeroes, where N determines the computational difficulty.
- The higher N is, the harder it is to find a nonce that produces a qualifying hash.
- Why? Because we don’t know a-priori what nonce will produce the needed number of zeroes in the hash, and must brute-force the computation by trying different nonces until one is found.
- The higher N is, the lower the number of qualified hashes, and therefore the harder it is to find a nonce.
- The network moves N up or down over time as described below.
- The people who do this work are called “miners” because the net result of their work is like mining gold.
- It is a competitive business.
- Only one miner can commit a block of transactions and get the reward.
- Miners race to be the first to commit a block, deploying electricity and hardware to gain bitcoins.
- The network adjusts N to maintain a pre-determined rate of bitcoin creation as hardware improves and miner interest fluctuates.