Quick start
1. Install the SDK
npm install @lumi-node/locus-sdk @solana/web3.js
2. Read live, attested usage (no wallet needed)
This is the exact data behind the homepage counter. It reads the program’s on-chain accounts directly — browser-safe and read-only.
import { Connection } from "@solana/web3.js";
import { getProtocolUsage, DEFAULT_DEVNET_RPC } from "@lumi-node/locus-sdk";
const connection = new Connection(DEFAULT_DEVNET_RPC, "confirmed");
const usage = await getProtocolUsage(connection);
console.log(usage.agents); // registered agents
console.log(usage.totalReads); // Σ read_count — attested retrievals
console.log(usage.totalWrites); // Σ write_count — memory commits
console.log(usage.attestations); // RetrievalAttestation accounts
3. Run the protocol locally
Start the ARMS service from the upstream repo:
cargo run --release -p arms-service -- --dim 64
Then drive it from TypeScript:
import { ArmsClient } from "@lumi-node/locus-sdk";
const arms = new ArmsClient("http://localhost:8080");
await arms.place("wallet-1", new Array(64).fill(0).map(() => Math.random()), { label: "dex" });
const neighbors = await arms.query(new Array(64).fill(0.1), 10);
4. Commit memory and attest a retrieval
Write paths take an explicit Keypair. Fund it first
(solana airdrop 1 <PUBKEY> --url devnet).
import { Connection, Keypair } from "@solana/web3.js";
import { LocusClient } from "@lumi-node/locus-sdk";
const connection = new Connection("https://api.devnet.solana.com", "confirmed");
const locus = new LocusClient(connection, { armsEndpoint: "http://localhost:8080" });
const owner = Keypair.generate();
await locus.initializeAgent(owner, 1000n, "https://example.com/agent.json");
await locus.commitMemory(owner, new Uint8Array(32).fill(7));
const result = await locus.queryWithAttestation(owner, owner.publicKey, embedding, 10);
console.log("attestation:", result.attestationPda.toBase58());
console.log("signature:", result.signature);
Verify the resulting attestation on Solscan.