Exercises#

Every gallery example ends with an exercise. These pages collect worked solutions for a selection of them, one page per subpackage. Each solution sits in a collapsed box, so you can try the problem first, and its code is run by every documentation build.

Cryptography

Discrete logs, factoring, forged shares, curve identities, nonce reuse, and birthday collisions.

Exercises: cryptography
Ledgers and data structures

Merkle proofs and duplicated leaves, mountain ranges, Bloom-filter privacy, hash chains, and replayed payments.

Exercises: ledgers and data structures
Consensus

Byzantine rounds, Ben-Or, mining statistics, confirmations, quorums, stake splitting, and accountable safety.

Exercises: consensus
Networking

Lossy links, logical clocks, gossip on a ring, Bracha quorums, the connectivity threshold, eclipses, and short IDs.

Exercises: networking
Execution

RPN, stack depth, Forth words, busy beavers, atomicity, overflow checks, and gas prices.

Exercises: execution
Contracts

Weakest preconditions, overflow search in bytecode, approval races, gas limits, last revealers, and proxy collisions.

Exercises: contracts
Economics

Large focal-point games, posted prices, the halving’s rounding, doubling the base fee, liquidation gaps, and split trades against sandwiches.

Exercises: economics
Channels and scaling

Erasures with errors, invalidation trees, the last chance to punish, shard counts, validium gas, and challenge windows.

Exercises: channels
Proof systems

Repeated identity tests, who evaluates in sum-check, PCP sizes, two-point KZG openings, squaring circuits, Zerocash’s range check, and any range.

Exercises: proof systems
Fraud

A skimming Ponzi operator, multiples of seven, a fake negative balance, a shared reserve address, window dressing, and the cost of a look-alike.

Exercises: fraud
Privacy

Quiet mixes, entry guards, intersecting rings, view keys, l-diversity, CoinJoin change, waiting at a mixer, and splitting a Mimblewimble block.

Exercises: privacy
Wallets

Three-error codes, Luhn’s blind spot, deleting a q, scrypt’s partial tables, 24-word phrases, the gap limit, multisig sizes, and guardians.

Exercises: wallets