This is a quick tour of Bitcoin and how it works. The aim is to provide a short, but reasonably comprehensive overview of Bitcoin. It is for people who are interested in how Bitcoin actually works, but don’t want to spend hours researching all the details.
This essay expects some basic knowledge of the internet, such as knowing what a server is. If you need to learn a little about the internet first, or would like to gain a better understanding of how the internet works, please read my previous essay on the internet.
We’ll start by introducing one concept at a time, gradually building our understanding of the whole Bitcoin ecosystem. Towards the end we’ll also look at some of the more interesting use cases that Bitcoin can do, such as smart contracts.
A transaction is a way to allow a user to spend their Bitcoins.
Public key crytography
A transaction makes use of public key cryptography, which involves a user having both a public key and a private key. The public key can be freely shared, while the private key is kept secret to the owner.
This allows anyone to encrypt things using the public key, so that only the owner of the private key will be able to decrypt them. It also means a user can sign something (like a document or message) with their private key and anybody with the public key can verify that signature and be sure the document came from the original user and has not been tampered with.
A transaction contains transaction inputs (txin) and transaction outputs (txout).
A transaction output is used to authorise someone else to be able to spend the Bitcoins you have. A typical transaction output will include details of a public key that is paired with the private key that should be allowed to spend the Bitcoin in the future.
A transaction input comes from a txout in a previous transaction. Essentially Bitcoins are spent through a chain of transactions, where each transaction is spending the outputs of previous transactions.
In order to allow transactions of varying amounts, txouts and txins don’t have to match in value, but the total value of the txouts must be no more than the total value of the txins.
If Alice had previously received 5,000 bits at some point and another 3,000 bits at some other time, then she would have 2 txins that could be spent using her private key. If she wanted to send 6,000 bits to Bob, she would create a transaction using both of her txins (totalling 8,000 bits). Because Alice cannot make the exact total input she wants to send to Bob, she creates 2 txouts, one to pay 6,000 bits to Bob’s public key and the other to send the remaining amount back to her own public key. So, this transaction might look something like this:
How are transactions seen by everyone. Purpose of a decentralised network.
Prevent transactions being double spent by securing in a block by a miner.
Why history can’t be overwritten. Security of transactions once several blocks into the blockchain.
n of m
We’ve taken a brief look at many different parts of Bitcoin, if you’d like to learn more about any of these parts, the links below may give you a good start: