pk.org: CS 419/Lecture Notes

Hash Pointers, Merkle Trees, Blockchains, and Bitcoin

Terms and concepts you should know

Paul Krzyzanowski – 2025-10-09

Cryptographic Background

Hash function
A deterministic function that maps data to a fixed-length digest with properties such as preimage resistance and collision resistance.
SHA-256
The 256-bit cryptographic hash function used throughout Bitcoin for hashing blocks, transactions, and keys.
Hash pointer
A reference to data that also stores the data's hash so any modification can be detected.
Merkle tree
A binary tree of hashes that summarizes a large dataset so membership can be verified with a small proof.
Merkle root
The single hash at the top of a Merkle tree that commits to all the data beneath it.
Merkle proof
The minimal set of sibling hashes needed to prove that a given item is included under a Merkle root.
Digital signature
A cryptographic proof that the transaction was authorized by the holder of the corresponding private key.
Public key
The key used by others to verify signatures, derived from the private key.
Private key
A secret 256-bit value used to create digital signatures that authorize spending.
Hashcash
An early proof-of-work system designed to make sending spam computationally expensive. Bitcoin adapts this concept for mining, requiring miners to find a hash below a target threshold to create a valid block.

Bitcoin Core Concepts

Double-spending problem
The challenge of preventing someone from spending the same digital coins twice, which Bitcoin solves through its distributed ledger and consensus mechanism.
Distributed ledger
A ledger maintained by tens of thousands of nodes around the world, each storing a complete, independent copy of the entire transaction history. This redundancy eliminates any single point of failure.
Consensus mechanism
The method by which all nodes in the network agree on the current state of the blockchain without requiring a central authority. Bitcoin uses Proof of Work as its consensus mechanism.

Bitcoin Ledger and Transactions

Transaction
A record that spends earlier outputs and creates new outputs to transfer value to recipients.
Input
A reference to a specific output of a previous transaction, accompanied by data proving the right to spend it.
Output
A record specifying a destination address and amount that can later be spent as an input.
Change output
An output that returns excess value back to the sender because inputs must be spent in full.
Transaction fee
The difference between total input value and total output value that is paid to the miner who includes the transaction in a block.
UTXO (Unspent Transaction Output)
A spendable output that has not yet been used as an input in another transaction. The current state of Bitcoin is the set of all UTXOs.
Satoshi
The smallest Bitcoin unit, where 1 BTC equals 100,000,000 satoshis.
Address
A compact, checksummed encoding of a public key hash that identifies who can spend an output.
Transaction ID (txid)
The hash of a serialized transaction that uniquely identifies it within the blockchain.

Blocks and Blockchain Structure

Blockchain
A chain of blocks linked by hash pointers that creates an append-only, tamper-evident history of transactions.
Block
A container of validated transactions plus a header that links it to the previous block.
Block header
The metadata of a block, including the previous block hash, Merkle root, timestamp, difficulty target, and nonce.
Previous block hash
The hash pointer that links a block to its predecessor in the chain.
Timestamp
An approximate creation time recorded in the block header.
Nonce
A number in the block header that miners vary in order to search for a valid hash under the target.
Fork
A temporary split in the blockchain when two miners find valid blocks at nearly the same time. The network resolves forks by following the longest chain.
Competing chains
Multiple valid versions of the blockchain that exist temporarily during a fork. Miners work on whichever block they received first, and the network converges on the longest chain.
Mempool
The set of valid, unconfirmed transactions that nodes hold before inclusion in a block.
Confirmations
The number of blocks added to the blockchain after a transaction's block. More confirmations mean greater certainty that the transaction is permanent, as it becomes harder to reverse.

Proof of Work and Mining

Mining
The process by which nodes collect valid transactions, bundle them into a block, and compete to add that block to the blockchain by solving a computational puzzle.
Proof of Work (PoW)
A consensus mechanism where miners expend computation to find a block hash below a target, making blocks costly to produce but easy to verify.
Target hash
The threshold value that a block's hash must fall below for the block to be accepted as valid. The lower the target, the harder it is to mine a block.
Difficulty Adjustment Algorithm
The algorithm that recalculates the target hash every 2016 blocks (roughly every two weeks) to keep the average block interval close to ten minutes, regardless of total mining power.
Chain selection rule
The rule by which nodes follow the chain with the most accumulated proof of work (the longest valid chain), resolving temporary forks.
Miner
A node that aggregates transactions into blocks and competes to publish the next block by performing proof of work.
Full node
A node that maintains the entire blockchain and verifies every transaction and block but does not perform mining.
Mining pool
A group of miners who combine hashing power and share rewards to reduce variance in earnings.
ASIC (Application-Specific Integrated Circuit)
Specialized hardware designed to compute SHA-256 hashes far more efficiently than general-purpose computers. Modern Bitcoin mining is dominated by ASICs.
Coinbase transaction
The special transaction in each block that creates new bitcoins and pays the miner their reward and fees.
Block reward
Newly minted bitcoins given to the miner of a valid block, in addition to collected transaction fees.
Halving
The event that reduces the block reward by half every 210,000 blocks, roughly every four years. This continues until approximately 21 million bitcoins have been created.
51% attack
A potential attack where an entity controlling a majority of the network's hashing power could rewrite recent history or censor transactions. The cost of such an attack makes it effectively infeasible on the Bitcoin network.