TeachMeBitcoin

Referencing Spendability

From TeachMeBitcoin, the free encyclopedia Reading time: 2 min

Referencing Spendability

When a Bitcoin node receives a transaction, it must verify that the inputs are valid. It uses the TXID and VOUT to perform a lookup in its local database.

1. The Lookup Process

The node does not search the entire blockchain to verify an input. Instead, it looks in the Chainstate (UTXO Set).

  1. The node takes the TXID and VOUT from the incoming input.

  2. It queries the UTXO Set to see if that OutPoint exists.

  3. If it doesn't exist, the transaction is rejected (either the money doesn't exist or it has already been spent).

2. Retrieving the "Lock"

If the OutPoint exists, the database returns two crucial pieces of information:

3. Verification Logic

Once the node has the ScriptPubKey (the lock) from the database and the ScriptSig (the key) from the input, it executes them together in the Bitcoin Script Virtual Machine.

4. Why TXIDs Must Be Unique

If two different transactions had the same TXID (a collision), the UTXO Set would become corrupted.

Data Source Content Purpose
Input Hex TXID + VOUT The "Search Query"
UTXO Set ScriptPubKey + Amount The "Verification Target"
Input Hex ScriptSig / Witness The "Proof of Ownership"

In the final section, we will build a Python OutPoint Parser to extract these details from raw hex data.

☕ 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!