TeachMeBitcoin

Transaction Inputs: The Anchor Guide to Unlocking Bitcoin Value

From TeachMeBitcoin, the free encyclopedia Reading time: 5 min

Transaction Inputs: The Anchor Guide to Unlocking Bitcoin Value

IMPORTANT

Executive Summary: A Transaction Input is the data structure that authorizes the movement of bitcoin. In Bitcoin's UTXO model, you do not "send" from a balance; you reference a specific chunk of bitcoin from a previous transaction and provide the cryptographic proof (the signature) required to unlock it. Every input acts as a "Key" that must perfectly match the "Lock" (Output) of a previous transaction for the spend to be valid.


🔍 Why This Module Matters

To understand a Bitcoin transaction, you must understand where the money is coming from. Inputs are the "History" of the transaction. They link the current spend to the past, proving that the sender has the right to move the funds. This module will deconstruct the four mandatory fields of a transaction input—TXID, VOUT, ScriptSig, and Sequence—explaining how they create the "Chain of Ownership" that makes Bitcoin a secure and audit-able ledger.


🏛️ The Input Schema: A Technical Breakdown

A Bitcoin transaction can have one or many inputs. Each individual input follows a rigid 4-field structure.

Field Size Technical Name Description
Prev TXID 32 Bytes hash The double-SHA256 hash of the transaction providing the funds.
VOUT 4 Bytes n The index (0, 1, 2...) of the specific output being spent.
ScriptSig VarLen scriptSig The "Unlocking Script" (Signature + Public Key).
Sequence 4 Bytes nSequence Used for RBF, timelocks, and signaling.

⚙️ The "OutPoint": Pointing to the Past

The combination of the TXID and the VOUT index is known as the OutPoint.


🛠️ ScriptSig: The Unlocking Key

This is the most critical part of the input. It is the "Proof of Ownership."

  1. The Lock: The previous transaction's output (ScriptPubKey) contains a mathematical puzzle (e.g., "Only the owner of address $X$ can spend this").

  2. The Key: Your input's ScriptSig provides the answer to that puzzle (the digital signature).

  3. The Verification: When a node validates the transaction, it "pushes" the ScriptSig onto a stack and executes the ScriptPubKey. If the result is TRUE, the coins are unlocked.

graph TD
 subgraph Previous_TX
 A[Output 0]
 B[Output 1: Lock]
 end
 subgraph Current_TX
 C[Input 0: Key] --> B
 D[Output 0: New Lock]
 end
 C -- "Matches?" --> E{Validation}
 E -- YES --> F[Transaction Confirmed]
 E -- NO --> G[Transaction Rejected]

⚖️ The Flow of Value: Inputs vs. Outputs

Bitcoin transactions must always satisfy the Conservation of Value.


🛡️ The Sequence Field: More than a Counter

The Sequence field (nSequence) has evolved significantly over Bitcoin's history.

  1. Original Intent: Satoshi designed it for "High-Frequency Trades" (never fully implemented).

  2. Modern Use (RBF): A sequence value less than 0xFFFFFFFF-1 signals that a transaction is "Replaceable" by a higher-fee version (BIP 125).

  3. Relative Timelocks: It is used to lock funds until a certain number of blocks have passed since the original transaction (BIP 68).


🎯 Learning Objectives for this Module

By the end of this module, you will be able to:

  1. Identify the four fields of a transaction input.

  2. Define an "OutPoint" and explain why both TXID and VOUT are necessary.

  3. Describe the relationship between an input's ScriptSig and an output's ScriptPubKey.

  4. Calculate the transaction fee based on the difference between inputs and outputs.

  5. Explain the role of the Sequence field in modern Bitcoin (RBF and Timelocks).


🗺️ Module Roadmap: What's Next?

Now that we've unlocked the past, we will look at how inputs are processed:

  1. The OutPoint Deep Dive: Exploring the data alignment of TXID and Index.

  2. ScriptSig Logic: How signatures and public keys are pushed onto the stack.

  3. Legacy vs. SegWit Inputs: Why SegWit inputs look "empty" to old nodes.

  4. Python Input Decoder: Writing a script to extract spend-source data from a hex transaction.


🎓 Summary

Transaction inputs are the "Authorization" layer of the Bitcoin network. They provide the cryptographic bridge between the coins of the past and the payments of the future. By mastering the structure and logic of inputs, you are understanding the very essence of the UTXO model—a system of moving value through mathematical proof rather than central accounts.

☕ Help support TeachMeBitcoin

TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation:

Ethereum: 0x578417C51783663D8A6A811B3544E1f779D39A85
Bitcoin: bc1q77k9e95rn669kpzyjr8ke9w95zhk7pa5s63qzz
Solana: 4ycT2ayqeMucixj3wS8Ay8Tq9NRDYRPKYbj3UGESyQ4J
Address copied to clipboard!