Transaction Inputs: The Anchor Guide to Unlocking Bitcoin Value
Transaction Inputs: The Anchor Guide to Unlocking Bitcoin Value
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.
-
The Problem: A single transaction can have dozens of outputs (e.g., payments to multiple people).
-
The Solution: To spend one specific output, you must provide the unique ID of the transaction (TXID) and the position of the coins in that transaction (VOUT).
-
Example: "I am spending the 2nd output (VOUT: 1) of transaction
abcd...123."
🛠️ ScriptSig: The Unlocking Key
This is the most critical part of the input. It is the "Proof of Ownership."
-
The Lock: The previous transaction's output (ScriptPubKey) contains a mathematical puzzle (e.g., "Only the owner of address $X$ can spend this").
-
The Key: Your input's ScriptSig provides the answer to that puzzle (the digital signature).
-
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.
-
Total Inputs: The sum of all UTXOs being spent.
-
Total Outputs: The sum of all new UTXOs being created.
-
The Fee: $\text{Total Inputs} - \text{Total Outputs} = \text{Miner Fee}$.
-
Note: The fee is never explicitly written in the transaction; it is the "leftover" change that any miner who confirms the block is entitled to claim.
🛡️ The Sequence Field: More than a Counter
The Sequence field (nSequence) has evolved significantly over Bitcoin's history.
-
Original Intent: Satoshi designed it for "High-Frequency Trades" (never fully implemented).
-
Modern Use (RBF): A sequence value less than
0xFFFFFFFF-1signals that a transaction is "Replaceable" by a higher-fee version (BIP 125). -
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:
-
Identify the four fields of a transaction input.
-
Define an "OutPoint" and explain why both TXID and VOUT are necessary.
-
Describe the relationship between an input's ScriptSig and an output's ScriptPubKey.
-
Calculate the transaction fee based on the difference between inputs and outputs.
-
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:
-
The OutPoint Deep Dive: Exploring the data alignment of TXID and Index.
-
ScriptSig Logic: How signatures and public keys are pushed onto the stack.
-
Legacy vs. SegWit Inputs: Why SegWit inputs look "empty" to old nodes.
-
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.
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: