E46 work orders: C++ libraries and build workflow¶
Written: 7 October 2026 · Spec: CHAIN-DESIGN.md · Status: planned, nothing built
Rule: nothing is “done” until the project owner’s reviewer (Claude) has re-run its tests and checked it against the spec.
Start here (for the builder)¶
Baseline first: the project folder must be under git with a clean first commit before any build work, so every change can be reviewed as a diff. (Ask the owner if it isn’t.)
Order: WO-01 → WO-02 → WO-04 → WO-03 → WO-08 (Rad prototype) → WO-14 (Grover re-run) → then WO-05, 06, 07, 11, 12, 09, 10, 13 → 16 (offline CLI wallet). WO-13b is queued for the later wallet/GUI phase.
One work order at a time, each on its own branch
wo-XX-name, each finished with itsWO-XX-REPORT.md.Put new code under
e46/(C++:e46/src,e46/include,e46/tests,e46/goldenfor Python references and vector JSON). Don’t modify existing research files,phase3-runs/evidence,PEER_REVIEW/or the QTL test runs.Stop and ask before installing libraries (XKCP/OpenSSL, liboqs, a test framework), before long runs, and whenever the spec is unclear. Never guess a consensus rule.
Write every question down. Unclear rules, spec gaps and limitations go into
work-orders/DECISIONS-NEEDED.md(Open) and the work order’s report, never only in chat, because the owner may miss a chat message. ReplyBLOCKED WO-NNuntil it is answered.Never rewrite history or delete files. No reset, rebase, amend of pushed commits, force-push, or deleting/moving files outside your work order. If something must be undone or reorganized, stop and ask the owner. (Added 8 Oct 2026 after 89 owner files vanished from the working folder during a history rewrite; they were restored from commit
9d73bc6, kept as branchbackup/making-it-better-9d73bc6.)
The map¶
┌───────────────────────────── FOUNDATION ─────────────────────────────┐
│ WO-01 RL v3 lib WO-02 SHAKE/KMAC wrap WO-04 Bech32m │
└──────┬───────────────────────┬──────────────────────────┬────────────┘
│ │ │
┌───────────────┴──────┐ ┌───────────┴───────────┐ ┌─────────┴─────────┐
│ WO-08 Rad engine ★ │ │ WO-03 Merkle roots │ │ WO-05 Addresses │
│ (prototype first) │ │ merkle + event root │ │ & IDs │
└──────┬───────────────┘ └───────────┬───────────┘ └─────────┬─────────┘
│ │ │
└──────────────┬─────────────────┴──────────┬───────────────┘
│ │
┌──────────────┴─────────┐ ┌────────────┴────────────┐
│ WO-06 Header + PoW │ │ WO-11 SLH-DSA + KMAC │
│ + ASERT │ │ keys (liboqs) │
└──────────────┬─────────┘ └────────────┬────────────┘
│ │
┌──────────────┴─────────┐ ┌────────────┴────────────┐
│ WO-07 Emission, pools, │ │ WO-12 Transactions, │
│ E46i, neutrino │ │ sighash, output types │
└──────────────┬─────────┘ └────────────┬────────────┘
│ │
└──────────────┬─────────────┘
│
┌───────────────┬─────────────┴───────────┬────────────────────┐
│ WO-09 Block │ WO-10 Genesis miner │ WO-13 QTL v2 port │
│ QTL commits │ + chainparams │ (SHAKE, dual delay)│
└───────────────┴──────────────────────────┴────────────────────┘
│
WO-14 Grover re-run on the built libs
│
LOCAL TESTNET (RL v3) → later: P2P, GUI, FIDO2, RL W
★ = build first (agreed): the Rad prototype measures Z_base and Z_commit on real Rad puzzles.
Workflow for every work order¶
1. SPEC read the CHAIN-DESIGN.md section(s) named in the work order
2. GOLDEN write or reuse a Python reference (the "golden" version) → generate test vectors (JSON)
3. C++ implement in C++20 against the same spec, NOT by translating the Python line by line
4. MATCH C++ output == golden vectors, byte for byte, + ≥ 1,000 random inputs + edge cases
5. HARDEN build with -Wall -Wextra -Werror, AddressSanitizer + UndefinedBehaviorSanitizer; fuzz parsers
6. MEASURE benchmark (≤ 4 worker threads; the Mac's fans)
7. REPORT a short WO-xx-REPORT.md: what was built, test output, measurements, anything unsure
8. REVIEW Claude re-runs everything, checks spec line by line, and runs a SURPRISE EXAM: fresh random
inputs from an unpublished seed, answered by the Python reference (Sunday) → owner approves → merge
House rules (all work orders)¶
No SHA-2 anywhere in chain code (SHA-256 only as a labelled test control).
No floating point in consensus code. Integers only; explicit little-endian serialization; clamp every unsigned subtraction (
remaining = max(T − E, 0)).Never write cryptography that a vetted library provides: SHAKE/KMAC (XKCP or OpenSSL 3), SLH-DSA (liboqs). Refracting Light is the only hash we implement ourselves.
Two implementations agree (golden Python + C++) before anything counts as done.
Golden files are public and frozen. They are never edited to make a test pass; any change to
e46/golden/is a red flag in review.Ask the owner before installing any library or running anything longer than ~10 minutes.
Never put keys, passwords or private IPs in files.
Before building starts: put the project under git, so every change can be reviewed as a diff.
Work orders¶
WO |
Name |
Spec |
Needs |
Deliverable |
Done when |
|---|---|---|---|---|---|
01 |
RL v3 C++ library |
RL-V3-PAPER §1; spec §8 |
— |
|
all v2/v3 vectors + 1,000 random match Python and |
02 |
SHAKE256 / KMAC256 wrapper |
§2a, §2e |
XKCP or OpenSSL 3 (approval) |
|
NIST FIPS 202 / SP 800-185 test vectors pass; matches Python |
03 |
Merkle roots ( |
§2b, §2f |
02 |
tree build, root, inclusion proof create/verify; typed event leaves (0x02 Rad, 0x03 commitment); sort rules |
golden vectors for 0, 1, 2, 3, 5, 1,000 leaves; odd node carried (never duplicated); tags 0x00/0x01; proofs verify and tampered proofs fail |
04 |
Bech32m codec |
§2a |
— |
encode/decode with prefixes |
BIP-350 official vectors pass; all spec example strings reproduce; wrong network/prefix/checksum rejected |
05 |
Addresses and IDs |
§2a |
01, 02, 04 |
single-owner |
spec examples reproduce exactly; golden vectors match |
06 |
Header, PoW, ASERT |
§2, §2b, §2d |
01, 02 |
120-byte header (de)serialize; |
golden header vectors; ASERT matches a Python reference over 100,000 simulated blocks incl. hashrate jumps |
07 |
Emission, pools, E46i |
§3, §5 |
06 |
|
1,000-year simulation: Σ(miner+N+Z) = Σ reward every block; no underflow at years 100/114/118; totals match spec tables |
08 ★ |
Rad engine + prototype |
§4 |
01, 02, 03 |
Rad stamp, nonce-bound puzzle, Z-level, byte tiers, verify, Rad leaf; measurement harness |
verifies honest Rads, rejects forged/stolen/out-of-window ones; report measured Rads/block vs Z (set Z_base (provisional 43; see CHAIN-DESIGN §6 “Paradox A”)) and stamp time (set Z_commit (provisional 18)) |
09 |
Block QTL commitments |
§2f |
02, 03, 08 |
commitment build, Z_commit stamp, reveal check (6 ≤ depth ≤ 2,016), per-block limit 1,000 |
reveal before 6 blocks rejected; expired rejected; mismatched rejected; limit enforced |
10 |
Genesis miner + chainparams |
§2b, §2d |
03, 05, 06 |
|
anyone reproduces the same genesis from the same pszTimestamp; testnet and mainnet genesis separate |
11 |
SLH-DSA keys + KMAC derivation |
§2e |
02, liboqs (approval) |
keygen from seed, sign, verify (SLH-DSA-SHAKE-128s); |
NIST KAT vectors for SLH-DSA-SHAKE-128s pass; sizes 32 / 64 / 7,856 B confirmed against FIPS 205 |
12 |
Transactions |
§2e |
03, 05, 11 |
serialization, txid/wtxid, sighash, output types 0x00–0x04, coinbase rules, maturity |
golden vectors; malformed inputs rejected (fuzzed); sighash commits to spent values |
13 |
QTL v2 port — Python reference + C++ primitives |
QTL-V2-ANTI-LOCKOUT.md; spec S16 |
02 |
Replace the Python prototype’s SHA-256 fingerprint and HKDF-SHA256 with SHAKE256/KMAC256; add the 50/50 dual delay (Lock A squaring, Lock B hash chain + chain bank); implement matching C++ SHAKE/KMAC, Argon2id, AES-GCM, checkpoint and delay primitives under |
all 13 Python anti-lockout cases pass; Lock-B-only timing is ≥ half of Lock A; frozen golden and fresh randomized C++/Python primitive comparisons have 0 mismatches; sanitizers pass |
13b |
QTL v2 C++ envelope and wallet flow (queued for wallet/GUI phase) |
QTL-V2-ANTI-LOCKOUT.md; spec S16 |
13 |
Complete the C++ envelope serializer/parser and wallet flow: encrypted chain-bank lifecycle, RSA puzzle sealing, resumable unlock/progress, and corresponding C++ anti-lockout coverage |
C++ seals and unlocks byte-compatible Python golden envelopes; all 13 anti-lockout cases pass in C++; tampering, interruption/resume and Lock-B-only timing checks pass under release and sanitizers |
14 |
Grover re-run on the built libraries |
work-orders/handoffs/WO-14-GROVER-HANDOFF.md; PHASE3-RESULTS §L |
01 (and 08 for Rad puzzles) |
re-run |
|
16 |
Offline CLI wallet |
CHAIN-DESIGN §2a, §2e, §2g; WO-13 QTL v2 |
05, 11, 12, 13 |
|
wallet/address round trips; |
17 |
Local node (Phase 1, single machine) |
§2, §2b, §2d–§2g, §3–§5; decisions #11–#27 |
05–13, 16 |
|
Mine 200 local blocks; verify coinbase maturity and wallet-signed spend; reject bad PoW/bits/Merkle, double spends, immature/over-T/locked spends and bad event roots; reorg restores UTXOs and pool balances. Phase 1: miner gets 80% + fees, N/Z shares accrue without payout outputs; Rad events and stake-lock outputs are invalid while Phase-2 activation is unset; Block QTL remains active. Release tests pass; one sanitizer pass at the end; report written. Keep disk ≥1 GiB. |
18 |
Qt wallet interface, offline/testnet |
supplied UI mockups; CHAIN-DESIGN §2a, §2e, §2g; decisions #25–#29 |
16, 17 |
Qt 6 Widgets wrapper for |
Build and smoke-check with low parallelism; verify secret handling in code/review; Send stays disabled until WO-17 provides spendable UTXOs; Miner/Console use existing CLI commands only; no arbitrary shell. Do not start another miner during owner-run mining. |
19 |
Node storage redesign (public E46-Tessera repo, decision #31) |
work-orders/handoffs/WO-19-STORAGE-HANDOFF.md; decision #33 |
17, P2P (public |
one coin set at the active tip + per-block undo records; side branches stored after header-only checks and fully validated on connect; invalid-branch rollback; 4,096 ceiling removed |
old-vs-new differential replay of the 274-block testnet is byte-identical; P2P suite passes on dev + sanitize; real-PoW reorg tests incl. an invalid branch; memory shown linear |
Integration checklist for later work (Paradox II item 10, 15 Oct 2026)¶
A library passing its own tests is not the whole job. Whoever wires these pieces together must also:
[ ] Merkle proofs (WO-03b): check the recomputed bound root against the root in a header the caller already trusts. A proof is only as good as that header.
[ ] Events (WO-08, WO-09): validate every event’s ID and body (Rad pairs, Block QTL commitments and their proof of work) before it goes into a block or an
event_root.[ ] Blocks and P2P: define and enforce wire limits (message sizes, counts, proof lengths) before parsing anything received from a peer. Transport v1 lists its limits in the public repo’s docs/P2P.md.
[ ] Light clients: height comes from counting validated headers; a header alone proves nothing about unspent status, E46i decay or QTL depth.
WO-15 (build note only, not yet ordered): mining software, example pool, example explorer¶
CGMiner and BFGMiner support: an RL v3 algorithm driver (the
rl_v3hashing core fromlibrl, the header layout from WO-06, the target check) so these established miners can mine E46. Both are GPL-3.0 projects, so the E46 driver lives in separate GPL-licensed forks while E46’s own code stays MIT. CGMiner today mostly targets ASICs and FPGAs, so a CPU/GPU path may suit BFGMiner or a small native E46 miner better; decide when ordered.Stratum support: the mining protocol pools and miners speak, adapted to E46’s 120-byte header, 64-bit nonce and 64-bit time.
Example pool: a minimal open-source pool (stratum server, share accounting, payouts in E46) for the testnet, clearly labelled as an example.
Example block explorer: a read-only web page showing blocks, transactions,
e46…/tes…/e461z…addresses, Rads and Z-levels, Block QTL commitments, decay epochs and E46i timers.Depends on: WO-01, 03, 05, 06, 07, 08, 12 and a running local testnet.
Later (not yet ordered)¶
P2P networking (Tor/I2P behind build flags, off by default) · complete GUI wallet integration (FIDO2 optional, E46i timers shown; WO-18 prototype only) · Quantum Rads (by consensus) · Refracting Light W and shard variants (after the local testnet).