You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
blockchainkit.contracts, a sixth subpackage on designing, breaking and
verifying smart contracts, with a history page of 17 breakthroughs, each
with its own gallery example, from Floyd and Hoare (1967-1969) to
Beanstalk's flash-loan governance attack (2022), and an exercise page.
New APIs: the world-state model World and Contract (call, delegatecall, send, CREATE and CREATE2, events, selfdestruct, gas,
per-call rollback, invariants) with create_address and create2_address; weakest_precondition, check_triple and run_program; symbolic_execute, symbolic_bytecode (for vm
programs) and solve; requires and ensures; fuzz and shrink;
Ricardian contracts; Mint and Purse; ERC-20 and ERC-721 tokens; King
of the Ether, GovernMental, block-hash and commit-reveal lotteries; the
Parity wallet libraries; naive and EIP-1967 proxies; a CREATE2 factory;
and flash-loan governance. Plots: plot_call_tree, plot_symbolic_paths and plot_storage.
blockchainkit.economics, a seventh subpackage on incentives, fees and
markets, with a history page of 16 breakthroughs, each with its own
gallery example, from Schelling's focal points (1960) to proposer-builder
separation (2022), and an exercise page. New APIs: coordination_probability
and schelling_round; first- and second-price auctions, virtual values,
equilibrium bids and expected revenue; the logarithmic market scoring
rule; block_subsidy, issued_supply and double_spend_incentive; simulate_block_rewards, mining_gap and undercutting_payoffs; optimal_mining_revenue and honest_mining_is_equilibrium; next_base_fee and simulate_fee_market; amount_out, impermanent_loss and the ConstantProductPool contract; Dai's VaultEngine with Stablecoin and PriceFeed; the OracleLender and OracleAttacker contracts; priority_gas_auction, sandwich_profit and sandwich_attack; and simulate_pbs. Plots: plot_fee_market, plot_constant_product and plot_gas_auction. The model boundaries page
gains an "Economic models" section.
blockchainkit.channels, an eighth subpackage on layer-2 scaling and
interoperability, with a history page of 16 breakthroughs, each with its
own gallery example, from Reed-Solomon codes (1960) to the Ronin and
Wormhole bridge exploits (2022), and an exercise page. New APIs: rs_encode, rs_recover and rs_decode (Berlekamp-Welch); SpilmanChannel, DuplexChannel with invalidation_locktimes, LightningChannel (revocation keys, shachain secrets, penalties), EltooChannel, and the StateChannel and PreimageManager contracts,
all with Script outputs checked by vm.verify_script; Watchtower, make_appointment and PISA's tower_liable; ChannelNetwork for
multi-hop HTLC routing and probe_balance; AtomicSwap; the BTCRelay
contract and mine_header; ValidatorBridge, GuardianVerifier and WormholeBridge; PlasmaChain with Plasma Cash exits; shard_failure_probability and atomix_transfer; ZKRollup, OptimisticRollup and bisect; and extend, simulate_sampling and
encoding fraud proofs for data availability. Plots: plot_shares, plot_route and plot_detection. The model boundaries page gains a
"Channels, rollups and bridges" section.
blockchainkit.proofs, a ninth subpackage on zero-knowledge and succinct
proof systems, with a history page of 16 breakthroughs, each with its own
gallery example, from the Schwartz-Zippel lemma (1980) to Halo (2019),
and an exercise page. New APIs: polynomial arithmetic, interpolation and
the FFT over the BabyBear field (FIELD_PRIME) and a Fiat-Shamir Transcript; identity_test; sumcheck and multilinear_extension; tqbf_protocol; hadamard_proof and pcp_verify; kilian_argument, micali_proof and verify_cs_proof; a toy supersingular PAIRING_CURVE with the Tate pairing; KZG (trusted_setup, kzg_commit, kzg_open, kzg_verify, forge_opening); powers-of-tau
ceremonies (contribute, verify_contribution); the R1CS builder Circuit, r1cs_to_qap and qap_divide; Groth16; MiMC and a Zerocash ShieldedPool with prove_spend; PlonkCircuit and PLONK with permutation_product; Bulletproofs range_proof; fri_prove and fri_verify; a Fibonacci stark_prove; and Halo's ipa_open, ipa_defer, accumulate and decide. Plots: plot_field_polynomials, plot_proof_sizes and plot_copy_constraints. The model boundaries page
gains a "Proof systems" section, and blockchainkit.constants the TRANSCRIPT_DOMAIN, IPA_GENERATOR_DOMAIN and MIMC_DOMAIN tags.
blockchainkit.fraud, a tenth subpackage on financial fraud on and
around blockchains, with a history page of 17 breakthroughs, each with its
own gallery example, from Ponzi's scheme (1920) to address poisoning
(2022-2023), and an exercise page. New APIs: simulate_ponzi, breakeven_growth, simulate_lending_ponzi and referral_commissions;
the ChainPonzi contract with value_flows and ponzi_features; benford_test; the MerkleSumTree with verify_sum_proof, liability_tree, audit and reserve_ratio; Provisions-style proofs of
solvency (SolvencyProver, verify_solvency, OR proofs and bitwise
range proofs over Pedersen commitments); reissue_missing and the Custodian contract; verify_source and effective_code; the TokenSale (DAICO) contract; seven Torres et al. honeypot contracts with explorer_view; SellBlockToken, HiddenMintToken and sell_test; simulate_bot_market, return_by_activity, simulate_pump_and_dump
and detect_pumps; find_wash_trades and simulate_nft_market; the Drainer contract with open_approvals and allowance_exposure; and grind_lookalike and poisoning_suspects. Plots: plot_ponzi, plot_benford and plot_price_spikes. The model boundaries page gains
a "Fraud models" section, and blockchainkit.constants the SUM_LEAF_DOMAIN, SUM_NODE_DOMAIN, SOLVENCY_DOMAIN and LOOKALIKE_DOMAIN tags.
blockchainkit.privacy, an eleventh subpackage on anonymity and
confidentiality on public ledgers, with a history page of 15
breakthroughs, each with its own gallery example, from Chaum's mix-nets
(1981) to Tornado Cash (2019), and an exercise page. New APIs: MixNode, seal, wrap and mix_cascade; circuit_compromise_rate, simulate_flows and match_flows; k_anonymity, equivalence_classes
and effective_anonymity_set; ring_sign and ring_verify; lsag_sign, mlsag_sign, key_image and linked; simulate_payments, cluster_addresses and score_clusters; stealth_keys, stealth_payment, owns_output and one_time_secret; coinjoin and link_change; the RSA accumulator, ZerocoinPool and prove_zerocoin_spend; ring-signature range proofs and verify_confidential; ringct_spend and verify_ringct; mimblewimble_transaction, aggregate and cut_through; the TumbleBit Tumbler with run_tumbler; simulate_rings, chain_reaction and trace_rings; and the Mixer contract with prove_withdrawal and mixer_report, proving with the Zerocash circuit of proofs. Plots: plot_cluster_sizes, plot_ring_positions and plot_anonymity_sets.
The model boundaries page gains a "Privacy models" section, and blockchainkit.constants the MIX_DOMAIN, RING_DOMAIN, KEY_IMAGE_DOMAIN, STEALTH_DOMAIN, KERNEL_DOMAIN, ACCUMULATOR_DOMAIN and TUMBLER_DOMAIN tags.
blockchainkit.wallets, a twelfth subpackage on keys as users actually
hold them, with a history page of 15 breakthroughs, each with its own
gallery example, from BCH codes (1959-1960) to ERC-4337 account
abstraction (2021), and an exercise page. New APIs: BCHCode and minimal_polynomial; verhoeff_digit, luhn_digit and detection_rates; pbkdf2 and crack_pin; scrypt, salsa20_8, block_mix and romix with a memory-time trade-off; Base58Check, p2pkh_address and is_valid_address; bech32_encode, bech32_decode, segwit_encode, segwit_decode and p2wpkh_address
for Bech32 and Bech32m; serialize_script, multisig_redeem_script
and verify_p2sh; BIP32's master_key, derive_private, derive_public, serialize_extended_key and recover_parent_private;
BIP39's entropy_to_mnemonic and mnemonic_to_seed; BIP44's derive_path and discover_accounts; brain_wallet_key and simulate_brain_drain; ecdsa_sign and ecdsa_verify; threshold_keygen and threshold_sign; the SocialRecoveryWallet
contract with recovery_risk; and ERC-4337's EntryPoint, SmartAccount and bundle. Utilities: RIPEMD-160 and hash160,
compressed secp256k1 keys, and GF(2**m). Plots: plot_detection_rates, plot_memory_tradeoff and plot_recovery_risk.
The model boundaries page gains a "Wallet models" section, and blockchainkit.constants the HARDENED_OFFSET, BIP32_SEED_KEY, BIP39_SALT_PREFIX, MAX_SCRIPT_ELEMENT_SIZE and USER_OPERATION_DOMAIN constants.
World.fork() in blockchainkit.contracts: an independent copy of the
world state on which to try transactions, as a wallet simulates one
before sending it.
Domain tags for contract addresses, block hashes, Ricardian contracts,
lottery commitments and wallet approvals in blockchainkit.constants,
and for channel states, Plasma transfers, rollup state, bridge
withdrawals and watchtower appointments,
and a "Contract world model" section in the model boundaries page.
Fixed
consensus.systems.fork_choice imports structures only for type
checking, so a subpackage that loads structures before consensus no
longer hits a circular import.
FinalityGadget no longer depends on vote arrival order: justification and
finality are recomputed over every recorded vote, so a supermajority link
recorded before its source was justified now counts once it is.
spread_rumor validates source before using it, raising ValueError
rather than IndexError for a peer outside the graph.
BloomFilter.false_positive_rate and BloomFilter.optimal_hash_count
validate their arguments (optimal_hash_count(m, 0) raised ZeroDivisionError).
The GHOST history, module docstring and example no longer claim that
Ethereum's proof-of-work chain used GHOST for fork choice: it adopted uncle
rewards but kept heaviest-chain selection.
Changed
History pages follow mathematicskit's entry form: an epigraph per page, and
per entry one prose account with its formula, an Implementation: line that
also states the teaching-vs-production difference, References:, and the
gallery link. The "In plain language", "Reading the experiment" and
"Experiment" blocks, the admonitions and the in-entry doctests are folded
in or removed. The history index is reduced to its overview.
The history pages of crypto, consensus, network, vm, contracts, economics, channels, proofs and fraud are rewritten for readers new
to the field: each introduction and entry opens with the problem the
breakthrough solved, defines its terms in plain language, and spells out
algorithms as numbered steps.
The documentation's landing page is titled "Learn How Blockchains Work in
Python" and links the sibling toolkits.
Gallery examples follow mathematicskit's layout: raw docstrings without
section headings or trailing links, one import cell, and plt.show(). The
Merkle-proof example's exercise moved to the end, and the capstone is now structures/chain/plot_01_payment_lifecycle.py.
subtree_work and ghost_tip compute every subtree's work in one pass.