Onchain Memories

Onchain Memories ensures that an agent’s state transitions are provable, tamper-evident, and independently verifiable. Instead of relying on a traditional database that can be modified silently, Xyber agents use cryptographic commitments to track memory updates and anchor them onchain.

This feature guarantees that the data an agent reads or writes cannot be altered without detection, enabling reproducible reasoning and trustable long-term behavior.

How It Works

When an agent updates its memory:

1

The write operation updates the off-chain SMT.

2

A new Merkle root is computed.

3

A proof describing the state transition is generated.

4

The TEE validates the transition against the previous committed root.

5

At defined intervals, the root is anchored onchain, creating a verifiable state checkpoint.

6

Higher layers (such as Action Provenance Layer and Settlement Layer) reference these roots when validating actions or payments.

The result is a memory model where each change is cryptographically linked to the agent’s execution history, enabling full verification of how the agent reached a given state.

Core Functions

The memory system combines fast off-chain storage with onchain commitments, producing a verifiable state model without sacrificing performance.

An agent’s memory update consists of the following components:

1. Sparse Merkle Tree Commitment

Every write operation updates a Sparse Merkle Tree (SMT) that represents the agent’s full logical state. The root of this tree is a cryptographic fingerprint of all stored data.

Only the root is published onchain; the full state remains off-chain for speed.

2. Proof-Based Reads and Writes

Each memory access generates or verifies a Merkle proof:

  • Reads confirm that the value corresponds to the latest committed root.

  • Writes produce a new root along with a proof showing how the tree changed.

This ensures that no memory value can be inserted, removed, or altered without producing a detectable inconsistency.

3. Onchain State Anchoring

Periodically, the agent submits the latest Merkle root to an onchain contract. This creates:

  • an immutable history of state transitions,

  • a public reference anyone can verify,

  • a synchronization point for other systems relying on the agent’s state.

Anchoring roots onchain prevents rollback attacks and provides an authoritative version of state evolution.

4. Crash-Resilient State Tracking

To support real-world workloads, the layer keeps:

  • an in-enclave “working root” for immediate updates, and

  • a locally sealed snapshot so crashes cannot revert state, even before anchoring.

After recovery, the system reconciles the sealed root with the onchain root and continues safely.

Last updated