Blockchain & On-Chain Agents Best Practices
Ten practices for shipping agent tools that touch Solana (or any chain) without turning retries and hallucinations into lost funds.
Busque em todas as páginas da documentação
Ten practices for shipping agent tools that touch Solana (or any chain) without turning retries and hallucinations into lost funds.
Use this list when you design a new transfer/payment tool, review a PR that adds signing, or promote an agent from devnet to mainnet.
intentId maps to at most one successful signature; retries return the original receipt.send acceptance as settlement; persist signature and status transitions.| Stage | Habits | Exit criterion |
|---|---|---|
| Design | 1-3 | Tool map + wallet topology + secret boundary written |
| Implement | 4-6 | Intent store, confirms, unit/cluster guards in code |
| Control | 7-8 | Approval thresholds + policy engine/allowlists live |
| Release | 9-10 | Devnet evidence + audit trail before mainnet canary |
intentId inside the tool on each retry.findReference / RPC polls.validateTransfer after Solana Pay detection..env to production and changing only the slogan in README.intentId (from workflow)
-> validate schema (cap, pubkey, cluster)
-> claim intent row (pending)
-> optional human/policy approve
-> sign via custody or limited hot key
-> broadcast + confirm
-> store signature (confirmed)
-> agent continues with receipt only// Sketch: refuse writes without intent + cluster pin
function assertSpendAllowed(args: { intentId: string; sol: number }, cluster: string) {
if (cluster !== process.env.EXPECTED_CLUSTER) throw new Error("cluster mismatch");
if (!args.intentId || args.intentId.length < 8) throw new Error("intentId required");
if (args.sol > Number(process.env.MAX_AUTO_SOL ?? "0.01")) throw new Error("over cap");
}Idempotency (4), confirm-before-continue (5), key separation (3), and caps/allowlists outside the prompt (8). Without those, autonomy is gambling.
They still need cluster pinning, rate limits, and no secret leakage. Spend-specific items apply when you add the first write tool.
No. It is one strong custody option. Low balances + KMS + policy may suffice early; institutional setups often want MPC + policy engines.
All standard rules still apply (sandboxing, least privilege, injection resistance). On-chain tools raise the severity of failure, so approval and idempotency become first-class.
Only if policy engines and economic caps truly bound loss. Multiple agents sharing one unlimited key are worse, not better.
Spend per intent, duplicate rate, policy denials, failed confirms, vault balance, and any tool call missing an intentId.
After clean canaries, stable metrics, and explicit finance approval. Raise slowly; never jump from demo caps to treasury-sized caps.
Guardrails explainer, transfer tool recipe, Solana Pay verification, idempotency deep dive, custody options, and the devnet cheatsheet in this section.
Related: Why On-Chain Agents Need Different Guardrails Than Other Tools
Related: Blockchain & On-Chain Agents Basics
Related: Idempotency and Double-Spend Protection for On-Chain Agent Actions
Related: Key Management for Agent-Controlled Wallets: Fireblocks and Alternatives
Related: Testing On-Chain Agent Flows on Devnet Before Mainnet
Related: Solana Pay: Verifying Payments via Webhook or Polling
Stack versions: Pins from the category manifest (verify at build): OpenRouter (~315+ models, July 2026 pricing/fees); LangGraph 1.0+; CrewAI 1.14+; Microsoft Agent Framework 1.0; Vercel AI SDK 6; Pydantic AI (latest); LlamaIndex (latest); OpenAI Agents SDK (latest + MCP); MCP (Linux Foundation governance); A2A (HTTP+SSE+JSON-RPC 2.0); Solana
@solana/web3.js+@solana/spl-token.
Revisado por Chris St. John·Última atualização: 16 de jul. de 2026