Transaction Inputs
Every Bitcoin you spend must come from somewhere — a specific previous transaction where you received it. These references back to previous transactions are called inputs, and they form an unbroken chain all the way back to the coinbase transaction that originally mined those coins.
What is a Transaction Input?
- •Definition: A reference to a previous unspent output (UTXO) that you're spending.
- •Components: Previous transaction ID, output index, signature script (unlocking script).
- •Proof of ownership: Contains your digital signature proving you own the private key.
- •Multiple inputs: Transactions can have many inputs to combine smaller amounts.
- •Must be unspent: You can only spend UTXOs that haven't been spent yet (no double-spending).
Key Definitions:
- •Outpoint: The reference to a previous output (txid + index).
- •Previous txid: The transaction ID where the UTXO was created.
- •Output index (vout): Which output of that transaction (outputs are numbered starting from 0).
- •scriptSig: The unlocking script containing your signature and public key.
- •Witness: In SegWit transactions, signature data moved here (separate from base transaction).
- •Sequence: A field for advanced features like Replace-By-Fee and timelocks.
Input Structure:
``` Input: Previous tx: 7f8a9b3c... (txid) Output index: 0 scriptSig: <signature> <public key> Sequence: 0xffffffff ```
This says: "I'm spending output #0 from transaction 7f8a9b3c..., and here's my signature to prove it."
How Inputs Are Validated:
1. Check UTXO exists: Node looks up the previous transaction and output index. 2. Verify unspent: Ensure this UTXO hasn't been spent already. 3. Check signature: Verify the signature matches the public key and transaction data. 4. Match public key: Confirm the public key hashes to the address that locked the UTXO. 5. Sum values: Ensure total inputs ≥ total outputs + fee.
Coin Selection (How Wallets Choose Inputs):
Strategies:
Input Locking Scripts:
UTXOs are locked with scripts that define spending conditions:
Inputs must provide the correct "key" (scriptSig or witness) to unlock each type.
Inputs reference previous outputs. This chain of references is how Bitcoin proves ownership without a central authority. Every coin can be traced back to the block where it was mined.
Test Your Knowledge
4 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.