Repository navigation
How It Works
Ranesh Rajit edited this page Oct 8, 2026
·
3 revisions
Enroller measures the golden files (binary, config, memory)
|
v
config/baseline.json saved (Boss trusted store) + genesis anchored
|
v
public key pinned at enrollment -> key swaps fail as KEY_MISMATCH
|
v
contract + chainId pinned when config/chain.json exists -> mismatch refuses chain mode
Checker reads binary + config + memory
|
v
H_bin, H_cfg, H_mem -> H_comb = SHA256(raw32 || raw32 || raw32)
|
v
Sign(agentId|seq|ts|hBin|hCfg|hMem|hComb|prevHash) with keys/ privateKey
|
v
Anchor to Integrity.sol (locally signed EIP-155 raw tx, owner-only) / ledger.jsonl FALLBACK
|
v
After a mined anchor: eth_call getLatest, stored record must equal the submission
|
v
Boss checks the verdict set (see below)
|
v
GREEN (all pass) or RED (reason + expected vs got)
|
v
Dashboard (PORT env, default 8080) + /metrics + console log + witness.jsonl counter-attestation
Every 12 cycles the heartbeat closes a Merkle batch window over the recent window: the root appears in /api/status (batchRoot) and the console prints BATCH window=12 root=... proofs=... build=...us, showing proof generation running continuously at scale. (The contract stores single-cycle hashes; the batch root is attested off-chain through the frozen prevHash linkage.)
The Verifier returns GREEN only if every check passes:
-
Comb:
hComb == SHA256(raw32||raw32||raw32)(raw bytes, never hex-concat). - Seal: the full 8-field Ed25519 signature verifies (off-chain; the EVM has no Ed25519).
-
Link:
prevHashmatches the previous cycle'shComb(genesis = 64 zeros). 3b. Readback (when anchored on-chain): the record read back fromgetLatestequals the submitted measurement, elseCHAIN_MISMATCH comp=chain. -
Recompute: Boss re-measurement equals the reported hash per component (catches a lying Checker as
MEASURE_MISMATCH_BIN/CFG/MEM). -
Baseline: reported hash equals the golden baseline per component (catches an edit as
POLICY_BIN/CFG/MEM_CHANGED). -
Freshness:
tswithin 12s (chainblock.timestampauthoritative when up) andseqstrictly monotonic (catches replay asSTALE_REPLAY).
A swapped signing key is checked before everything else: pin present and disk key matches, or KEY_MISMATCH.
stateDiagram-v2
[*] --> GREEN : fresh clone boots
GREEN --> RED : POLICY_*_CHANGED / MEASURE_MISMATCH_* / SIG_FAIL / STALE_REPLAY / COMB_MISMATCH / PREV_HASH_BREAK / CHAIN_MISMATCH
GREEN --> STALE : no fresh anchor for 12s (watchdog)
RED --> GREEN : restore bytes / clear memory
RED --> STALE : heartbeat stalls while RED
STALE --> GREEN : heartbeat resumes
- Heartbeat interval: 5s (frozen).
- STALE after: 12s without a fresh anchor, enforced by a 1s watchdog even with zero dashboard requests.
- Worst-case detection: next interval + pipeline = ~5s + ~4ms average (24ms worst, 20 trials; on-chain RPC + receipt wait excluded from the pipeline spans, shown as
anchor+verifyin the dashboard). - A stalled heartbeat shows
CYCLE_ERRwith the cause first, thenSTALEpast the 12s window (no flicker between the two). - Receipt polling is fast-first: 10 x 50ms, then 3 x 200ms (worst ~1.1s) before a cycle reports the tx as pending.
Decentralized Runtime Integrity Engine