How Bitcoin Transactions Work

We explain how Bitcoin transactions are made of inputs and outputs, comparable to double-entry bookkeeping, and how they are linked in irreversible chains.

A bitcoin transaction is, at its simplest, one person sending bitcoin to another.

To be more technically correct, a transaction tells the bitcoin network that the owner of some bitcoin value authorises the transfer of that value to another owner.

Each party has a bitcoin wallet, and the amount is precise up to 8 decimal places.

A fraction of bitcoin at 8 decimal places, that’s 0.00000001 bitcoins, is called a satoshi, after Bitcoin’s inventor. On the Lightning Network, milli-satoshis will be supported, that’s 1/1000th of a satoshi.

More about bitcoin units

The transaction is a public record in bitcoin’s blockchain ledger that looks a lot like double-entry accounting.

Where conventional accounting refers to ‘debits’ and ‘credits’, for example a payment of £10 from Alice to Bob is recorded as a debit of £10 from Alice’s account and a credit to Bob’s account of £10, bitcoin ledger entries consist of ‘inputs’ and ‘outputs’. The input set has Alice’s wallet and amount information, and the output set has Bob’s wallet and amount information.

But unlike conventional bookkeeping, the double-entries don’t match each other exactly.

A single transaction may consist of a set of multiple inputs – Alice’s wallets – and a set of multiple outputs – Bob’s wallets. But the totals don’t match. If Alice sends 1 BTC to Bob, he’ll probably get around 50,000 satoshis less than that, so he’ll get around 0.9995 BTC. The difference is kept as a transaction fee by the lucky miner who adds the transaction to the ledger. In fiat terms, if we assume 1 BTC is £4000, the fee is around £2, a realistic value at the time of writing.

See how much transactions cost

The other reason the double-entries don’t match is that the inputs are not divisible, so the outputs may need to include some change back to the sender. If Alice’s wallet has 1 BTC in it and she wants to send Bob 0.75 BTC, if we ignore transaction fees for a moment then you’ll actually see 3 entries: the 1 BTC input from Alice, the 0.75 BTC output to Bob’s wallet, and another output of 0.25 BTC in change back to Alice’s wallet.

For the transaction from Alice to Bob to be valid, Alice has to sign it.

This is like signing a cheque, except unlike a handwritten signature, the private key Alice uses to sign the transaction is never seen by others (if Alice is careful) and can’t be guessed.

The transaction is not reversible, ever, by design.

This is a hugely attractive security feature of Bitcoin and great news for retailers who are plagued by chargebacks. The fact that more than half of the entire global network of Bitcoin users has to agree on the entire blockchain of Bitcoin transactions every time a block is mined, means a single transaction can only be tampered with if more than half of Bitcoin users agree to tamper with it. And once it’s buried further down the chain, the difficulty in tampering with the transaction goes up exponentially because more than half of Bitcoin users have to agree on tampering with every single block above it.

When Bob decides to spend the bitcoin value he got from Alice, that transaction output becomes the input of the next transaction.

These transactions form a chain. Chains live in blocks. Each block of transactions is limited to 1 megabyte in size. This is a problem for Bitcoin because it slows the network down when there are many transactions.

SegWit2x is a controversial upgrade scheduled for November 2017 that tries to fix the problem by doubling the block size to 2 megabytes and centralising some of the chain’s information. It’s controversial because some see the size doubling as a temporary band-aid that won’t work in the long run, and because centralisation is not very popular with those who believe in a decentralised system of money. Like Bitcoin.

References include bitcoin.it and bitcoinfees.21.co, as well as Mastering Bitcoin, 2017, by Andreas M. Antonopoulos.

Leave a Reply

Your email address will not be published. Required fields are marked *