Getting Started
From npm install to a verified on-chain receipt in under five minutes. This guide walks through registering an agent and issuing your first attestations on Solana Devnet.
Prerequisites
- Node.js 18 or newer.
- A Solana RPC endpoint (Helius Devnet is recommended for stability).
- A Devnet wallet with some SOL for fees — get it free with
solana airdrop 2or atfaucet.solana.com.
1. Install the SDK
npm install prova-agent-sdk
2. Prepare your keypairs
Prova separates two identities: the agent (the AI that acts and signs each action hash) and the operator (the wallet accountable for it — it owns the on-chain account and pays transaction fees).
import { Keypair } from '@solana/web3.js';
// Agent keypair: signs each action hash (Ed25519, off-chain).
// Operator keypair: owns the agent PDA, pays fees, signs transactions.
const agentKeypair = Keypair.fromSecretKey(agentSecretKey);
const operatorKeypair = Keypair.fromSecretKey(operatorSecretKey);Never hardcode or commit secret keys. Load them from environment variables or a secret manager.
3. Initialize the client
import { ProvaClient } from 'prova-agent-sdk';
const client = new ProvaClient({
rpcUrl: process.env.SOLANA_RPC_URL!, // Helius devnet recommended
agentKeypair,
});4. Register your agent
Registration creates the agent account (a PDA derived from the operator public key) on-chain. It is a one-time step per operator, costing only rent exemption (~0.001 SOL).
const registration = await client.registerAgent({
operatorKeypair,
// policyRoot?: Uint8Array — optional 32-byte Merkle root of your policy
});
console.log('Agent PDA:', registration.agentPda.toBase58());
console.log('Explorer :', registration.explorerUrl);5. Issue your first attestation
Hash any structured payload describing the action, then seal it. The hash is deterministic: the same action always produces the same hash, so third parties can recompute and verify it.
const actionHash = await ProvaClient.hashAction(
JSON.stringify({ operation: 'transfer', amount: '500', token: 'USDC' })
);
const receipt = await client.attest({
operatorKeypair,
actionHash, // 32 bytes, SHA-256
actionType: 'Transaction', // default: 'Transaction'
privacyMode: false, // true → hash on-chain, payload stays off-chain
});
console.log('Receipt tx:', receipt.txSignature);
console.log('Explorer :', receipt.explorerUrl);6. Batch high-frequency actions
Agents that act frequently should batch. One transaction carries up to 100 attestations, dividing the cost per receipt accordingly.
// Up to 100 attestations in ONE Solana transaction.
const batch = await client.batchAttest({
operatorKeypair,
attestations: [
{ actionHash: hash1, actionType: 'ToolCall' },
{ actionHash: hash2, actionType: 'Decision', privacyMode: true },
{ actionHash: hash3, actionType: 'ModelInvocation' },
],
});7. Verify it
- Open the
explorerUrlfrom the receipt to see the transaction on Solana Explorer. - Search your agent PDA in the Prova Explorer at
theprova.xyz/explorerfor the live, human-readable view. - Or query the REST API directly:
import { ProvaApiClient } from 'prova-agent-sdk';
const api = new ProvaApiClient({ apiUrl: 'https://prova-api.fly.dev' });
const { data } = await api.listAttestations({
agentPda: registration.agentPda.toBase58(),
limit: 20,
});Next steps
- Using Solana Agent Kit? The Agent Kit Adapter attests every action automatically — no manual
attest()calls. - Read Core Concepts to understand what exactly lands on-chain and how privacy mode works.
- Building in Rust? See the Rust SDK page.