Full lesson
agenttoll
ReceiptRail: on-chain delivery receipts for AI agent payments (x402/stablecoin). Plus the Agent/Chain Evidence Tools suite hub of read-only diagnostics CLIs.
What it does
From the project README:
[](https://github.com/xka0085-byte/agenttoll/actions/workflows/ci.yml) [](https://mcpservers.org/servers/xka0085-byte/agenttoll)
- Original
- xka0085-byte/agenttoll
- SuperStack fork
- Blockchains/agenttoll @
88e2241 - Stars
- 0
- Last push (original)
- 2026-10-09
- Languages
- JavaScript, HTML, Rust, Shell, Dockerfile
- Detected stack
- Anchorweb3.js
- Categories
- AI & AgentsDeFi
- Licence
- MIT
- Homepage
- https://xka0085-byte.github.io/evidence-tools/
Architecture
8 source files. By extension: .rs ×8.
| Top-level directory | Source files |
|---|---|
programs | 8 |
On-chain programs: programs/agenttoll
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/agenttoll/. 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/agenttoll/src/instructions/verify_receipt.rs L1–24 @ 88e2241 · MIT · originaluse anchor_lang::prelude::*; use crate::{constants::RECEIPT_SEED, error::AgentTollError, state::Receipt}; #[derive(Accounts)]#[instruction(report_id: String, digest: [u8; 32])]pub struct VerifyReceipt<'info> { pub verifier: Signer<'info>, #[account( seeds = [RECEIPT_SEED, receipt.vendor.as_ref(), report_id.as_bytes()], bump = receipt.bump )] pub receipt: Account<'info, Receipt>,} pub fn handle_verify_receipt( ctx: Context<VerifyReceipt>, report_id: String, digest: [u8; 32],) -> Result<()> { require!(ctx.accounts.receipt.report_id == report_id, AgentTollError::DigestMismatch); require!(ctx.accounts.receipt.digest == digest, AgentTollError::DigestMismatch); emit!(crate::ReceiptVerified { verifier: ctx.accounts.verifier.key(),- Line 8
pub verifier: Signer<'info>,: Requires this account to have signed the transaction. - Line 10
seeds = [RECEIPT_SEED, receipt.vendor.as_ref(), report_id.as_bytes()],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match. - Line 11
bump = receipt.bump: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve. - Line 21
require!(ctx.accounts.receipt.report_id == report_id, AgentTollError::DigestMismatch);: An explicit validation that aborts the instruction with an error. - Line 23
emit!(crate::ReceiptVerified {: Emits an Anchor event that clients can parse from the logs.
programs/agenttoll/src/instructions/create_receipt.rs L1–24 @ 88e2241 · MIT · originaluse anchor_lang::prelude::*; use crate::{constants::*, error::AgentTollError, state::Receipt}; #[derive(Accounts)]#[instruction(report_id: String, digest: [u8; 32])]pub struct CreateReceipt<'info> { #[account(mut)] pub vendor: Signer<'info>, #[account( init_if_needed, payer = vendor, space = 8 + Receipt::INIT_SPACE, seeds = [RECEIPT_SEED, vendor.key().as_ref(), report_id.as_bytes()], bump )] pub receipt: Account<'info, Receipt>, pub system_program: Program<'info, System>,} pub fn handle_create_receipt( ctx: Context<CreateReceipt>, report_id: String, digest: [u8; 32],- Line 9
pub vendor: Signer<'info>,: Requires this account to have signed the transaction. - Line 11
init_if_needed,: Creates the account only if it doesn't exist. Watch for re-initialisation bugs. - Line 14
seeds = [RECEIPT_SEED, vendor.key().as_ref(), report_id.as_bytes()],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match. - Line 15
bump: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
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 |
|---|---|---|
receipts-service-deploy | npm run start | node server.mjs |
receipts-service-deploy | npm run test | node test/cross-verify.mjs |
receipts-service | npm run start | node server.mjs |
receipts-service | npm run test | node test/cross-verify.mjs |
. | anchor build | compile programs and generate IDLs |
. | anchor test | local validator + test suite |
. | anchor run test | cargo 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