Examples
Code Examples
Real-world examples showing how to integrate Prova into your existing agent architectures.
elizaOS Plugin
The easiest way to integrate Prova with an elizaOS agent is via the official plugin (npm: prova-plugin-eliza).
import { provaPlugin, attesterFromProvaClient } from "prova-plugin-eliza";
import { ProvaClient } from "prova-agent-sdk";
const prova = new ProvaClient({ rpcUrl, agentKeypair });
const attester = attesterFromProvaClient(
prova, ProvaClient.hashAction, operatorKeypair,
);
// Add to your runtime's plugins array:
const runtime = new AgentRuntime({
// ...character, model provider, etc.
plugins: [provaPlugin({ attester })],
});Once configured, the agent automatically hashes and attests every action it executes — bursts are batched into a single Solana transaction, and a Prova failure never breaks the action.
DeFi Swap Agent
If you are building a custom agent using the @solana/web3.js library, you can manually wrap Jupiter swaps.
// 1. Agent executes swap
const swapTx = await jupiter.executeSwap(route);
// 2. Hash swap parameters
const hash = await ProvaClient.hashAction(JSON.stringify(route));
// 3. Issue attestation
await provaClient.attest({
operatorKeypair: wallet,
actionHash: hash,
actionType: "Transaction"
});Native Anchor CPI
Solana programs can invoke the Prova contract directly via Cross-Program Invocation (CPI). The Ed25519 pre-verify instruction must be added at the transaction level by the client — the program validates it through the instructions sysvar.
// Rust CPI Example (prova-program with the "cpi" feature)
let cpi_ctx = CpiContext::new(
prova_program.to_account_info(),
prova_program::cpi::accounts::RecordAttestations {
agent: agent_account.to_account_info(),
operator: operator.to_account_info(),
instructions: instructions_sysvar.to_account_info(),
},
);
prova_program::cpi::record_attestations(cpi_ctx, vec![AttestationInput {
action_type: ActionType::ToolCall,
action_hash,
privacy_mode: false,
signature,
}])?;