Transaction Outputs

9 min readarticleIncludes quiz · 5 questions

A transaction output is a locked box that can only be opened with the right key. When you send Bitcoin, you create an output locked to the recipient's public key. Only their private key can unlock it.

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!

Key Takeaway

Outputs define where Bitcoin goes. Each output specifies an amount and a condition (script) that must be satisfied to spend it. This is the foundation of Bitcoin's programmable money capabilities.

Test Your Knowledge

5 questions · Passing score: 75%

Enjoying these lessons?

Get a free Bitcoin lesson in your inbox every week. Join thousands of learners.

Free forever. No spam. Unsubscribe anytime.