How Does a Bitcoin Transaction Work?

Bitcoins only exist as a chain of 'ins' and 'outs'

Bitcoin transactions are more complex than you might think. You rarely simply send an amount of bitcoin in one go. Instead, your bitcoin wallet and the bitcoin network have to go through a set of steps to ensure that the right amount of electronic money gets to the recipient.

Firstly, it’s important to understand what a bitcoin looks like. It isn’t a single record of a coin, as you might find on an accounting ledger or on your bank statement.

Instead, it’s registered as a transaction, comprised of three things: a transaction input, a transaction output, and an amount.

  • The transaction input is the bitcoin address from which the money was sent.
  • The transaction output is the bitcoin address to which the money was sent. If the bitcoin is in your wallet, that will be the bitcoin address under your control.
  • The amount is the amount of bitcoin that was sent.

The bitcoins that you send to someone were sent to you from someone else. When they sent them to you, the address that they sent from was registered on the bitcoin blockchain as the transaction input, and your address – the address they sent it to – was registered on the bitcoin network as the transaction output.

When you send that bitcoin on to someone else, your wallet creates a transaction output which is the address of the person to whom you’re sending the coin. That transaction will then be registered on the bitcoin network with your bitcoin address as the transaction input.

When that person then sends those bitcoins to someone else, their address will, in turn, become the transaction input, and that other person’s bitcoin address will be the transaction output.

Using this system, people can trace bitcoin transactions all the way through to when the bitcoin was first created, understanding who sent it to whom, at any point in time.

This creates a completely transparent system in which all transactions can be checked at any time.

Change Addresses

The problem is that the amount attached to these transactions with their inputs and outputs aren’t divisible. So, if Alice has a bitcoin address with one bitcoin in it, and she only wants to send Bob half a bitcoin, then she would have to send Bob that entire bitcoin The bitcoin network would then automatically create 0.5 bitcoins in change from the bitcoin that Alice sent, and send it to a third address in Alice’s control. That third address will also be a transaction output, meaning that the address will have multiple transaction outputs.

Over time, this means that bitcoin wallets end up with lots of addresses containing varying amounts of bitcoin and change from bitcoin transactions. When you send bitcoins to someone, your wallet will try its best to piece together the necessary funds using the addresses containing the different amounts. That leads to transactions that can have several different inputs – different addresses with different amounts used to make up the funds. It’s usually unlikely that these inputs will deliver exactly the right amount, so you normally end up with change.

What if you want to send just a tiny amount of bitcoin? Luckily, you can slice bitcoins very thinly indeed. The smallest divisible part of a bitcoin is called a satoshi, and it amounts to just one hundred millionth of a bitcoin. You can’t send just one satoshi over the network, though – that’s simply too small and would clog up the network with tiny transactions. The smallest transaction value is 5340 satoshis, which is still pretty tiny.

To complicate matters still further, many bitcoin transactions involve a transaction fee, which means that you have to add a certain amount of bitcoin on top of the amount you’re trying to send. If you don’t, then it’s likely that the bitcoin transaction will fail altogether. This is something to consider, especially when sending tiny fractions of a bitcoin.

So, when you open your bitcoin wallet after a few transactions and begin to see multiple addresses containing lots of tiny amounts, that’s what’s happening. It isn’t particularly easy to read and makes bookkeeping a bit annoying, but it does make it possible to trace bitcoin transactions through the entire network – which is important, given bitcoin’s mantra of transparency and immutability.

For a more complex description of bitcoin transactions, check the official bitcoin wiki here.