VIEW THIS AS

Auto mode follows the Route Engine until you choose a viewpoint.

YOU ARE HERE

ROUTE CHECK

CONNECTED TO

WHAT NEXT

Use the canonical route for this room, or HELP if you are unsure.

UTXO Transactions and Change Outputs: Follow the Records, Not Just the Balance

Three students in school uniforms work through open books at a classroom table, with textbooks and stationery nearby and study notes on the whiteboard behind them.

中文版 · Blockchain learning guide · Previous article

Blockchain learning · Article BC032

Three students in school uniforms work through open books at a classroom table, with textbooks and stationery nearby and study notes on the whiteboard behind them.
Study photograph for illustration; it does not establish that the pictured students are studying blockchain.

In a UTXO model, a transaction names particular unspent outputs, satisfies their spending conditions and consumes them to create new outputs. A wallet’s displayed balance is an aggregation of relevant outputs; it is not necessarily one account value that the transaction simply subtracts from.

This guide uses fictional integer credits to make the record changes visible. You will consume two named outputs, allocate a recipient output, a change output and a fee difference, then check which records remain spendable. No real coins, keys, addresses or network transactions are involved.

Choose your reading route

In this guide

Start with the output identifier and the three-record ledger. Then calculate the main transaction and inspect the before-and-after UTXO set. The later failure cases explain why enough total value and a valid signature are not, on their own, a complete transaction check.

The exercise concerns ordinary already-spendable inputs. It excludes special issuance transactions and maturity rules. Bitcoin is the named technical reference, but our small credit values and symbolic conditions are teaching objects, not valid Bitcoin transaction encodings.

Back to contents · Next section

1. A UTXO is a particular output record

UTXO means unspent transaction output. The key word is output: it is a specific result created by an earlier transaction, with a value and a spending condition. It remains available until a later accepted transaction consumes it under the applicable rules.

A Bitcoin input identifies a previous output using a transaction identifier and output index. Two outputs from the same transaction are therefore distinct records. An address by itself does not uniquely identify one spendable output.

The Bitcoin transaction guide introduces this input-output structure and explains wallet balances as sums of relevant unspent outputs. Its examples include older script forms; we use the basic record model, not an assertion that those examples list all currently used output types.

In our worksheet, alpha:0 means output index 0 from fictional transaction alpha. beta:1 means output index 1 from fictional transaction beta. These are symbolic names, not real transaction hashes.

The identifier tells us which record to examine. It does not by itself prove that the record exists, remains unspent or can be spent by the person presenting it. Those are separate checks.

Back to contents · Next section

2. The initial ledger contains three outputs

The teaching ledger supplies three ordinary unspent outputs that K is authorized to spend under their simplified conditions:

  • alpha:0 has value 7 and requires the exercise’s K authorization.
  • beta:1 has value 5 and requires the same simplified authorization.
  • gamma:0 has value 4 and also requires K authorization.

The total relevant value is 7+5+4=16 credits. That is the wallet-style aggregate for these supplied records. There is no single UTXO with value 16 in the worksheet.

The values are integers so we can check every equation exactly. They are not prices, exchange rates or a suggested transaction amount. We assume all three records are available in the selected pre-state and have no additional unmodeled restrictions for this exercise.

K wants the classroom transaction to create a new output of 9 credits for recipient R. We separately supply a fee difference of 1 credit. The task is to determine which existing records are consumed and where the remainder goes.

Back to contents · Next section

3. Select named inputs, not an abstract balance slice

The main transaction selects alpha:0 and beta:1. Their input value is 7+5=12. Gamma:0 is not selected, so its value 4 remains in its existing record if the transaction is accepted.

The selected inputs are consumed as records. The transaction does not spend only 5 credits from alpha and leave an altered alpha:0 with value 2. Any remainder that should stay available to K must be represented by a new output.

This is the source of change. It is not an extra reward and not a refund that appears automatically outside the transaction. In our exercise, the new transaction explicitly includes the output that preserves the remainder for K.

Other input selections could produce other output arrangements under a defined policy. We use this selection to make the arithmetic inspectable, not to recommend a real wallet’s coin-selection strategy. Actual choices can involve size, privacy, policy and other constraints beyond the model.

Back to contents · Next section

4. Allocate recipient, change and fee difference

The selected input total is 12. The transaction creates output 0 with value 9 under R’s spending condition and output 1 with value 2 under K’s condition. Total output value is therefore 11.

The remaining difference is 12−11=1, which the exercise assigns as the transaction fee. The conservation equation is 12=9+2+1. Every credit is accounted for without creating extra value.

The change output is the 2-credit record for K. The fee is the 1-credit difference. Confusing them would misstate both the new UTXO set and the value remaining under K’s control.

