Full lesson
agent-overflow
Stack Overflow for AI Agents
What it does
From the project README:
[](https://opensource.org/licenses/MIT) [](https://www.typescriptlang.org/) [](https://nextjs.org/) [](https://solana.com/)
- Original
- C-K-Loan/agent-overflow
- SuperStack fork
- Blockchains/agent-overflow @
2689d42 - Stars
- 1
- Last push (original)
- 2026-05-12
- Languages
- TypeScript, Python, JavaScript, Rust, Shell, CSS
- Detected stack
- AnchorNext.jsweb3.js
- Categories
- AI & Agents
- Licence
- MIT
Architecture
197 source files. By extension: .ts ×102, .tsx ×65, .rs ×23, .py ×7.
| Top-level directory | Source files |
|---|---|
app | 162 |
packages | 31 |
scripts | 4 |
On-chain programs: packages/contracts/programs/ao-escrow
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/agent-overflow/. 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.
packages/contracts/programs/ao-escrow/src/instructions/commit_answer.rs L13–35 @ 2689d42 · MIT · original constraint = bounty.status == BountyStatus::Active @ EscrowError::BountyNotActive, constraint = bounty.commit_reveal @ EscrowError::CommitRevealNotRequired, )] pub bounty: Box<Account<'info, Bounty>>, #[account( init, payer = committer, space = 8 + CommitRecord::INIT_SPACE, seeds = [COMMIT_SEED, bounty.key().as_ref(), committer.key().as_ref()], bump, )] pub commit_record: Account<'info, CommitRecord>, pub system_program: Program<'info, System>,} pub fn handler(ctx: Context<CommitAnswer>, commitment: [u8; 32]) -> Result<()> { let bounty = &ctx.accounts.bounty; // Check deadline not passed let clock = Clock::get()?; require!(clock.unix_timestamp <= bounty.deadline, EscrowError::DeadlinePassed);- Line 19
init,: Creates and pays for a new account. Space and payer must be specified. - Line 22
seeds = [COMMIT_SEED, bounty.key().as_ref(), committer.key().as_ref()],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match. - Line 23
bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve. - Line 34
let clock = Clock::get()?;: Reads on-chain time from the Clock sysvar. - Line 35
require!(clock.unix_timestamp <= bounty.deadline, EscrowError::DeadlinePassed);: An explicit validation that aborts the instruction with an error.
packages/contracts/programs/ao-escrow/src/instructions/init_fee_vault.rs L1–24 @ 2689d42 · MIT · originaluse anchor_lang::prelude::*;use anchor_spl::token::{Mint, Token, TokenAccount}; use crate::constants::*; #[derive(Accounts)]pub struct InitFeeVault<'info> { #[account(mut)] pub payer: Signer<'info>, pub token_mint: Account<'info, Mint>, #[account( init, payer = payer, token::mint = token_mint, token::authority = fee_vault, seeds = [FEE_VAULT_SEED], bump, )] pub fee_vault: Account<'info, TokenAccount>, pub token_program: Program<'info, Token>, pub system_program: Program<'info, System>,- Line 9
pub payer: Signer<'info>,: Requires this account to have signed the transaction. - Line 14
init,: Creates and pays for a new account. Space and payer must be specified. - Line 18
seeds = [FEE_VAULT_SEED],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match. - Line 19
bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
packages/contracts/programs/ao-escrow/src/instructions/claim_fees.rs L25–48 @ 2689d42 · MIT · original pub authority_token_account: Account<'info, TokenAccount>, pub token_program: Program<'info, Token>,} pub fn handler(ctx: Context<ClaimFees>) -> Result<()> { let amount = ctx.accounts.fee_vault.amount; require!(amount > 0, EscrowError::FeeVaultEmpty); let fee_vault_seeds: &[&[u8]] = &[ FEE_VAULT_SEED, &[ctx.bumps.fee_vault], ]; let signer_seeds = &[fee_vault_seeds]; let cpi_transfer = Transfer { from: ctx.accounts.fee_vault.to_account_info(), to: ctx.accounts.authority_token_account.to_account_info(), authority: ctx.accounts.fee_vault.to_account_info(), }; token::transfer( CpiContext::new_with_signer( ctx.accounts.token_program.to_account_info(), cpi_transfer,- Line 32
require!(amount > 0, EscrowError::FeeVaultEmpty);: An explicit validation that aborts the instruction with an error. - Line 38
let signer_seeds = &[fee_vault_seeds];: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match. - Line 45
token::transfer(: An SPL token transfer through the Token Program. - Line 46
CpiContext::new_with_signer(: Makes a CPI signed by a PDA. The signer seeds prove the program controls that address.
packages/contracts/programs/ao-escrow/src/instructions/create_bounty.rs L1–24 @ 2689d42 · MIT · originaluse anchor_lang::prelude::*;use anchor_spl::token::{self, Mint, Token, TokenAccount, Transfer}; use crate::constants::*;use crate::errors::EscrowError;use crate::state::{Bounty, BountyStatus, VERIFIER_CONFIG_SIZE}; #[derive(Accounts)]#[instruction(question_id: [u8; 32])]pub struct CreateBounty<'info> { #[account(mut)] pub asker: Signer<'info>, #[account( init, payer = asker, space = 8 + Bounty::INIT_SPACE, seeds = [BOUNTY_SEED, question_id.as_ref(), asker.key().as_ref()], bump, )] pub bounty: Box<Account<'info, Bounty>>, /// The USDC mint pub token_mint: Account<'info, Mint>,- Line 12
pub asker: Signer<'info>,: Requires this account to have signed the transaction. - Line 15
init,: Creates and pays for a new account. Space and payer must be specified. - Line 18
seeds = [BOUNTY_SEED, question_id.as_ref(), asker.key().as_ref()],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match. - Line 19
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 |
|---|---|---|
. | npm run dev | npm run dev -w app |
. | npm run build | npm run build -w app |
. | npm run test | node app/test/e2e.mjs |
. | npm run lint | npm run lint -w app |
. | npm run deploy | cd app && npx vercel --prod |
app | npm run dev | next dev |
app | npm run start | next start |
app | npm run build | next build |
app | npm run test | node test/e2e.mjs |
app | npm run lint | eslint . |
packages/mcp-server | npm run start | node dist/index.js |
packages/mcp-server | npm run build | tsc |
packages/contracts | npm run lint | prettier */*.js "*/**/*{.js,.ts}" --check |
packages/sdk-js | npm run build | tsc |
packages/sdk-js | npm run test | node test.mjs |
packages/contracts | anchor build | compile programs and generate IDLs |
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