TeachMeBitcoin

How Nodes Validate Transactions

From TeachMeBitcoin, the free encyclopedia Reading time: 4 min

How Nodes Validate Transactions

Before a Bitcoin transaction can be included in a block, it must sit in a temporary queue called the mempool (memory pool). However, a node will not let just any transaction enter its mempool.

When your node receives a new transaction from a peer, it executes a battery of dozens of rigorous validation checks to ensure it conforms exactly to the consensus rules of the network. If a transaction fails even a single test, it is instantly rejected and discarded.

Here is the exact step-by-step verification process a node executes on every transaction.


The Node's Validation Checklist

 New Transaction
 │
 ▼
 [ 1. Syntax & Size Checks ] ─────► Fail ──► Reject
 │ Pass
 ▼
 [ 2. UTXO Database Check ] ─────► Fail ──► Reject
 │ Pass
 ▼
 [ 3. Locktime Validation ] ─────► Fail ──► Reject
 │ Pass
 ▼
 [ 4. Script & Signature ] ─────► Fail ──► Reject
 │ Pass
 ▼
 Added to Local Mempool

1. Syntactic and Structure Checks

Before doing any complex cryptography, the node performs cheap, fast structural checks:

2. UTXO and Double-Spend Checks

The node checks the transaction's inputs against its local UTXO set (the database of unspent transaction outputs):

3. Locktime and Sequence Validation

Bitcoin supports time-delayed transactions. The node checks:

4. Cryptographic Validation (The Script Interpreter)

This is the most CPU-intensive step. The node runs Bitcoin's virtual machine script interpreter to verify ownership:

5. Transaction Fee Verification

A transaction's fee is not written as a field in the transaction. Instead, it is calculated implicitly: $$\text{Fee} = \sum \text{Input Values} - \sum \text{Output Values}$$

The node checks:


️ Trustless Security

Because every node running on the network performs these exact same checks independently, cheating is impossible.

If a malicious actor tries to broadcast a fake transaction with a forged signature, the first node that hears it will run these tests, fail the transaction, and refuse to pass it along. The attack is stopped dead in its tracks before ever reaching a miner.

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