Markets III: Commodities, Energy and Crypto · Markets
14Blockchains for Traders
A trader sees a stablecoin priced at a discount on a decentralised venue and a premium on an exchange. She withdraws tokens from the exchange to capture the gap. The withdrawal waits in a queue, is broadcast, waits for a block, then for the confirmations the receiving venue requires; the transaction’s fee, bid in an auction she does not see, doubles while it waits. When the tokens arrive the gap has closed. Crypto markets settle on blockchains, and every property of a chain that an engineer might find abstract (how blocks are made, when they are final, what a transaction costs) is, for a trader, a latency, a cost or a risk. This chapter explains what a trader needs of the machinery: ledgers and consensus, finality, transactions and their fees, the mempool, the layered chains built on top, bridges between them, and stablecoins, the dollars of this market.
14.1 Ledgers, consensus and finality
Definition 14.1 (Blockchain, consensus protocol)
A blockchain is a ledger kept by many independent computers as a chain of blocks, each containing a batch of transactions and a cryptographic hash of the block before, so that changing any past block would change every later one. A consensus protocol is the rule by which those computers agree on which block extends the chain.
Definition 14.2 (Proof of work, proof of stake, validator)
Under proof of work the right to propose a block is won by solving a costly computational puzzle, and the chain with the most accumulated work is the valid one. Under proof of stake it is assigned among validators, participants who lock (stake) the chain’s native token as collateral that can be destroyed if they misbehave, and who propose and attest to blocks.
Definition 14.3 (Finality)
Finality is the point after which a transaction can no longer be reversed: probabilistic under proof of work, where each further block makes a reversal exponentially less likely; economic under proof-of-stake protocols that finalise checkpoints, where reversing one would destroy a large share of the stake.
For a trader, finality is a settlement cycle (One Quant Book 1, chapter 5) with a different shape. A venue credits a deposit only after a number of confirmations it chooses, trading off its own risk of a reversed deposit against its customers’ wait.
As of September 2026 — Block times and finality
Bitcoin targets one block every ten minutes; a common convention treats six confirmations, about an hour, as final. Ethereum moved from proof of work to proof of stake on 15 September 2022 (the Merge); time is divided into 12-second slots and 32-slot epochs, and a block is finalised after two epochs, about 12.8 minutes. Ethereum block 26 048 449, produced at 16:17 UTC on 24 September 2026, had a gas limit of 60 million, of which it used 22.1 million, at a base fee of 1.49 gwei.
14.2 Transactions, gas and the fee market
Definition 14.4 (Private key, token)
A private key is the secret number whose signature authorises transactions from an address; whoever holds it controls the address’s assets. A token is a transferable unit recorded by a blockchain: the chain’s native coin, or a unit whose balances a program on the chain keeps.
Definition 14.5 (Smart contract, oracle)
A smart contract is a program deployed on a blockchain whose code and state are public and whose functions anyone can call by sending a transaction; the chain executes it and records the result. An oracle is a mechanism that brings data from outside a chain (a price, an event’s outcome) into a smart contract.
Definition 14.6 (Gas, base fee, priority fee)
Gas is the unit in which Ethereum measures the computation and storage a transaction uses; each block has a gas limit. A transaction pays, per unit of gas, the block’s base fee, which is burned and set by protocol, plus a priority fee (a tip) that it chooses and that goes to the block’s proposer.
Proposition 14.7 (The base fee rule)
Under EIP-1559 a block’s gas target is half its limit, and the next block’s base fee is the parent’s multiplied by , where is the parent’s gas used and its target: at most after a full block and after an empty one. After full blocks the base fee is times its starting level.
Proof. This is the EIP’s update with (full) or (empty); iterate for blocks. The integer arithmetic of the protocol rounds each step down (and makes an increase at least one wei). ∎
Twenty full blocks, four minutes on Ethereum, multiply the base fee by 10.5: from 10 gwei to 105.45 gwei. A swap using 150 000 gas with a 2-gwei tip then costs $48.35 at an ether price of $3 000 (illustrative), against $5.40 before. Fees are what a trader’s latency is measured in when blocks are congested.
14.3 The mempool
Definition 14.8 (Mempool)
The mempool is the set of signed transactions that nodes have received and relayed but that are not yet in a block: public, in most chains, to anyone who runs a node.
A transaction in the public mempool is an order that everyone can see before it executes. That visibility is the root of the extraction of Chapter 22: a searcher who sees a large swap waiting can place its own transactions before and after it. It also means a trader’s transfer is visible to competitors, and that its inclusion depends on what others bid: the priority fee is an auction for position, and a transaction with too low a tip can wait for many blocks.
14.4 Base layers, rollups, sequencers and bridges
Base layers are slow and expensive because every node executes every transaction. Most activity has moved to chains built on top of them.
Definition 14.9 (Rollup, sequencer)
A rollup is a chain that executes transactions off the base layer and posts them, in compressed batches, to the base layer, which then guarantees their data and, through fraud or validity proofs, their correctness. Its sequencer is the operator that orders the rollup’s transactions and produces its blocks; on most rollups it is a single operator.
A single sequencer decides the order of transactions on its rollup, which is the same power, and the same temptation, as a block builder’s on the base layer; it also sees transactions before they are ordered. Rollup transactions are cheap and fast to include, but they are final on the base layer only when the batch is.
As of September 2026 — Who sequences the rollups
Of the 101 layer-2 projects in L2BEAT’s summary on 24 September 2026, 3 had a decentralised set of sequencers; for 67, a user could sequence his own transactions through the base layer if the sequencer failed, and for 21 there was no such mechanism.
Definition 14.10 (Bridge)
A bridge moves tokens between chains: it locks or burns them on one chain and releases or mints a corresponding token on the other, on the strength of a proof or of a set of signers that attest to the lock.
A bridge concentrates assets in one set of contracts and keys, which makes it the largest target in crypto. In March 2022 attackers who had obtained a majority of the signing keys of the Ronin bridge withdrew about $600 million of tokens; in April the US Treasury attributed the theft to a North Korean group.
14.5 Stablecoins: mint and redeem
Definition 14.11 (Stablecoin, depeg)
A stablecoin is a token designed to hold a fixed value against a currency, usually the dollar, most often by an issuer that holds reserves (cash, bills, repo) and mints tokens against deposits and burns them against redemptions. A depeg is a period in which the token trades away from its target value in the secondary market.
The peg is held by arbitrage between two markets. In the primary market, a few institutions deposit dollars with the issuer and receive tokens, or return tokens and receive dollars, at one for one. In the secondary market, everyone else trades tokens on exchanges. When the token trades below a dollar, an institution with primary access buys it and redeems it; when it trades above, it mints and sells. The peg is only as good as that arbitrage, which depends on the reserves being worth a dollar and on redemption being open.
As of September 2026 — Stablecoins
Total stablecoin supply was about USD 303 billion on 10 September 2026, of which USDT about USD 183 billion and USDC about USD 74 billion (aggregator figures). In March 2023 Circle could not withdraw USD 3.3 billion of USDC’s reserves, about 8% of them, from the failed Silicon Valley Bank; USDC traded as low as about 86 cents before the reserves were recovered and the peg restored. The Federal Reserve’s researchers note that most holders cannot redeem from the issuer and can only trade in secondary markets, and that issuance and redemption were constrained by banking hours.
14.6 Tutorial: the base fee and the cost of a transaction
Goal. Implement the base-fee rule in the protocol’s integer arithmetic, project it through full blocks and a demand shock, and cost a transaction. End state: Figure 14.1 and the numbers of the weekend problem.
The rule. Proposition 14.7 as the EIP writes it.
def next_base_fee(parent_base_fee: int, gas_used: int, gas_limit: int) -> int: """Base fee (wei) of the next block under EIP-1559.""" target = gas_limit // ELASTICITY if gas_used == target: return parent_base_fee if gas_used > target: delta = max(parent_base_fee * (gas_used - target) // target // DENOMINATOR, 1) return parent_base_fee + delta delta = parent_base_fee * (target - gas_used) // target // DENOMINATOR return parent_base_fee - delta def project(base_fee: int, usage: list[float], gas_limit: int) -> list[int]: """Base fees of the next blocks when each block uses the given fraction of its gas limit.""" out = [] for u in usage: base_fee = next_base_fee(base_fee, int(u * gas_limit), gas_limit) out.append(base_fee) return out def tx_cost_usd(gas: int, base_fee_gwei: float, priority_gwei: float, eth_usd: float) -> float: """Cost of a transaction: gas used times (base fee + priority fee), in dollars.""" return gas * (base_fee_gwei + priority_gwei) * 1e-9 * eth_usdListing 14.1. The EIP-1559 base fee, its projection and a transaction’s cost. code/firm/gasfee/firm_gasfee.py The shock. Demand for gas falls with the base fee; the fee rises until demand meets the target.
def demand_shock(blocks: int = 60, start: int = 5, end: int = 35, mult: float = 4.0, base_gwei: float = 10.0) -> list[tuple[int, float, float]]: """(block, base fee in gwei, share of the gas limit used). Demand for gas at base fee b is LIMIT * min(1, a / b), with a set so that demand equals the target at the starting base fee; from `start` to `end` demand is `mult` times higher.""" a0 = 0.5 * base_gwei b = int(base_gwei * GWEI) out = [] for n in range(blocks): a = a0 * (mult if start <= n < end else 1.0) share = min(1.0, a / (b / GWEI)) out.append((n, b / GWEI, share)) b = next_base_fee(b, int(share * LIMIT), LIMIT) return outListing 14.2. A demand shock under the base-fee rule. code/markets-3/14-blockchains-for-traders/python/m3_chain.py - Run
m3_chain.full_blocks(20),arbitrage_breakeven()andfig_chain.py.
What to change next. Make the shock’s demand more elastic and see how high the base fee goes; add a distribution of competitors’ tips and compute the tip that maximises an arbitrage’s expected profit.
14.7 Build: fees and confirmation times
Purpose. Every on-chain action of the miniature firm (a transfer between venues, a swap, a liquidation) must be costed and timed before it is sent: the fee component projects base fees and prices transactions; the confirmation model tells the transfer planner of Chapter 16 how long funds are in flight.
Interface. next_base_fee(parent_base_fee, gas_used, gas_limit) in wei; project(base_fee, usage, gas_limit); tx_cost_usd(gas, base_fee_gwei, priority_gwei, eth_usd); confirmation_seconds(chain, confirmations).
Rules. Integer wei arithmetic exactly as in the EIP (floor division, minimum increase of one wei); unknown chains are an error, never a default.
Acceptance tests. code/firm/gasfee/tests/: at full and empty blocks; unchanged at target; the one-wei minimum; twenty full blocks give ; confirmation times.
Stretch. Blob fees for rollup data; other chains’ fee markets; inclusion probability as a function of the tip from observed mempools.
Sources and further reading
- S. Nakamoto, Bitcoin: A Peer-to-Peer Electronic Cash System, 2008.
- V. Buterin et al., EIP-1559: Fee market change for ETH 1.0 chain; ethereum.org, proof-of-stake and The Merge documentation.
- Ethereum block 26 048 449 via a public JSON-RPC node; L2BEAT, scaling summary, 24 September 2026.
- Federal Reserve, FEDS Notes, “In the shadow of bank runs: lessons from the Silicon Valley Bank failure and its impact on stablecoins”, 17 December 2025.
- CoinDesk, “US officials tie North Korea’s Lazarus hackers to $625M Axie Infinity Ronin exploit”, 14 April 2022.
- Stablecoin supply: StablecoinBeat tracker, September 2026.
14.8 Exercises
Exercise 14.1 ★
The base fee is 20 gwei and the parent block used 75% of its limit. Give the next base fee.
Solution
Solution of Exercise 14.1.
gwei.
Exercise 14.2 ★
How long does a venue that requires six Bitcoin confirmations make a depositor wait, on average? And for an Ethereum deposit credited at finality?
Solution
Solution of Exercise 14.2.
About an hour (six blocks of ten minutes on average); about 12.8 minutes (two epochs) for Ethereum finality.
Exercise 14.3 ★
Why does a stablecoin’s peg depend on who may redeem it?
Solution
Solution of Exercise 14.3.
The peg is held by arbitrage between redemption at one dollar and the market price; only holders with primary access can do that arbitrage. If few can redeem, or redemption is closed (banking hours, a frozen reserve), the market price can fall below a dollar with nothing to pull it back.
Exercise 14.4 ★★
How many consecutive full blocks double the base fee? How many empty blocks halve it?
Solution
Solution of Exercise 14.4.
Full blocks: , so six more than double it (). Empty blocks: , so five leave 51% and six leave 45%.
Exercise 14.5 ★★
A swap uses 150 000 gas; the base fee is 30 gwei, the tip 2 gwei and ether $3 000. What does it cost?
Solution
Solution of Exercise 14.5.
.
Exercise 14.6 ★★
Explain why a rollup transaction can be cheap and fast and yet not final.
Solution
Solution of Exercise 14.6.
A rollup’s sequencer includes it at once and cheaply, but the base layer guarantees it only when the batch is posted and (for an optimistic rollup) its challenge period has passed, or (for a validity rollup) its proof is verified; until then the sequencer’s ordering could in principle be replaced.
Exercise 14.7 ★★★
Coding. With demand_shock, find the highest base fee reached and the block at which blocks first stop being full.
Exercise 14.8 ★★★
Find the flaw. “A stablecoin backed one for one by Treasury bills cannot lose its peg.”
Solution
Solution of Exercise 14.8.
The peg also needs redemption to work when holders want it: banking hours, a custodian failure (as at Silicon Valley Bank in 2023), a legal freeze or the issuer’s own solvency can stop redemptions, and secondary prices then fall regardless of what the reserves are worth.
14.9 Problem: The Gas Spike
Problem 14.1
Weekend problem — an arbitrage racing a congested chain
A searcher runs an arbitrage that earns $60 before gas, uses 150 000 gas and tips 2 gwei. The base fee is 10 gwei and ether costs $3 000 (illustrative). A popular token launch fills every block.
Part I — The fee.
- What does the arbitrage pay in gas now?
- What is the base fee after one full block, and after twenty?
- What does the arbitrage then pay in gas?
- How long do twenty blocks take?
- Who receives the base fee, and who the tip?
Part II — The break-even.
- At what base fee does the arbitrage stop paying?
- After how many full blocks is that reached?
- What if the arbitrage earned $120?
- Why might the searcher raise its tip during the spike?
- What happens to the base fee when the launch ends?
Part III — Alternatives.
- Would a rollup be cheaper, and what would the searcher give up?
- How does a private submission change the searcher’s competition?
- Why is the base fee burned rather than paid to the proposer?
- What does the spike do to users who are not arbitrageurs?
- What does the searcher learn from the mempool during the spike?
Part IV — Judgement.
- Is the fee market a good way to allocate block space?
- What does a trader moving funds between venues need from this chapter?
- Why do fees matter more for small arbitrages than large ones?
- State the named result: the base-fee multiplier after twenty full blocks, and the number of full blocks after which the arbitrage stops paying.
- In one sentence: what does a transaction’s fee buy?
Solution
Solution of Problem 14.1.
1. $5.40. 2. 11.25 gwei after one, 105.45 gwei after twenty. 3. $48.35. 4. About four minutes (twenty 12-second slots). 5. The base fee is burned; the tip goes to the block’s proposer. 6. gwei. 7. After 22 full blocks (). 8. The break-even rises to 264.67 gwei, reached after 28 full blocks. 9. Competition for inclusion: other searchers bid for the same opportunity, and the tip, not the base fee, decides the order. 10. It falls by up to 12.5% a block until demand meets the target. 11. Yes, but its fills are final only when batches settle, liquidity and opportunities differ, and its sequencer controls ordering. 12. It hides the transaction from other searchers until inclusion, at the cost of paying the builder rather than competing in the open mempool. 13. So that proposers cannot profit from inflating it, and to make fees predictable; burning also returns value to all holders. 14. Their transactions cost ten times more or wait. 15. Which transactions and contracts are competing, and the tips others pay. 16. It prices congestion transparently and predictably, but it allocates space to the highest payers, which in a spike are those with the most to extract. 17. How long transfers take to be final and what they cost in congestion, so that a cross-venue trade is priced with both. 18. Gas is a fixed cost per transaction, so it takes a larger share of a small profit. 19. Named result: twenty full blocks multiply the base fee by 10.5 (10 to 105.45 gwei); the $60 arbitrage stops paying after 22 full blocks. 20. Position and inclusion in a block.
14.10 Interview questions
Interview question 14.1 ★ trader
What does finality mean, and why does it matter for moving funds between exchanges?
Solution
Solution of Interview question 14.1.
The point after which a transaction cannot be reversed. A venue credits deposits only after it, so a transfer between exchanges is locked for that time and exposed to prices; a reversed deposit is a loss for the venue.
What the interviewer is looking for: settlement latency as inventory risk.
Interview question 14.2 ★ developer
Explain EIP-1559’s base fee and priority fee.
Solution
Solution of Interview question 14.2.
The base fee is set by protocol from the previous block’s gas used (up or down by at most 12.5%) and burned; the priority fee is chosen by the user and paid to the proposer to be included before others.
What the interviewer is looking for: the update rule, the burn, and the tip as the auction.
Interview question 14.3 ★★ researcher, trader
How does a reserve-backed stablecoin keep its peg, and how can it fail?
Solution
Solution of Interview question 14.3.
Primary-market arbitrage by institutions that mint and redeem at one dollar against secondary prices. It fails if reserves lose value or become inaccessible, if redemption is suspended or restricted, or if the issuer’s solvency or legal standing is doubted.
What the interviewer is looking for: mechanism plus the conditions it needs.
Interview question 14.4 ★★ risk
What are the risks of holding assets bridged from one chain to another?
Solution
Solution of Interview question 14.4.
The bridged token is a claim on assets locked in the bridge: smart-contract bugs, compromised signing keys, the bridge’s governance, and depegs between the bridged and the native token.
What the interviewer is looking for: the bridge as a concentrated custodian.
Interview question 14.5 ★★ developer
A deposit shows one confirmation. When should your system credit it, and what can go wrong?
Solution
Solution of Interview question 14.5.
Credit only after the chain’s finality (or a confirmation count set by the amount at risk and the chain’s reorg history); until then show it as pending. Risks: a reorganisation drops the transaction, a double spend, or a fork.
What the interviewer is looking for: risk-based confirmation policy.
Interview question 14.6 ★★★ developer, researcher
Design a fee estimator that tells a trading system what tip to pay to be included within two blocks with 95% probability.
Solution
Solution of Interview question 14.6.
Observe the mempool and recent blocks: the distribution of tips of included transactions by block, the pending queue and its tips, and the base fee path. Estimate, for each tip, the probability of inclusion in the next two blocks (base fee projected, competition from pending transactions and expected new arrivals), and choose the lowest tip above 95%; update each block and back-test against realised inclusions.
What the interviewer is looking for: data, a probabilistic model, and calibration against outcomes.