Transaction Outputs

9 min readarticleIncludes quiz · 5 questions

Transaction outputs are where Bitcoin goes—the destination addresses and amounts. Each output creates a new UTXO that can be spent later. Outputs are locked with scripts that define who can spend them and under what conditions.

What is a Transaction Output?

  • Definition: A destination address (or script) and the amount of Bitcoin being sent there.
  • Components: Value (in satoshis), locking script (scriptPubKey).
  • Creates UTXOs: Each output becomes a new UTXO for the recipient.
  • Multiple outputs: Most transactions have at least 2 outputs (payment + change).
  • Locked: Outputs are locked to specific spending conditions (usually an address).
Transaction Output Structure
Transaction Output Structure

Key Definitions:

  • Output: A pair of (amount, locking script) that defines where Bitcoin goes.
  • Value: Amount of Bitcoin in satoshis (1 BTC = 100,000,000 sats).
  • scriptPubKey: The locking script that defines spending conditions.
  • Change output: An output back to yourself with leftover funds.
  • OP_RETURN: A special output type for storing data (not spendable Bitcoin).
  • Dust limit: Minimum output size (typically 546 satoshis) to prevent spam.

Output Structure:

``` Output: Value: 50000000 (0.5 BTC in satoshis) scriptPubKey: OP_DUP OP_HASH160 <address hash> OP_EQUALVERIFY OP_CHECKSIG ```

This says: "0.5 BTC is locked to this address. To spend it, provide a signature from the matching private key."

Typical Transaction with 2 Outputs:

Alice sends 0.3 BTC to Bob

Inputs:

  • Alice's UTXO: 0.5 BTC (must spend all)

Outputs:

  • Output 0: 0.3 BTC → Bob's address (payment)
  • Output 1: 0.1999 BTC → Alice's change address (change)

Fee: 0.5 - 0.3 - 0.1999 = 0.0001 BTC

Alice's old 0.5 BTC UTXO is consumed. Bob gets a new 0.3 BTC UTXO. Alice gets a new 0.1999 BTC UTXO.

Input to Output Flow
Input to Output Flow

Output Types:

P2PKH (Pay-to-Public-Key-Hash) - Legacy

  • Locks to a Bitcoin address (1...)
  • Most common traditional format
  • scriptPubKey: OP_DUP OP_HASH160 <pubkey hash> OP_EQUALVERIFY OP_CHECKSIG

P2SH (Pay-to-Script-Hash)

  • Locks to a script hash (3...)
  • Used for multisig and wrapped SegWit
  • scriptPubKey: OP_HASH160 <script hash> OP_EQUAL

P2WPKH (SegWit native)

  • Locks to witness public key hash (bc1q...)
  • Lower fees, malleability fix
  • scriptPubKey: OP_0 <pubkey hash>

P2TR (Taproot)

  • Locks to Taproot output (bc1p...)
  • Best privacy and flexibility
  • scriptPubKey: OP_1 <32-byte key>

OP_RETURN (Data storage)

  • Stores up to 80 bytes of data
  • Not spendable—burned Bitcoin
  • Used for timestamps, proofs, metadata

Output Ordering:

  • Outputs are indexed starting from 0
  • Order matters when referencing them as inputs later
  • Some wallets randomize output order for privacy
  • Change output position shouldn't be predictable

Example: Output 0: 0.3 BTC → Bob Output 1: 0.1999 BTC → Alice (change)

Later, Alice spends her change by referencing this transaction's output #1.

The Equation:

Sum(Inputs) = Sum(Outputs) + Fee

  • Inputs: All UTXOs being spent
  • Outputs: All new UTXOs being created (including change)
  • Fee: The difference (goes to miner)

Example: Inputs: 0.5 BTC Outputs: 0.3 + 0.1999 = 0.4999 BTC Fee: 0.5 - 0.4999 = 0.0001 BTC

If outputs exceed inputs, transaction is invalid. If you forget change, the excess becomes a fee!

Test Your Knowledge

This lesson includes a 5-question quiz (passing score: 75%).

Quiz functionality available in the mobile app.