Talking tech since 2003

Editor’s Note: This article was written by Sam Phippen, a swashbuckling hacker from Bristol, UK.  He writes code.  He has a website.  And sometimes he tweets.

Bitcoin is an incredibly strange phenomenon. It consumes programmer forums with debates about economics. It consumes economics forums with discussions about cryptography. It gives governments and lawyers a hard time when they try to define it. And it has wild social implications. I’m not an economist, but according to Dan Kaminsky neither are most economists. I’m going to try and give you, dear reader, the technical background necessary to understand how Bitcoin works. With that, let’s dive into the technical details of how Bitcoin works.

Bitcoin is a digital currency, it’s free to get a bitcoin account. To do this one downloads what’s called a Bitcoin wallet. There is an official wallet that has been created by the original creators of the Bitcoin system, available here. The wallet is effectively a peer to peer client, a lot like a torrent client, however, instead of transferring files, the Bitcoin client listens for transactions that others broadcast. All Bitcoin clients connect to some arbitrary number of other clients. When someone wants to send a transaction they specify the Bitcoin address of the recipient, then the transaction is then broadcast accross the network, in this way transactions are public. The more clients the transaction is broadcast to, the more likely it is that it will be verified and included in the permanent public ledger of Bitcoin transactions, this ledger is referred to as the Block Chain.  In order to help ensure that only valid transactions are accepted, most Bitcoin clients will not accept transactions until they have been included into the Block Chain.

Every Bitcoin client has one or more addresses. An example of a Bitcoin address is 31uEbMgunupShBVTewXjtqbBv5MndwfXhb. These addresses, as you can see, are not really human readable. The addresses are the result of a cryptographic process that allows users to claim Bitcoins that are sent to their address, while allowing others to uniquely identify the owner. Another interesting facet of these addresses is that they are pseudonymous. It is fairly trivial to work out if many addresses belong to the same person, but quite hard to work out who that person is. However, there are some cases where that psuedonymity can be broken, an example being if you use your credit card to buy Bitcoins for one of your addresses.

Bitcoin transactions are formulated in a slightly different way to modern banking transactions: a banking transaction is of the form transfer $x from my account to someone elses account. By constrast Bitcoin transactions do not represent a transfer from an account to another account. A Bitcoin transaction has multiple inputs and multiple outputs. The outputs of a transaction specify to whom the Bitcoins will go after the transaction has completed. The way this is specified is using the recipients Bitcoin address. That recipient can then use the Bitcoins from that output as an input to another transaction. This way all Bitcoins have a history that can be traced back to their generation. The sum of the Bitcoin value of the inputs of a transaction must be strictly greater than or equal to the sum of the Bitcoin value of the outputs, otherwise the transaction is invalid. If the sum of the outputs are less than the sum of the inputs, the Bitcoins that have an unspecified recipient are used as a “transaction fee” and given to the first Bitcoin miner to include the transaction in a mined block.

Bitcoin mining is the glue that holds the entire Bitcoin network together. It ensures that all parties in the network are honest and rewards those that mine. The frenzy to mine Bitcoins has created the biggest distributed supercomputer in the world. As clients broadcast transactions they form a public record called the “open transactions,” of all the transactions that haven’t yet been included in a block. When a Bitcoin miner successfully mines a block, all the open transactions are verified and encoded into the Bitcoin Block Chain, at this point the transaction is considered to have actually happened. Each block has a reference to the previous block that was mined, in this way we have a permanent public ledger of all transactions that were successful.

When a block is mined the person that mines the block is given a fixed reward along with the transaction fees. At the moment this reward is 25 Bitcoins. This means that anyone that mines a block at the moment gets 25 Bitcoins plus all the transaction fees of all the transactions that are included in that block.  The fixed reward halves every four years meaning that the total number of Bitcoins that will ever exist is 21 million Bitcoins. The mining process itself represents a very interesting cryptographic problem, the problem can be made arbitrarily hard. No matter how many computers work on Bitcoin mining, the rate that blocks are created is approximately fixed, at 10 minutes. The problem that miners have to solve is adaptive, meaning that it can become more difficult or more easy depending on the total speed of all the computers trying to mine. This means that whoever can solve the problem first can claim the Bitcoins for the current block. The problem works in such a way that the number of Bitcoins that you are likely to mine is proportional to the power of your computer.

To summarize, the Bitcoin network works as follows:

  1. Transact: someone tries to send some Bitcoins to someone else.
  2. Gossip: that transaction is broadcast accross the Bitcoin network in a peer to peer fashion.
  3. Sign: Bitcoin miners sign all valid transactions that are open using a hard cryptographic problem that gets harder as more people try to do it.


Sign in or become a BestTechie member to join the conversation.
Just enter your email below to get a log in link.

Subscribe to BestTechie Plus

You've successfully subscribed to BestTechie
Welcome back! You've successfully signed in.
Great! You've successfully signed up.
Your link has expired
Success! Your account is fully activated, you now have access to all content.