In Bitcoin’s ordinary transaction model, the fee is derived from the difference between input and output amounts rather than being a normal recipient output labeled fee. The transaction reference describes the input and output structures needed to interpret that distinction.

Our fictional transaction is called first. Its new outputs are first:0 for R and first:1 for K. The names make the later spending path easy to follow; they are not actual hashes computed from serialized bytes.

Back to contents · Next section

5. Update the UTXO set after acceptance

Before the transaction, the relevant set contains alpha:0=7, beta:1=5 and gamma:0=4. After successful acceptance in the supplied state, alpha:0 and beta:1 are spent and no longer available as unspent inputs.

The new relevant set contains gamma:0=4, first:0=9 under R’s condition and first:1=2 under K’s condition. K’s remaining aggregate is 4+2=6. R has the new 9-credit output. The 1-credit fee difference accounts for the rest of the original 16.

Notice that K’s balance fell by 10, not 9: 9 went to R’s new output and 1 became the fee difference. The arithmetic is 16−9−1=6. The unchanged gamma record and new change record together produce that remaining balance.

This set update is conditional on the transaction being accepted in the specified history. Constructing or broadcasting a candidate does not itself establish that the referenced outputs have been consumed by the accepted chain.

We keep finality and branch changes outside this arithmetic exercise. A real application must attach its UTXO observation to the relevant chain state rather than treating a pending candidate as settled history.

Back to contents · Next section

6. Spend the change as a new input

Suppose a later classroom transaction spends first:1, the 2-credit change output. It does not refer back to a supposed leftover portion of alpha:0 or beta:1. Those old records were consumed by the first transaction.

For the second transaction, the exercise supplies a recipient output of 1 credit and a fee difference of 1. No positive-value change output is needed in this particular arithmetic: 2=1+1.

After that second transaction is accepted, first:1 is spent. Gamma:0 remains untouched at value 4, because neither transaction selected it. The second transaction’s recipient output has its own new identifier and spending condition.

This trace makes the graph structure visible. Inputs point to earlier outputs, and outputs can later become inputs. The displayed aggregate may look like a changing number, but the underlying change is the creation and consumption of specific records.

The example does not claim that every small output is accepted by every real node’s relay policy. Practical minimum-output and fee policies are separate from this abstract conservation exercise and must be checked in the relevant system.

Back to contents · Next section

7. Spending conditions are not merely ownership labels

Our notation “requires K authorization” is a teaching simplification. A real output can specify conditions whose satisfaction is checked under the applicable script or validation rules. Those conditions may be more complex than one person’s name beside a balance.

A correct amount calculation does not satisfy a missing spending condition. Conversely, a valid signature does not establish that an output is still unspent or that the transaction’s amounts are valid. Authorization and state checks must both pass.

The precise material supplied to satisfy an output’s conditions depends on its type and protocol rules. We do not teach an obsolete universal script template or ask the reader to construct a real unlocking script.

Nor should “can satisfy the spending condition” be treated as a complete legal ownership determination. The protocol checks its defined authorization mechanism; real-world rights and organizational authority can require other evidence.

In the worksheet, authorization is supplied as an assumption so the learner can concentrate on record identity and conservation. If that assumption is removed, the arithmetic alone cannot approve the transaction.

Back to contents · Next section

8. Four invalid candidates

First, a candidate lists alpha:0 twice as if it supplied 14 credits. It references the same output twice. Repeating an input identifier does not duplicate the record’s value; this is not a legitimate way to increase the available total.

Second, after first has consumed alpha:0, another candidate tries to spend alpha:0 again in the same accepted-history context. The record is no longer unspent, so the candidate cannot rely on it as a fresh input.

Third, a candidate uses alpha:0 and beta:1, total 12, but creates outputs totaling 13. It attempts to allocate more than the supplied input value. In our ordinary non-issuance model, that violates the conservation rule.

Fourth, a candidate balances its amounts correctly but provides no valid K authorization for the selected records. It fails the spending-condition requirement even though the equation works.

These failures have different explanations: duplicate reference, already-spent reference, excess outputs and missing authorization. A useful review records the actual failed check rather than putting every rejection into one undifferentiated error category.

Back to contents · Next section

9. Enough aggregate value does not answer every selection question

The initial wallet-style balance is 16, but it consists of three records. An instruction saying only “use my balance” leaves the selection and output construction unspecified. The transaction still needs actual inputs and outputs.

Suppose a classroom request needed 15 credits plus a fee difference of 1. All three supplied inputs could sum to 16 and fund exactly that arrangement, assuming the same eligibility facts. Selecting only alpha and beta would not suffice even though the wallet’s overall display says 16.

