On-chain program reference
Program ID: C6AJ43ZpzPLtmcwDS1FQP7cQXtWHNwsLty5ijdLTxzmK
Instructions
| Instruction | Args | Authority | Effect |
|---|---|---|---|
initialize_agent | read_fee_lamports: u64, metadata_uri: String | owner pays rent | Creates the AgentMemory PDA |
commit_memory | root: [u8;32] | owner only | Sets root, increments version and write_count |
attest_retrieval | query_hash: [u8;32], result_hash: [u8;32], nonce: u64 | anyone | Transfers read fee, increments read_count, creates attestation PDA |
update_read_fee | new_fee: u64 | owner only | Updates the read fee |
close_agent | — | owner only | Closes the agent, refunds rent |
metadata_uri is capped at 200 characters. commit_memory rejects an all-zero root.
Accounts
AgentMemory
| Field | Type |
|---|---|
owner | Pubkey |
memory_root | [u8; 32] |
version | u64 |
last_updated | i64 |
read_fee_lamports | u64 |
write_count | u64 |
read_count | u64 |
metadata_uri | String (≤200) |
bump | u8 |
PDA seeds: ["agent", owner].
RetrievalAttestation
| Field | Type |
|---|---|
agent | Pubkey |
memory_root | [u8; 32] |
version | u64 |
query_hash | [u8; 32] |
result_hash | [u8; 32] |
requester | Pubkey |
timestamp | i64 |
nonce | u64 |
bump | u8 |
PDA seeds: ["attest", agent_memory, version_le, nonce_le].
Events
MemoryCommitted—agent,version,root,timestampRetrievalAttested—agent,version,query_hash,result_hash,requester,timestamp
Errors
| Code | Meaning |
|---|---|
Unauthorized | Caller is not the agent owner |
InsufficientPayment | Requester didn’t cover the read fee |
MetadataUriTooLong | metadata_uri exceeds 200 chars |
InvalidRoot | Memory root must not be all zeros |
Decoding accounts in TypeScript
The SDK decodes these accounts without an IDL, using the Anchor discriminator
(sha256("account:<Name>")[..8]) and fixed field offsets:
import { decodeAgentMemory, decodeRetrievalAttestation } from "@lumi-node/locus-sdk";