Verifiable agent memory. A thin layer that turns an AI agent's action log into a record that is tamper-evident, timestamped, and portable — provable to a third party who does not trust the operator, and still verifiable even if blocktrain disappears.
Today's agent-memory tools (mem0, Letta, Zep, LangGraph) are storage for recall. None make the record verifiable. blocktrain is the honest substrate under agent autonomy: an agent you can audit is one you can safely give a longer leash.
-
Hash-chain (order + integrity). Every event is canonicalized and hashed, and each entry links the previous one:
entryHash_i = SHA256(canonical(event_i)) linkHash_i = SHA256(linkHash_{i-1} || entryHash_i) (genesis = 32 zero bytes)Editing, deleting, reordering, or splicing any entry breaks the chain — detectably.
-
On-chain anchor (timestamp). Pending
linkHashes are sealed into an RFC 6962 Merkle batch and anchored on BSV via bsv.cxnot2— one transaction regardless of batch size. Each entry gets an independent inclusion proof. -
Trustless verify.
verifyreplays the chain offline, then folds each entry's inclusion proof to the anchored Merkle root using a client-side RFC 6962 verifier — proven byte-compatible with bsv.cx's tree against the Certificate Transparency reference vectors. Nothing here trusts the bsv.cx server; the on-chain OP_RETURNbsv.cx/not2/<root>is the ground truth.
blocktrain proves integrity, order, and timestamp of a self-reported log. It makes tampering after the fact detectable. It does not make the agent truthful to its own log — same limit every anchor has. The use cases that need this (debug, dispute, accountability, audit) don't need more.
blocktrain append --actor mike --kind twetch.post --data '{"txid":"e5544585"}'
blocktrain seal [--dry] # anchor pending entries (real seal spends BSV float)
blocktrain verify [--spv] # replay chain + verify every anchor
blocktrain status
Paths via env: BLOCKTRAIN_LOG (default data/log.jsonl), BLOCKTRAIN_SEALS
(default data/seals.json), BLOCKTRAIN_BSVCX (default https://bsv.cx).
npm test # RFC 6962 Merkle vectors + hash-chain tamper-detection
Requires Node >= 24 (native TypeScript). Dependency-free: Node built-in crypto + fetch.
blocktrain is also an MCP server, so any MCP-capable agent
(Claude Code, OpenClaw, …) can anchor and verify memory through tools — no per-framework glue.
Tools: blocktrain_append, blocktrain_seal, blocktrain_verify, blocktrain_reveal,
blocktrain_status, blocktrain_keygen. Wire it in:
The CLI and the MCP server share one implementation (src/core.ts), so both behave identically.
See DESIGN.md for the full rationale: the fidelity ladder (asserted →
mechanical → corroborated), action-time context anchoring, and the privacy model —
the chain only ever holds a hash, contents are held off-chain encrypted, with
blind anchoring the default (blocktrain can't read your logs) and envelope
encryption for multi-party access (client, lawyers, a counterparty) without breaking
blindness.
Alpha. Pure core + CLI + offline verification proven; first mainnet batch anchored and
independently verified. Reference implementation for on-chain anchoring: anchorchain
(prof-faustus, MIT).
Apache-2.0 — see LICENSE and NOTICE. Chosen over MIT for the explicit contributor patent grant and retaliation clause, which suit a project used for audit and dispute in a patent-sensitive area (Merkle/SPV/anchoring).
{ "command": "node", "args": ["/abs/path/blocktrain/bin/blocktrain-mcp.ts"], "env": { "BLOCKTRAIN_LOG": "/abs/path/data/log.jsonl", "BLOCKTRAIN_PAY_WIF": "…only if you want the seal tool to spend" } }