Full lesson
agent-bazaar
Decentralized AI agent marketplace with x402 payments
What it does
From the project README:
A technical demonstration bridging the Model Context Protocol (MCP) with x402 payments on Solana devnet. Hackathon submission, not a launched product.
- Original
- CoKeFish/agent-bazaar
- SuperStack fork
- Blockchains/agent-bazaar @
89a3a14 - Stars
- 0
- Last push (original)
- 2026-07-07
- Languages
- TypeScript, CSS, Astro, Rust, JavaScript, Python
- Detected stack
- Anchorweb3.js
- Categories
- AI & AgentsPayments
- Licence
- MIT
Architecture
118 source files. By extension: .ts ×69, .tsx ×41, .rs ×6, .py ×1, .js ×1.
| Top-level directory | Source files |
|---|---|
packages | 117 |
scripts | 1 |
On-chain programs: packages/contracts/programs/agent-bazaar
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-bazaar/. 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/agent-bazaar/src/lib.rs L373–396 @ 89a3a14 · MIT · original #[account( mut, seeds = [b"agent", agent.service.as_bytes()], bump = agent.bump, has_one = owner, close = owner, )] pub agent: Account<'info, Agent>, #[account(mut)] pub owner: Signer<'info>,} #[derive(Accounts)]#[instruction(nonce: u64, amount: u64)]pub struct OpenEscrow<'info> { pub agent: Account<'info, Agent>, #[account( init, payer = client, space = 8 + Escrow::LEN, seeds = [ b"escrow",- Line 375
seeds = [b"agent", agent.service.as_bytes()],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match. - Line 376
bump = agent.bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve. - Line 377
has_one = owner,: Checks that a stored pubkey field matches the passed account. - Line 378
close = owner,: Closes the account at the end of the instruction and refunds its lamports. - Line 383
pub owner: Signer<'info>,: Requires this account to have signed the transaction. - Line 392
init,: Creates and pays for a new account. Space and payer must be specified.
packages/sdk/src/program.ts L181–203 @ 89a3a14 · MIT · original // ─── Senders (firman + envían + esperan confirmación) ─────── async sendAndConfirm( instructions: TransactionInstruction[], payer: Keypair, extraSigners: Keypair[] = [], ): Promise<string> { const { blockhash, lastValidBlockHeight } = await this.connection.getLatestBlockhash('confirmed'); const message = new TransactionMessage({ payerKey: payer.publicKey, recentBlockhash: blockhash, instructions, }).compileToV0Message(); const tx = new VersionedTransaction(message); tx.sign([payer, ...extraSigners]); const sig = await this.connection.sendTransaction(tx, { skipPreflight: false, maxRetries: 3 }); await this.connection.confirmTransaction( { signature: sig, blockhash, lastValidBlockHeight }, 'confirmed', ); return sig; }- Line 189
const { blockhash, lastValidBlockHeight } = await this.connection.getLatestBlockhash('conf: Fetches a recent blockhash. Transactions expire if it gets too old. - Line 197
const sig = await this.connection.sendTransaction(tx, { skipPreflight: false, maxRetries:: Submits the signed transaction to the cluster.
packages/sdk/src/chain/stellar.ts L85–108 @ 89a3a14 · MIT · original return this.keypair.publicKey(); } // ─── helpers de invocación ───────────────────────────────── /** Método que cambia estado: prepara (simula + footprint + auth), firma, envía y espera. */ private async invoke(method: string, args: xdr.ScVal[]): Promise<string> { const source = await this.server.getAccount(this.keypair.publicKey()); const tx = new TransactionBuilder(source, { fee: BASE_FEE, networkPassphrase: this.networkPassphrase, }) .addOperation(this.contract.call(method, ...args)) .setTimeout(30) .build(); const prepared = await this.server.prepareTransaction(tx); prepared.sign(this.keypair); const sent = await this.server.sendTransaction(prepared); if (sent.status === 'ERROR') { throw new Error( `[${this.label}] ${method} rechazada: ${JSON.stringify(sent.errorResult)}`, );- Line 91
private async invoke(method: string, args: xdr.ScVal[]): Promise<string> {: Makes a cross-program invocation into another program. - Line 104
const sent = await this.server.sendTransaction(prepared);: Submits the signed transaction to the cluster.
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 | docker compose up |
docs/slidev | npm run dev | slidev --open |
docs/slidev | npm run build | slidev build |
packages/dashboard | npm run dev | vite --host 0.0.0.0 |
packages/dashboard | npm run build | tsc -b && vite build |
packages/mcp-server | npm run dev | tsx src/index.ts |
packages/mcp-server | npm run start | node dist/index.js |
packages/mcp-server | npm run build | tsc |
packages/mcp-server | npm run test | node --import tsx --test --test-reporter=spec test/auth.test.ts test/tools.test.ts |
packages/contracts | npm run build | anchor build |
packages/contracts | npm run test | anchor test --skip-local-validator |
packages/contracts | npm run deploy | anchor deploy --provider.cluster devnet |
packages/demo-agents | npm run dev | concurrently "npm:dev:yield" "npm:dev:risk" "npm:dev:translator" "npm:dev:price" "npm:dev:code" |
packages/demo-agents | npm run build | tsc |
packages/orchestrator-agent | npm run dev | tsx watch src/index.ts |
packages/orchestrator-agent | npm run start | node dist/index.js |
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