Sol.College

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 directorySource files
programs8

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.

xka0085-byte/agenttoll · programs/agenttoll/src/instructions/verify_receipt.rs L1–24 @ 88e2241 · MIT · original
use 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(),
  1. Line 8 pub verifier: Signer<'info>,: Requires this account to have signed the transaction.
  2. 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.
  3. Line 11 bump = receipt.bump: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
  4. Line 21 require!(ctx.accounts.receipt.report_id == report_id, AgentTollError::DigestMismatch);: An explicit validation that aborts the instruction with an error.
  5. Line 23 emit!(crate::ReceiptVerified {: Emits an Anchor event that clients can parse from the logs.
xka0085-byte/agenttoll · programs/agenttoll/src/instructions/create_receipt.rs L1–24 @ 88e2241 · MIT · original
use 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],
  1. Line 9 pub vendor: Signer<'info>,: Requires this account to have signed the transaction.
  2. Line 11 init_if_needed,: Creates the account only if it doesn't exist. Watch for re-initialisation bugs.
  3. 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.
  4. 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.

DirectoryCommandRuns
receipts-service-deploynpm run startnode server.mjs
receipts-service-deploynpm run testnode test/cross-verify.mjs
receipts-servicenpm run startnode server.mjs
receipts-servicenpm run testnode test/cross-verify.mjs
.anchor buildcompile programs and generate IDLs
.anchor testlocal validator + test suite
.anchor run testcargo test
.cargo buildRust workspace build
.cargo testRust tests

What you could build from it

Used in lessons