Full lesson
accural
A coordination protocol to give AI agents economic agency by acting as a bridge between agent logic and on-chain settlement
What it does
From the project README:
Accural lets autonomous AI agents move real money across on-chain rails (SPL tokens, ERC-20) and fiat rails (Stripe cards, Razorpay UPI) without either (a) a human signing every action or (b) an agent holding unsupervised custody. Every spend — on-chain or fiat — is gated by the same policy engine: per-transaction caps, rolling budget windows, approval thresholds with owner co-signature, recipient blocklists, and immutable reconciliation records.
- Original
- dwan-ith/accural
- SuperStack fork
- Blockchains/accural @
fa08e64 - Stars
- 1
- Last push (original)
- 2026-08-30
- Languages
- TypeScript, Rust, Solidity, JavaScript, HTML, CSS
- Detected stack
- Anchorweb3.js
- Categories
- AI & Agents
- Licence
- MIT
- Homepage
- https://accural-protocol.vercel.app
Architecture
45 source files. By extension: .ts ×42, .sol ×1, .js ×1, .rs ×1.
| Top-level directory | Source files |
|---|---|
client | 44 |
programs | 1 |
On-chain programs: programs/accural
Dapp: devnet deploy pending
⏳ Devnet deploy pending — goes live when the devnet wallet is topped up. This fork's own dapp is not deployed yet, so there is no program address or transaction to show. It is queued in dapp-queue.txt; once devnet SOL is available it is deployed, exercised with real devnet transactions, and this section switches to the live dapp at /dapps/accural/. Until then, the lesson and step-by-step guide below are complete, and you can run it locally with the commands below.
Key code, explained
Excerpts chosen automatically where the code uses the most Solana concepts, pinned to the fork's commit.
programs/accural/src/lib.rs L997–1020 @ fa08e64 · MIT · original space = AgentReputation::LEN, seeds = [b"reputation", agent_registry.key().as_ref()], bump )] pub agent_reputation: Box<Account<'info, AgentReputation>>, pub system_program: Program<'info, System>,} #[derive(Accounts)]pub struct SetDelegate<'info> { #[account(mut)] pub owner: Signer<'info>, #[account(has_one = owner)] pub agent_registry: Box<Account<'info, AgentRegistry>>, /// CHECK: Nominated delegate key. Its address binds the delegate PDA /// below; no signature required to nominate or revoke. pub delegate: UncheckedAccount<'info>, /// Safe use of init_if_needed: the PDA binds (registry, delegate), the /// only writer is the owner-gated set_delegate instruction, and the /// account is never closed, so re-initialization attacks are impossible.- Line 998
seeds = [b"reputation", agent_registry.key().as_ref()],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match. - Line 999
bump: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve. - Line 1009
pub owner: Signer<'info>,: Requires this account to have signed the transaction. - Line 1011
#[account(has_one = owner)]: Checks that a stored pubkey field matches the passed account. - Line 1018
/// Safe use of init_if_needed: the PDA binds (registry, delegate), the: Creates the account only if it doesn't exist. Watch for re-initialisation bugs.
client/src/solana/execute-bundle.ts L1–24 @ fa08e64 · MIT · originalimport { createHash } from "node:crypto";import { Keypair, PublicKey, SystemProgram, Transaction, TransactionInstruction, sendAndConfirmTransaction,} from "@solana/web3.js";import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID,} from "@solana/spl-token";import { ACCURAL_PROGRAM_ID, type AccuralSolanaClient, type InstructionPlan, type TransactionBundlePlan,} from "./accural-client.js";import { canonicalJson } from "../money.js"; /** * Programs a bundle may invoke. The bundle executor is the component that- Line 8
sendAndConfirmTransaction,: Submits the signed transaction to the cluster. - Line 12
TOKEN_2022_PROGRAM_ID,: Targets the Token-2022 program instead of the original Token Program.
client/src/solana/accural-client.ts L1–24 @ fa08e64 · MIT · originalimport assert from "node:assert/strict";import { createHash } from "node:crypto";import { Connection, Keypair, LAMPORTS_PER_SOL, PublicKey, SystemProgram, Transaction, TransactionInstruction, sendAndConfirmTransaction,} from "@solana/web3.js";import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID, createAssociatedTokenAccountIdempotentInstruction, getAssociatedTokenAddressSync,} from "@solana/spl-token";import { solanaRpcUrl } from "../config.js";import { canonicalJson } from "../money.js"; export const ACCURAL_PROGRAM_ID = new PublicKey("HTVTUMeyRkpbakNASCQ44MzgjxKjrV5oG8rBSavMiPCS");export const ACTION_REQUEST_PAYMENT = 1 << 0;- Line 11
sendAndConfirmTransaction,: Submits the signed transaction to the cluster. - Line 15
TOKEN_2022_PROGRAM_ID,: Targets the Token-2022 program instead of the original Token Program.
How to run, build and test
These commands come from the repo's own manifests (package.json scripts, Anchor.toml, Cargo, go.mod, Makefile). Check the README for prerequisites and environment variables.
| Directory | Command | Runs |
|---|---|---|
. | anchor build | compile programs and generate IDLs |
. | anchor test | local validator + test suite |
. | anchor run test | cd client && npm test |
. | cargo build | Rust workspace build |
. | cargo test | Rust tests |
What you could build from it
- Fork the SuperStack copy and extend it within the AI & Agents gaps listed on the idea page.
- Learn the pattern first: AI agents on Solana
- Learn the pattern first: Building and sending transactions from a client