How to Verify a Bitcoin Transaction
Understand the cryptographic proof system that makes Bitcoin transactions trustless and verifiable.
What Does "Verify" Mean?
Verifying a Bitcoin transaction means cryptographically proving that:
- 1.The transaction was signed by the owner of the sending address
- 2.The transaction is included in a valid block
- 3.The block is part of the longest chain (most proof-of-work)
- 4.The sender had sufficient funds (no double-spending)
Bitcoin's security model is "don't trust, verify." You don't need to trust exchanges, wallets, or block explorers. You can independently verify every transaction using only mathematics and the blockchain data.
Transaction Structure
A Bitcoin transaction contains inputs (where coins come from) and outputs (where coins go). Each input references a previous transaction output and includes a cryptographic signature.
Transaction ID: 3a7d... Version: 2 Inputs: - Previous TX: 8f2c... (output #0) - Signature: 304502... - Public Key: 0279... Outputs: - Amount: 0.5 BTC - Script: OP_DUP OP_HASH160 ... Locktime: 0 Step 1: Verify the Transaction ID
The transaction ID (TXID) is the double SHA-256 hash of the transaction data. This proves the transaction hasn't been modified.
1. Serialize transaction (version + inputs + outputs + locktime) 2. Hash with SHA-256 3. Hash again with SHA-256 (double SHA-256) 4. Reverse byte order (little-endian to big-endian) 5. Result is the TXID Example Calculation
0200000001f9d... 8c7a3b2... 3a7d9f1... 1f9d7a3... Step 2: Verify the Digital Signature
Each input must be signed by the private key corresponding to the address that received the coins. This proves the sender owns the coins.
- 1.Extract signature and public key from the input script
- 2.Reconstruct the signed message: Transaction data with the input script replaced by the previous output script
- 3.Hash the message with double SHA-256
- 4.Verify the signature using ECDSA (secp256k1 curve)
- 5.Verify the public key hashes to the address in the previous output
ECDSA Verification
Bitcoin uses the secp256k1 elliptic curve for signatures. The verification algorithm checks that:
R = (s^-1 * H(m) * G) + (s^-1 * r * P) Step 3: Verify Block Inclusion
To confirm a transaction is in the blockchain, verify it's included in a valid block using a Merkle proof.
- 1.Start with your TXID
- 2.Get the Merkle path (sibling hashes from transaction to root)
- 3.Compute the Merkle root: Repeatedly hash your hash with each sibling
- 4.Compare with block header: If roots match, transaction is in the block
Merkle Tree Example
Root
/ \\
H(AB) H(CD)
/ \\ / \\
TxA TxB TxC TxD
To prove TxB is in the block, you only need: TxA, H(CD), and the root. This is much smaller than downloading all transactions.
Step 4: Verify Proof of Work
Verify the block header hash meets the difficulty target, proving computational work was performed.
- 1.Serialize block header (80 bytes: version, prev hash, merkle root, timestamp, bits, nonce)
- 2.Double SHA-256 hash the header
- 3.Verify hash < target: The hash must be below the difficulty target
- 4.Verify previous block hash: Links to the previous block
Example Block Hash
00000000000000000002a7c4c1e48d76c5a37902165a270156b7a8d72728a054 Notice the leading zeros-this hash is below the difficulty target, proving the miner performed approximately 2^70 hash operations to find this nonce.
Step 5: Verify Chain Validity
Verify the block is part of the longest chain (most cumulative proof-of-work), not an orphaned block.
- 1.Check block depth: How many blocks have been built on top?
- 2.Verify chain continuity: Each block references the previous block's hash
- 3.Compare chain work: Ensure this chain has more cumulative work than alternatives
- 4.Wait for confirmations: More blocks = higher security (6 confirmations is standard)
Each additional block makes reversing a transaction exponentially harder:
- -1 confirmation: ~10 minutes, reversible with 51% attack
- -3 confirmations: ~30 minutes, very difficult to reverse
- -6 confirmations: ~1 hour, considered irreversible for most purposes
Step 6: Verify No Double-Spending
Ensure the transaction inputs haven't been spent in another transaction.
- 1.Check UTXO set: Verify the input references an unspent output
- 2.Verify amounts: Input amounts ≥ output amounts + fees
- 3.Check for conflicts: No other confirmed transaction spends the same input
Practical Verification Tools
Bitcoin Core (Full Node)
Download and verify the entire blockchain. This is the most trustless method-you verify every transaction and block yourself.
bitcoin-cli getrawtransaction [txid] true SPV Wallets (Simplified Payment Verification)
Download only block headers and use Merkle proofs to verify transactions. Much lighter than full nodes but still cryptographically secure.
Block Explorers (Trust Required)
Websites like blockchain.com or blockchair.com show transaction data. Convenient but requires trusting the explorer. Always verify important transactions with your own node.
Try It Yourself
Use our Blockchain Explorer to examine real Bitcoin transactions and see the hash-based verification in action.
- 1.Find a recent Bitcoin transaction on a block explorer
- 2.Copy the raw transaction hex
- 3.Hash it with double SHA-256 using our Hash Calculator
- 4.Reverse the bytes and verify it matches the TXID
- 5.Examine the block header and verify the proof-of-work
The Bottom Line
Bitcoin's verification system is entirely based on hash functions and digital signatures. No trusted third party is required-anyone can independently verify any transaction using only mathematics and publicly available blockchain data. This is what makes Bitcoin "trustless" and censorship-resistant.
Official Resources
Bitcoin Protocol Documentation
- → Bitcoin Developer Guide: Transactions (Bitcoin.org)
- → Bitcoin Developer Guide: Block Chain (Bitcoin.org)
- → BIP 141: Segregated Witness (Bitcoin)
Cryptographic Verification
- → FIPS 180-4: SHA-256 Standard (NIST)
- → SEC 1: Elliptic Curve Cryptography (SECG)
- → RFC 6979: Deterministic ECDSA (IETF)
Implementation & Tools
- → Bitcoin Core Repository (Bitcoin)
- → Bitcoin Wiki: Protocol Documentation (Bitcoin Wiki)