Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Repository Layout & Building

zechariah/
  SPEC_PT_01..03.md        the platform specification (normative)
  IMPLEMENTATION_PLAN.md   v1 decisions (D1–D8) and milestones (M0–M7)
  docs/                    this book (mdBook) + threat-model.md
  packages/
    protocol/        canonical wire codec; tx/block/vote/gossip schemas; golden vectors
    crypto/          Ed25519, BLAKE2b-256, z32 addresses, keystores, mnemonics
    networking/      Network/Feed over Hyperswarm + Corestore
    state/           KV store (LevelDB), overlays, Merkle state commitment
    vm/              contract executor (wasmi-in-wasm) + runtime/ (Rust crate)
    chain/           genesis, execution, fees, mempool, blocks, registry
    consensus/       BFT engine, peer hub, certificates, block sync
    node/            node orchestration + mordecai l1 CLI
    rpc/             hyperswarm-RPC server + typed client
    wallet/          Wallet, Signer, keystore files, mordecai-wallet CLI
    sdk/             Mordecai (app runtime), ContractArgs, mordecai-launcher
    pear-integration/ WalletSession, WalletDaemon, RemoteSigner
  contracts/
    runtime-rs/      mordecai-contract: the Rust contract ABI bindings
    counter/ marketplace/   hand-written Rust contracts
    dist/            committed .wasm artifacts (Rust + DSL examples)
  compiler/
    mordecaic            the DSL compiler CLI (Python 3, stdlib only)
    mordecaidsl/         parser, typechecker, Rust codegen
    examples/        land.pysc, chess_wager.pysc
  apps/
    devnet/          local devnet launcher
    chess/           the example application

Toolchains

  • Node ≥ 20 + corepack — required for the packages. pnpm is pinned via packageManager; pnpm install && pnpm build && pnpm test.
  • Rust (wasm32-unknown-unknown) + Python 3 — only to rebuild wasm artifacts (scripts/build-wasm.sh) or compile your own DSL contracts. All shipped WASM artifacts are committed; tests that need the contract toolchain self-skip without it.
  • mdBook 0.5.2 — required by pnpm build to bundle this book into packages/gateway/public/docs/. Install a prebuilt mdBook release, or use cargo install mdbook --version 0.5.2 --locked if Rust is available. Run pnpm build:docs after documentation edits, or mdbook serve docs for live-reloading author previews. Built nodes serve the book at /docs/ without a separate documentation server or mdBook installation.

Testing conventions

  • Unit + integration tests are vitest, colocated in each package’s test/ (plus apps/*/test/). Tests import package sources via aliases in vitest.config.ts. Build first for CLI integration tests and bundled documentation route tests, which also exercise generated artifacts.
  • Integration tests spin up real components: in-process DHT testnets (hyperdht/testnet), real multi-validator consensus, real RPC over the swarm. Nothing chain-related is mocked.
  • Never run cargo/other sync subprocesses inside a vitest worker — a synchronous call blocks the event loop, so vitest’s own timeouts cannot fire and the run hangs silently. Precompile artifacts instead (this is a hard-won lesson; see scripts/build-wasm.sh).
  • Golden vectors (packages/protocol/test/vectors/) pin the wire format; changing them is a consensus break. Regenerate only deliberately with UPDATE_VECTORS=1.

CI

GitHub Actions (.github/workflows/ci.yml) runs install → build → lint → format check → tests on every push/PR. CI installs mdBook 0.5.2 before the build; prebuilt WASM keeps the contract toolchain optional.