Full lesson
AABC-Labs-v1
The Ultimate Form of Blockchain AI Agents. Deploy AI agents that interact with smart contracts, launch tokens, build websites, and connect the crypto ecosystem.
What it does
From the project README:
[](https://opensource.org/licenses/MIT) [](https://www.python.org/downloads/) [](https://nodejs.org/) [](https://solana.com/)
- Original
- labsaistudio/AABC-Labs-v1
- SuperStack fork
- Blockchains/AABC-Labs-v1 @
5eadce8 - Stars
- 1
- Last push (original)
- 2025-11-11
- Languages
- Python, JavaScript, TypeScript, PLpgSQL, Dockerfile, Shell
- Detected stack
- Next.jsSolana Agent Kitweb3.js
- Categories
- AI & Agents
- Licence
- MIT
Architecture
103 source files. By extension: .py ×70, .js ×25, .ts ×7, .tsx ×1.
| Top-level directory | Source files |
|---|---|
agent | 56 |
solana-bridge | 25 |
blockchain_tools | 7 |
backend | 7 |
frontend | 6 |
gateway | 2 |
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/aabc-labs-v1/. 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.
gateway/src/x402-bridge.ts L1–24 @ 5eadce8 · MIT · originalimport { Connection, Keypair, PublicKey, SystemProgram, Transaction } from '@solana/web3.js'import { createTransferCheckedInstruction, getAssociatedTokenAddress } from '@solana/spl-token'import bs58 from 'bs58' // X402 Payment Protocol Typesinterface PaymentRequirements { maxAmountRequired: string // Atomic units (micro-USDC on mainnet, lamports on devnet) asset: string // USDC mint address (mainnet) or 'SOL' (devnet) description: string resource: string} interface X402Payment { x402Version: number // v1.0 uses number 1, not string scheme: string network: string payload: string // Base64 encoded transaction} // Initialize Solana connection (mainnet by default)const connection = new Connection( process.env.SOLANA_RPC_URL || 'https://api.mainnet-beta.solana.com', 'confirmed')- Line 2
import { createTransferCheckedInstruction, getAssociatedTokenAddress } from '@solana/spl-t: A checked token transfer, which also verifies the mint and decimals. - Line 14
x402Version: number // v1.0 uses number 1, not string: Uses x402, an HTTP 402 pattern where an agent pays per request with an on-chain payment.
gateway/src/index.ts L265–287 @ 5eadce8 · MIT · original ) const createTx = new Transaction().add(createIx) createTx.feePayer = agent.publicKey const createBlockhash = await conn.getLatestBlockhash('finalized') createTx.recentBlockhash = createBlockhash.blockhash createTx.sign(agent) const createSig = await conn.sendRawTransaction(createTx.serialize(), { skipPreflight: false }) console.log('[Gateway] Create ATA transaction sent:', createSig) await conn.confirmTransaction(createSig, 'confirmed') console.log('[Gateway] Treasury token account created ✓') } // Per teacher's guidance (010.txt line 138-146): // Only 1 transferChecked instruction, no Memo const transferIx = createTransferCheckedInstruction( agentAta, new PublicKey(USDC), // Must use mint address from accept.asset destAta, agent.publicKey, priceAtomic, 6 // USDC decimals )- Line 268
const createBlockhash = await conn.getLatestBlockhash('finalized'): Fetches a recent blockhash. Transactions expire if it gets too old. - Line 280
const transferIx = createTransferCheckedInstruction(: A checked token transfer, which also verifies the mint and decimals.
frontend/src/app/x402-test/page.tsx L37–60 @ 5eadce8 · MIT · original const connection = new Connection( process.env.NEXT_PUBLIC_SOLANA_RPC_URL || 'https://api.mainnet-beta.solana.com' ) const fromTokenAccount = await getAssociatedTokenAddress( USDC_MINT, publicKey ) const toTokenAccount = await getAssociatedTokenAddress( USDC_MINT, TREASURY_WALLET ) const transaction = new Transaction().add( createTransferInstruction( fromTokenAccount, toTokenAccount, publicKey, PRICE_USDC ) ) const { blockhash } = await connection.getLatestBlockhash()- Line 52
createTransferInstruction(: An SPL token transfer through the Token Program. - Line 60
const { blockhash } = await connection.getLatestBlockhash(): Fetches a recent blockhash. Transactions expire if it gets too old.
frontend/src/lib/x402-client.ts L85–108 @ 5eadce8 · MIT · original const usdcMint = new PublicKey(USDC_MINT); const treasuryPubkey = new PublicKey(treasuryAddress); const senderTokenAccount = await getAssociatedTokenAddress( usdcMint, publicKey ); const recipientTokenAccount = await getAssociatedTokenAddress( usdcMint, treasuryPubkey ); const transferInstruction = createTransferCheckedInstruction( senderTokenAccount, usdcMint, recipientTokenAccount, publicKey, amountMicroUsdc, USDC_DECIMALS ); const { blockhash } = await connection.getLatestBlockhash('confirmed'); const transaction = new Transaction({- Line 98
const transferInstruction = createTransferCheckedInstruction(: A checked token transfer, which also verifies the mint and decimals. - Line 107
const { blockhash } = await connection.getLatestBlockhash('confirmed');: Fetches a recent blockhash. Transactions expire if it gets too old.
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 |
|---|---|---|
gateway | npm run dev | tsx watch src/index.ts |
gateway | npm run start | node dist/index.js |
gateway | npm run build | tsc |
gateway | npm run test | jest |
frontend | npm run dev | next dev |
frontend | npm run start | next start |
frontend | npm run build | next build |
frontend | npm run lint | next lint |
solana-bridge | npm run dev | nodemon index.js |
solana-bridge | npm run start | node index.js |
solana-bridge | npm run test | jest |
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