Sol.College

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 directorySource files
packages117
scripts1

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.

CoKeFish/agent-bazaar · 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",
  1. 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.
  2. Line 376 bump = agent.bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
  3. Line 377 has_one = owner,: Checks that a stored pubkey field matches the passed account.
  4. Line 378 close = owner,: Closes the account at the end of the instruction and refunds its lamports.
  5. Line 383 pub owner: Signer<'info>,: Requires this account to have signed the transaction.
  6. Line 392 init,: Creates and pays for a new account. Space and payer must be specified.
CoKeFish/agent-bazaar · 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;  }
  1. Line 189 const { blockhash, lastValidBlockHeight } = await this.connection.getLatestBlockhash('conf: Fetches a recent blockhash. Transactions expire if it gets too old.
  2. Line 197 const sig = await this.connection.sendTransaction(tx, { skipPreflight: false, maxRetries: : Submits the signed transaction to the cluster.
CoKeFish/agent-bazaar · 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)}`,      );
  1. Line 91 private async invoke(method: string, args: xdr.ScVal[]): Promise<string> {: Makes a cross-program invocation into another program.
  2. 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.

DirectoryCommandRuns
.npm run devdocker compose up
docs/slidevnpm run devslidev --open
docs/slidevnpm run buildslidev build
packages/dashboardnpm run devvite --host 0.0.0.0
packages/dashboardnpm run buildtsc -b && vite build
packages/mcp-servernpm run devtsx src/index.ts
packages/mcp-servernpm run startnode dist/index.js
packages/mcp-servernpm run buildtsc
packages/mcp-servernpm run testnode --import tsx --test --test-reporter=spec test/auth.test.ts test/tools.test.ts
packages/contractsnpm run buildanchor build
packages/contractsnpm run testanchor test --skip-local-validator
packages/contractsnpm run deployanchor deploy --provider.cluster devnet
packages/demo-agentsnpm run devconcurrently "npm:dev:yield" "npm:dev:risk" "npm:dev:translator" "npm:dev:price" "npm:dev:code"
packages/demo-agentsnpm run buildtsc
packages/orchestrator-agentnpm run devtsx watch src/index.ts
packages/orchestrator-agentnpm run startnode dist/index.js

What you could build from it

Used in lessons