Block Assembly
Lesson, slides, and applied problem sets.
View SlidesLesson
Block Assembly & Mempool Policy
Why this module exists
Mining is not just hashing; it is also economic selection. The block you mine determines your fees and influences mempool dynamics.
1) Fee rate
The canonical heuristic is fee per byte:
feerate = fee / size
Higher feerate transactions get prioritized.
2) Dependencies
A transaction may spend outputs of another mempool transaction. Selection must ensure inputs are available at inclusion time.
3) Size limits
A block has a size budget. Adding a tx may exclude others. This is a knapsack-like problem; we use a greedy heuristic here.
4) Coinbase output
Coinbase mints subsidy + fees. It anchors the miner's reward.
What you will build
- Greedy mempool selection by fee rate
- Input-availability checks
- Coinbase reward calculation
Key takeaways
- Block assembly is an optimization problem.
- Dependencies require careful ordering.
- Fee policy influences network behavior.