A drop-in SDK giving autonomous agents verifiable, cross-session memory backed by 0G Storage — KV for fast context, Log for immutable archival, 0G Chain for on-chain settlement.
Every session starts cold. Client context is lost. There is no proof the stored data was not modified. Memory lives in centralized databases that agents cannot outlive.
Initialize once with your 0G credentials. Drop into any agent pipeline. The SDK handles KV writes, Log archival, and local root-hash indexing transparently.
Writes to KV stream (fast reads) and Log layer (root hash). Returns the Merkle root hash as cryptographic proof.
await memory.remember('client:acme', { budget: 50000 });Looks up the root hash in the local index, then downloads the file directly from 0G Storage network. No central server.
const ctx = await memory.recall('client:acme');Append-only write to 0G Storage Log layer. Returns rootHash and a StorageScan URL — a permanent, tamper-proof record.
const { rootHash } = await memory.archive({ type: 'invoice', data });Agent context, client profiles, and session state. Key-value pairs written to 0G's KV stream. Indexed by keccak256(agentId).
Invoices, events, audit trails. Files return a Merkle root hash. Data cannot be modified after upload. StorageScan link for every record.
AgentPayment.sol anchors invoice IDs and root hashes on-chain. Clients pay into escrow. Release on delivery. ChainScan proof on every invoice.
import { ChainMemory } from 'chainmemory-sdk'; const memory = new ChainMemory({ agentId: 'my-agent-v1', privateKey: process.env.PRIVATE_KEY, rpcUrl: 'https://evmrpc-testnet.0g.ai', indexerRpc: 'https://indexer-storage-testnet-turbo.0g.ai', }); // Write to KV + Log → root hash returned await memory.remember('client:acme', { budget: 50000 }); // Retrieve from 0G network via root hash const ctx = await memory.recall('client:acme'); // Immutable log → StorageScan URL const { rootHash } = await memory.archive({ type: 'invoice', data: invoice, });
Data submitted to 0G KV stream. Full record uploaded to 0G Storage Log layer.
Network distributes data across nodes. Merkle root hash computed and returned.
A tiny local index maps key → rootHash. The index is the only centralized piece.
Local index resolves the root hash. indexer.download() fetches the file from 0G.
registerInvoice() anchors invoice ID + rootHash on 0G Chain. ChainScan proof link.
An autonomous invoicing agent that demonstrates the complete 0G stack. Describe your work — it generates, archives, and registers an invoice entirely on-chain.
Client history recalled from 0G Storage on every session. Returning clients recognised automatically — no database query.
Natural language job description parsed by Qwen-2.5-7B via 0G Compute Router. TEE verified inference.
Every invoice archived to 0G Storage Log. Root hash proof returned. Verifiable forever on StorageScan.
AgentPayment.sol on chainId 16602. Invoice registered on-chain. Escrow + release. ChainScan link on every invoice.
0G-Memory is the only solution combining a developer-friendly agent SDK with decentralized, verifiable storage and native on-chain payment settlement — all on a single unified network.
remember · recall · archive — complete API surface. TypeScript, tested end-to-end.
Full pipeline: AI inference → storage archive → chain registration. Working on 0G testnet.
Qwen-2.5-7B via 0G Compute Router. TEE-verified inference. Invoice generation from natural language.
Both layers integrated. KV for fast context, Log for immutable invoices with root hash proof.
AgentPayment.sol deployed on 0G Chain testnet (chainId 16602). registerInvoice · pay · release.
All steps verified: AI parses → 0G stores → root hash → chain registers → ChainScan link returned.
Built in 48 hours for the 0G APAC Hackathon 2026. Every component is deployed and working. The demo is live — try it now.