On-chain program reference

Program ID: C6AJ43ZpzPLtmcwDS1FQP7cQXtWHNwsLty5ijdLTxzmK

Instructions

InstructionArgsAuthorityEffect
initialize_agentread_fee_lamports: u64, metadata_uri: Stringowner pays rentCreates the AgentMemory PDA
commit_memoryroot: [u8;32]owner onlySets root, increments version and write_count
attest_retrievalquery_hash: [u8;32], result_hash: [u8;32], nonce: u64anyoneTransfers read fee, increments read_count, creates attestation PDA
update_read_feenew_fee: u64owner onlyUpdates the read fee
close_agentowner onlyCloses the agent, refunds rent

metadata_uri is capped at 200 characters. commit_memory rejects an all-zero root.

Accounts

AgentMemory

FieldType
ownerPubkey
memory_root[u8; 32]
versionu64
last_updatedi64
read_fee_lamportsu64
write_countu64
read_countu64
metadata_uriString (≤200)
bumpu8

PDA seeds: ["agent", owner].

RetrievalAttestation

FieldType
agentPubkey
memory_root[u8; 32]
versionu64
query_hash[u8; 32]
result_hash[u8; 32]
requesterPubkey
timestampi64
nonceu64
bumpu8

PDA seeds: ["attest", agent_memory, version_le, nonce_le].

Events

  • MemoryCommittedagent, version, root, timestamp
  • RetrievalAttestedagent, version, query_hash, result_hash, requester, timestamp

Errors

CodeMeaning
UnauthorizedCaller is not the agent owner
InsufficientPaymentRequester didn’t cover the read fee
MetadataUriTooLongmetadata_uri exceeds 200 chars
InvalidRootMemory 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";