Examples#

Runnable experiments for every subpackage, built from the scripts under examples/<name>/. Each one includes assertions, a figure, a “What to look for” guide, and an exercise. Download any of them as a Python script or a Jupyter notebook, or run it in the browser with JupyterLite. The guided A guided course: from fingerprints to shared history gives a learning order across subpackages.

Cryptography

blockchainkit.crypto

Hashing and commitments, Diffie-Hellman and RSA, blind signatures, secret sharing, elliptic curves, and Schnorr proofs and signatures.

Examples
blockchainkit.proofs

Zero-knowledge and succinct proofs: sum-check and PCPs, KZG, Groth16 and PLONK with their trusted setups, Zerocash, and transparent Bulletproofs, FRI, STARKs and Halo.

Examples
blockchainkit.privacy

Anonymity on public ledgers: mix-nets and Tor, ring signatures and stealth addresses, address clustering, CoinJoin and mixers, and hidden amounts from confidential transactions to Mimblewimble.

Examples

Ledgers

blockchainkit.structures

Merkle trees and proofs, signed transfers, blocks, ledger state, and cumulative-work fork selection.

Examples
blockchainkit.wallets

Keys as users hold them: check digits, Base58Check and Bech32 addresses, PBKDF2 and scrypt, brain wallets, HD keys and seed phrases, multisig and threshold ECDSA, social recovery, and ERC-4337 accounts.

Examples

Agreement

blockchainkit.consensus

Proof-of-work search and its expected cost, catch-up probabilities, and stake-weighted proposer selection.

Examples
blockchainkit.network

Peer graphs, logical clocks, gossip and reliable broadcast, Kademlia and its attacks, block relay, forks, and transaction privacy.

Examples

Execution

blockchainkit.vm

A deterministic 256-bit stack machine with gas and atomic failure, Turing machines, Bitcoin Script, and smart contracts and their attacks.

Examples
blockchainkit.contracts

A world-state model of contracts calling contracts: token standards, wallets, proxies and their famous failures, with Hoare logic, symbolic execution and fuzzing.

Examples

Economics

blockchainkit.economics

Incentives, fees and markets: auctions, block rewards and mining games, EIP-1559, stablecoins and market makers, and the value of transaction ordering.

Examples
blockchainkit.fraud

Ponzi schemes, Benford’s law, proofs of reserves and solvency, honeypots and rug pulls, pump-and-dumps, wash trading, and phishing.

Examples

Scaling

blockchainkit.channels

Layer 2 and interoperability: payment channels from Spilman to Lightning and eltoo, atomic swaps and bridges, Plasma, sharding, rollups, and data-availability sampling.

Examples