Digital & Computing

# How Bitcoin works

Updated Wednesday, 25th May 2022
Everything you need to know to get started with Bitcoin.

Bitcoin is an application of public-key cryptography (cyrptographic algorithms which require two separate keys).

Getting started with Bitcoin is relatively simple. You need to download one of many special ‘wallet’ applications available for most computers and smartphones. You must then create a Bitcoin account, your wallet application will then generate a pair of public encryption keys – one private (known only to you) and one public (copies of which will be shared with other Bitcoin users). You are then ready to go.

Assume both of us are Bitcoin users and I want to send some Bitcoins to you.

1. My Bitcoin application performs the transaction by creating a message containing some of my coins and encrypts it using your public key. I can’t unlock the message and neither can any other Bitcoin user. In fact, only your private key can decrypt the message and that’s safe on your computer.
2. My software then signs the message using my private key. This doesn’t make the message any more secure, but it authenticates the message as coming from me.
3. The message is then broadcast to every Bitcoin user. Any Bitcoin user can authenticate the message by checking it with a copy of my public key – if it is genuine, the signature will match, if it doesn’t then the message is false and can be disregarded.
4. If the message is authentic, then your computer uses the single copy of your private key to unlock the encrypted message and place the Bitcoins in your ‘wallet’.

In most cases there is a short delay before a payment can be finalised and money appears in your account. Before you can receive Bitcoins other computers must validate the transaction. This takes on average about ten minutes.

You may have thought of a way to defraud Bitcoin; how can you stop people editing their records to award themselves more money or cancelling transactions? Well this is prevented by having every Bitcoin transaction scrutinised by many computers.

Groups of Bitcoin transactions are bundled into blocks and stored in a list called the block chain that holds a copy of every transaction ever made using Bitcoin. The block chain isn’t stored in a single location, where it would be vulnerable to attack or loss; instead copies of the chain are distributed among all Bitcoin users. Not only is the block chain protected from loss, or attack; but any Bitcoin user can validate any transaction.

Before a transaction can be approved it is added to a new block of pending transactions. The block is then processed by a powerful mathematical technique called hashing  that produces a unique identifier for the block (like a fingerprint) known as the hash. The hash and the block are then added to the block chain. Crucially, the new hash incorporates the hash of the previous block, which, in turn, used the hash of the block before that, and so on and on and on right back to the very first transaction.

If I want to check the validity of a block of transactions, all I need is for my computer to recalculate the hash for that block and compare it to the original hash from the block chain. If any of the data in the block have been changed, even by the smallest amount, the two hashes will be different and it would be obvious the block had been tampered with. Changing the contents of a block far back in the block chain not only creates a conflict with that block’s hash, but all blocks that follow on from it. And it’s not just my computer checking the hashes, millions of Bitcoin users are constantly and independently checking the hashes in their own copies of the block chain and comparing findings. Bitcoin relies on participating computers coming to a consensus about which transactions are valid. A block chain containing tampered records will be quickly identified as containing wrong data and will be ignored by the wider Bitcoin system.