This reference summarizes the public APIs of the monorepo components and points to the authoritative source files. It complements DESIGN.md §1-3 (architecture) and METHODS.md §APIs. Update all three when signatures or invariants change.
ml_dsamoduleKeypair::generate(seed: &[u8; 48]) -> KeypairKeypair::sign(&self, msg: &[u8]) -> SignatureVerifyKey::verify(&self, msg: &[u8], sig: &Signature) -> Result<()>- Security margin: ML-DSA-65 (Dilithium 3) sized keys (pk 1952 B, sk 4000 B, sig 3293 B).
ml_kemmoduleKeypair::encapsulate(&self, rng_seed: &[u8; 32]) -> (Ciphertext, SharedSecret)SecretKey::decapsulate(&self, ct: &Ciphertext) -> SharedSecret- Security margin: ML-KEM-1024; shared secrets truncated to 32 bytes.
hashesmodulecommit_note(message: &[u8], randomness: &[u8]) -> [u8; 48](BLAKE3-384 by default) andcommit_note_with(.., CommitmentHash::Sha3)for SHA3-384 commitments.sha3_256,blake3_256,blake3_384, and Poseidon-style field hashing helpers.commit_note_withuses SHA3-384 when requested. BLAKE3-384 is the default digest for commitments/nullifiers, while BLAKE3-256 remains the default for PQ address tagging and other 32-byte identifiers.derive_nullifier(nk: &[u8; 32], position: u64, rho: &[u8; 32]) -> [u8; 48]andderive_prf_keyuse the same domain tags.- Domain separation constants
b"c",b"nk",b"nf"are enforced to avoid cross-protocol collisions.
transaction-circuitcrate exposesproof::prove(witness, proving_key) -> TransactionProofandproof::verify(proof, verifying_key) -> VerificationReport. The direct STARK path isTransactionProverP3::prove_transaction(witness)andp3_verifier::verify_transaction_proof_bytes_p3(proof_bytes, pub_inputs). Production verification rejects missing STARK proof bytes/public inputs, and commitment/nullifier encodings are 48-byte values with six canonical limbs (validated viahashing_pq::is_canonical_bytes48).disclosure-circuitcrate exposesprove_payment_disclosure(claim, witness) -> PaymentDisclosureProofBundleandverify_payment_disclosure(bundle). The claim bindsvalue,asset_id,pk_recipient, andcommitment; the witness suppliesrhoandr.PaymentDisclosureProofBundlecarriesproof_bytesplus theair_hashused for verifier binding.block-circuitcrate aggregates multiple transaction proofs viaBlockCircuit::prove(block_inputs).circuits/benchbinary crate (circuits-bench) providescargo run -p circuits-bench -- --iterations N --proveto compile circuits, generate witnesses, and optionally verify proofs. Output includes constraint rows, hash rounds, and per-proof latency.
- Rust crate
consensusexposesBlockBuilder, ledger-state transition helpers, and PQ signature utilities that miners call w hen assembling payloads. - Go benchmarking module
consensus/benchofferscmd/netbench:- Flags:
--miners,--payload-bytes,--pq-signature-bytes,--smoke. - Output: JSON summary with
messages_per_second,avg_latency_ms,pq_signature_bytesso operators can project miner gossi p budgets.
- Flags:
- Rust crate
walletexposes CLI subcommands viaclapdefinitions inwallet/src/bin/wallet.rs, covering offline helpers, Substrate RPC flows, and compliance tooling. wallet payment-proof create|verify|purgegenerates and verifies disclosure packages (payment proofs) and manages stored outgoing disclosure records.wallet substrate-sync,wallet substrate-daemon, andwallet substrate-sendare the Substrate RPC paths for live wallets.- Wallet sync falls back to archive providers for ciphertext recovery when hot DA is pruned. Configure
HEGEMON_WALLET_ARCHIVE_WS_URLor ensure providers are discoverable viaarchive_listProviders. wallet::disclosure::{DisclosurePackage, DisclosureClaim, DisclosureConfirmation, DisclosureProof}defines the JSON schema and encoding helpers used to serialize/deserialize payment-proof packages.wallet::TransactionBundleand shielded-transfer payloads usebinding_hash(a 64-byte hash commitment), not a signature.wallet/benchbinary crate (wallet-bench) accepts--iterationsand reports note construction/sec, nullifier derivations/sec, and encryption throughput.
walletdis a sidecar daemon that speaks newline-delimited JSON over stdin/stdout for GUI clients.- Requests:
{ id, method, params }. Responses:{ id, ok, result?, error?, error_code? }.error_codeis snake_case. status.getreturnsprotocolVersion,capabilities,walletMode,storePath, balances, pending entries, note summary, andgenesisHash.sync.once,tx.send,disclosure.create, anddisclosure.verifymirror the wallet CLI flows without log parsing.- The daemon holds an exclusive
<store>.lockfile to prevent concurrent access to the same wallet store.
-
pallet-kernelsubmit_action(envelope)is the only live public dispatch surface for proof-native protocol actions.FamilyRootsstores the active family roots.KernelGlobalRootcommits to the family-root map and is part of the live validity shape.
-
pallet-shielded-pool- remains the first kernel family backend for shielded commitments, nullifiers, fee accounting, and proof verification
- no longer exposes its six live state-changing calls as a public runtime dispatch surface
- still implements the underlying action semantics for:
- per-transfer shielded proofs
- batch transfer proofs
- aggregation-mode markers
- proven block-batch payloads
- shielded coinbase minting
Hegemon-specific RPC methods exposed on the Substrate JSON-RPC server:
hegemon_miningStatus() -> MiningStatushegemon_startMining(params?: { threads: number }) -> MiningControlResponsehegemon_stopMining() -> MiningControlResponsehegemon_compactJob(params?: { auth_token?: String }) -> CompactJobResponsehegemon_submitCompactSolution(request: { worker_name: String, job_id: String, nonce: String, auth_token?: String }) -> SubmitPoolShareResponsehegemon_poolWork(params?: { auth_token?: String }) -> PoolWorkResponsehegemon_submitPoolShare(request: { worker_name: String, nonce: String, pre_hash: String, parent_hash: String, height: u64, auth_token?: String }) -> SubmitPoolShareResponsehegemon_poolStatus(params?: { auth_token?: String }) -> PoolStatusResponsehegemon_consensusStatus() -> ConsensusStatushegemon_telemetry() -> TelemetrySnapshothegemon_storageFootprint() -> StorageFootprinthegemon_nodeConfig() -> NodeConfigSnapshot(base path, chain spec identity, listen addresses, PQ verbosity, peer limits)hegemon_peerList() -> Vec<PeerDetail>(connected PQ peers with address, direction, best height/hash, last-seen seconds)hegemon_peerGraph() -> PeerGraphSnapshot(direct peers plus reported peers from discovery)
Compact mining RPC notes:
hegemon_compactJobis the preferred compact-job miner surface. It exposes a stablejob_id,pre_hash,parent_hash, and share/network targets without assuming an implicitu64nonce.hegemon_submitCompactSolutionaccepts a 32-byte nonce (0x-prefixed hex) plus the advertisedjob_id.
Legacy / experimental pool-worker RPC notes:
hegemon_poolWorkexposes the current authoring template to pooled hash workers.hegemon_submitPoolShareremains as a compatibility path and now also accepts a 32-byte nonce (0x-prefixed hex); full-target solutions are forwarded into the mining coordinator.hegemon_poolStatusreports aggregate and per-worker share accounting for the current process.- These pool-worker RPCs are not part of the current default desktop or
InlineTxoperator flow. They remain in-tree for compatibility and experiments.
CompactJobResponse fields:
available: booljob_id: Option<String>(hex)height: Option<u64>pre_hash: Option<String>(hex)parent_hash: Option<String>(hex)network_bits: Option<u32>(compact PoW bits)share_bits: Option<u32>(compact bits; defaults to network difficulty unlessHEGEMON_POOL_SHARE_BITSis set)reason: Option<String>
PoolWorkResponse fields:
available: boolheight: Option<u64>pre_hash: Option<String>(hex)parent_hash: Option<String>(hex)network_difficulty: Option<u32>(compact PoW bits)share_difficulty: Option<u32>(compact bits; defaults to network difficulty unlessHEGEMON_POOL_SHARE_BITSis set)reason: Option<String>
SubmitPoolShareResponse fields:
accepted: boolblock_candidate: boolnetwork_target_met: boolerror: Option<String>accepted_shares: u64rejected_shares: u64worker_accepted_shares: u64worker_rejected_shares: u64
PoolStatusResponse fields:
available: boolnetwork_difficulty: Option<u32>share_difficulty: Option<u32>accepted_shares: u64rejected_shares: u64worker_count: usizeworkers: Vec<PoolWorkerStatusEntry>
PoolWorkerStatusEntry fields:
worker_name: Stringaccepted_shares: u64rejected_shares: u64block_candidates: u64payout_fraction_ppm: u64(accepted-share fraction scaled by 1,000,000)last_share_at_ms: Option<u64>
PeerDetail fields:
peer_id: String(hex)address: String(ip:port)direction: String(inbound|outbound)best_height: u64best_hash: String(hex)last_seen_secs: u64
PeerGraphSnapshot fields:
local_peer_id: String(hex)peers: Vec<PeerDetail>(direct peers)reports: Vec<PeerGraphReportSnapshot>
PeerGraphReportSnapshot fields:
reporter_peer_id: String(hex)reporter_address: String(ip:port)reported_at_secs: u64peers: Vec<PeerGraphPeer>
PeerGraphPeer fields:
peer_id: String(hex)address: String(ip:port)
Archive market RPC methods exposed on the Substrate JSON-RPC server:
archive_listProviders() -> Vec<ArchiveProviderEntry>archive_getProvider(account_id_hex: String) -> Option<ArchiveProviderEntry>archive_providerCount() -> u32archive_listContracts(account_id_hex: String) -> Vec<ArchiveContractEntry>archive_getContract(contract_id: u64) -> Option<ArchiveContractEntry>
Block validity and data-availability RPC methods exposed by the Substrate node:
block_getCommitmentProof(block_hash: H256) -> Option<CommitmentProofResult>- Returns the commitment proof bytes and public inputs for a block, or
nullif the block has no commitment proof (e.g., coinbase-only blocks). CommitmentProofResult:{ proof_bytes: Bytes, public_inputs: CommitmentProofPublicInputs }
- Returns the commitment proof bytes and public inputs for a block, or
da_getChunk(da_root: H256, chunk_index: u32) -> Option<DaChunkResult>- Returns an erasure-coded chunk and its Merkle proof for the given DA root.
DaChunkResult:{ chunk: Bytes, merkle_proof: Vec<H256> }
da_getParams() -> DaParams- Returns global DA parameters (chunk size, sample count, encoding scheme).
Experimental prover-market RPC methods exposed on the Substrate node:
prover_getWorkPackage() -> Option<WorkPackageResponse>prover_getStageWorkPackage() -> Option<WorkPackageResponse>prover_submitWorkResult(request) -> SubmitWorkResultResponseprover_submitStageWorkResult(request) -> SubmitWorkResultResponseprover_getWorkStatus(package_id) -> Option<WorkStatusResponse>prover_getMarketParams() -> MarketParamsResponseprover_getStagePlanStatus() -> StagePlanStatusResponseprover_listArtifactAnnouncements() -> Vec<ArtifactAnnouncementResponse>prover_getCandidateArtifact(tx_statements_commitment: String, tx_count: u32) -> Option<CandidateArtifactResponse>
These prover RPCs are experimental surfaces for recursive / market research. The live
InlineTx path does not publish external proving work by default.
WorkPackageResponse can now carry root_finalize_payload for standalone private
prover workers. In the current branch this payload is intended for the
experimental MergeRoot root-finalize path and includes:
- resolved transaction proof material (bincode + base64)
- statement hashes
tx_statements_commitment- DA metadata
- commitment-proof public inputs (starting/ending roots and nullifier data)
Standalone private prover worker binary:
hegemon-prover-worker- Polls
prover_getStageWorkPackage - Builds commitment proof + merge-root payload for
root_finalize - Submits the completed bundle with
prover_submitStageWorkResult - Remains experimental and is not required for the normal
InlineTxdeployment path
- Polls
Legacy RPC endpoints (block_getRecursiveProof, epoch_*) are removed; recursive epoch proofs are temporarily disabled until a Plonky3 recursion path is reintroduced.
Artifact market RPC notes:
prover_listArtifactAnnouncementsreturns lightweight reusable-artifact metadata for prepared candidate artifacts.prover_getCandidateArtifactreturns the SCALE-encodedCandidateArtifactpayload for a matching(tx_statements_commitment, tx_count)pair when one is available.
Every module README now contains a Doc Sync section referencing this file plus DESIGN.md and METHODS.md. When adding a new API surface, ensure:
- Function signature and expected behavior are documented here.
- DESIGN.md explains how it fits the architecture.
- METHODS.md instructs operators/testers how to exercise it.
Failure to update all three will cause CI docs checks (see .github/workflows/ci.yml) to fail.