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.
import { provaPlugin } from "@prova/plugin-eliza";// Add to your character configuration:
{
"plugins": [provaPlugin],
"settings": {
"secrets": {
"PROVA_RPC_URL": "...",
"PROVA_WALLET_PRIVATE_KEY": "..."
}
}
}Once configured, the agent will automatically hash and attest every tool call and blockchain transaction it executes.
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).
// Rust CPI Example
prova_agent_program::cpi::record_attestation(
CpiContext::new(
prova_program.to_account_info(),
RecordAttestation {
agent: agent_account.to_account_info(),
operator: operator.to_account_info(),
system_program: system_program.to_account_info(),
},
),
action_hash,
action_type,
privacy_mode
)?;