In a real wallet, some displayed categories may include pending, locked, immature or otherwise unavailable amounts. This exercise avoids those complications by specifying ordinary spendable inputs, but a reader should not treat every displayed balance category as immediately selectable value.

There is also a distinction between what a wallet knows and the complete network state. If it lacks a relevant record or has stale information about a spend, its display may not support the conclusion a user draws from it. State context and evidence remain important.

Back to contents · Next section

10. Output identity and recipient intent are separate

Output first:0 has value 9 and R’s supplied spending condition. Output first:1 has value 2 and K’s condition. Calling the second one change describes its role in this transaction, not a special exemption from normal output rules.

If the constructed change output instead used an unintended condition, the arithmetic could still balance while the result failed K’s intent. Conservation proves an amount relationship, not that the recipient and change conditions are the ones the user meant to authorize.

Likewise, a transaction identifier and output index distinguish records, but they do not explain why a particular output was created. An application may need its own labels and evidence to connect an output to an invoice, request or classroom purpose.

For our nonfinancial exercise, the reviewer checks both the values and the supplied K/R conditions. This joins the mechanical UTXO calculation to the earlier lesson on matching constructed instructions to user intent.

Back to contents · Next section

11. Privacy and policy questions need their own analysis

Combining outputs in one transaction can reveal relationships that an observer may attempt to interpret. But a classroom example with supplied K ownership does not prove that every real multi-input transaction has one human owner. Collaborative constructions and service arrangements complicate attribution.

Similarly, identifying a likely change output can be an inference rather than an observable ownership fact. The worksheet explicitly labels change so the arithmetic is clear; a real analyst should not present an uncertain heuristic as verified identity.

Relay policies and fee estimation also differ from the core record model. A mathematically balanced candidate can still fail some relevant rule or policy. This article does not prescribe real fee rates, output sizes or transaction construction settings.

The lesson’s boundary is intentional: understand consumption, creation and conservation first, then study named-system policies and privacy assumptions separately. A simple example should not quietly become live transaction advice.

Back to contents · Next section

12. Six exercises with answers

  1. How many UTXOs make up K’s initial 16-credit aggregate? Three: alpha:0, beta:1 and gamma:0.
  2. Which records does the first transaction consume? alpha:0 and beta:1, totaling 12. Gamma:0 remains unselected.
  3. With recipient output 9 and fee difference 1, what change is required? Two, because 12−9−1=2.
  4. After the first transaction, what value remains under K’s supplied conditions? Six: gamma:0=4 plus first:1=2.
  5. Can the second transaction spend the “unused two credits inside alpha:0”? No. alpha:0 was consumed. The change exists as the new output first:1.
  6. If outputs total 13 while ordinary inputs total 12, can a correct signature make the candidate valid? No. It violates the model’s value-conservation condition.

For an extension, keep the first transaction’s inputs and recipient output but omit the change output. The output total is then 9, making the difference 3 rather than the intended 1. Under the abstract ordinary-input model, the omitted remainder does not automatically return to K. This demonstrates why change construction must be explicit; it is not a suggestion to build or submit such a transaction.

Back to contents · Next section

13. A compact UTXO review card

Record each selected outpoint, its value, its unspent status in the relevant pre-state and the evidence satisfying its spending condition. Check that no selected outpoint appears twice.

Then record each new output’s value and condition. Sum inputs and outputs, derive the fee difference and verify that the arrangement matches the intended recipient and change roles. Do not infer the latter from arithmetic alone.

Finally, distinguish the candidate calculation from accepted-state evidence. A signed draft, a broadcast acknowledgement and an observed accepted transaction are different artifacts. The UTXO set update belongs to the actual accepted-history context.

Back to contents · Next section

14. Frequently asked questions

Is change the same as the fee?

No. Change is a new output preserving value under the intended spending condition. The fee in the ordinary model is the difference between input and output totals.

Does spending an output reduce its stored value?

In this model, the selected output is consumed as a record. Any retained value is represented in a new output rather than editing the old one into a smaller remainder.

Does a wallet balance identify one output?

No. It can aggregate multiple outputs and may expose different balance categories. The transaction needs particular eligible input records.

Are all blockchains UTXO-based?

No. Other systems use account-based or other state models. The next lesson examines account counters without treating them as interchangeable with outpoint references.

Back to contents · Next section

Sources and next learning steps

Primary references checked on 12 October 2026, Singapore time: the Bitcoin transaction guide and transaction reference. Only the stated ordinary input-output, outpoint and fee-difference concepts are used. Historical script examples and policy lists are not presented as a complete current implementation guide.

All symbolic identifiers, integer credits and spending conditions are original teaching material. Next, compare account-based state and transaction nonces: how a per-account counter constrains an ordered sequence of instructions, and why it serves a different role from identifying a particular unspent output.

Back to contents