Skip to content

Technology

How to read a Bitcoin transaction: inputs, outputs and change

A wallet shows a balance, but a Bitcoin transaction spends earlier outputs. Using a model payment, we distinguish the amount for the recipient, the change returned and the fee.

A model transaction with two outputs, one to the recipient and change back to the sender, recorded in a block and looked up by its TXID.
A model example without real addresses or identifiers: the transaction sends one output to the recipient and the change back to the sender’s wallet. Once it is in a block, each further block adds a confirmation. The status of that transaction is checked by its TXID, not by an address. · BTC Bitcoin

The illustration contains Czech text and has not been localised.

Behind the balance are specific outputs

Your wallet shows one balance. What happens when you pay directly over the Bitcoin network (on-chain)? The wallet builds the transaction using specific unspent outputs from earlier transactions, called UTXOs (unspent transaction outputs). Several of these individual amounts can make up your balance. The transaction appears on the blockchain once it is included in a block.

The input of a new transaction refers to an earlier output. To identify it you need the identifier of the previous transaction (TXID) and the output index, that is, the output's position within that transaction. The TXID alone may not be enough, because one transaction can have several outputs. Bitcoin Core's technical documentation labels these two items txid and vout.

One model payment, two new outputs

The following example is invented: it does not describe a real transaction, today's fees or a recommended amount to send. Suppose there is a single available input worth 100,000 satoshis (sat; one bitcoin has 100 million satoshis). From it we want to send the recipient 30,000 satoshis, and for the model we reserve 1,000 satoshis for the fee.

ItemValueMeaning in the model
Input100,000 satAn earlier UTXO, which is spent in full
Output to the recipient30,000 satThe amount intended for the recipient
Output back to the sender69,000 satThe change returned
Fee1,000 satThe difference between the sum of the inputs and the outputs

The input is worth 100,000 satoshis. The two outputs distribute 99,000 satoshis in total: 30,000 to the recipient and 69,000 back to the sender. The fee is the difference between the total input and output values, or 1,000 satoshis in this example.

A UTXO is not used only in part with a remainder left on it. It is spent in full, and the transaction creates new outputs. The 69,000 satoshis returned are therefore neither another purchase nor newly created money. They are part of the original value that, in the model, the sender continues to control.

Change needs an output of its own

The returned remainder is called change. Bitcoin Core, for example, has the command getrawchangeaddress for it, which returns a new address. According to its documentation it is meant for working with raw transactions, not for normal use. An ordinary user does not need to assemble a transaction by hand or run technical commands because of change; they follow their wallet's documentation.

The network will not return any surplus for which the transaction created no output. Any value of the spent UTXOs that the outputs do not cover counts towards the fees, which the miner of a block can collect if the transaction is included in that block. If, in our simplified model, only the input of 100,000 satoshis and an output to the recipient of 30,000 satoshis remained, the fee would be 70,000 satoshis. This is an arithmetical illustration of the rule, not a procedure you should try with real funds.

A fee is not the same as a rate

The total fee is the amount for the whole transaction. The rate in sat/vB (satoshis per virtual byte) relates that amount to the transaction's virtual size. If we further assume a size of 200 vB for the model, the result is 1,000 / 200 = 5 sat/vB. The size, too, is only an assumption: we have not assembled or measured any real transaction here.

The figure of 5 sat/vB is therefore not a current recommendation. Why waiting times and fees change is explained in the follow-up article on Bitcoin scaling.

What you cannot tell from a printout at a glance

The public record of a transaction may show several outputs. Without further context, however, do not assume that each means a payment to a different person, or that you can reliably identify one of them as change. A technical printout does not by itself tie any output to a real person's identity.

When you share addresses or details of a specific payment, you may link the public history to your real name. How such links arise is discussed in the article on privacy. The example concerned an ordinary on-chain payment. It does not describe the special coinbase transaction created by a miner, which is an exception to many of the rules above, or the course of an individual payment over Lightning.

Sources