Sol.College

Full lesson

CriptoWorldsFair

What it does

From the project README:

AI agents can discover services, call APIs and spend money. The missing piece is knowing whether the requested work was actually delivered before funds are released.
Original
rosario1709/CriptoWorldsFair
SuperStack fork
Blockchains/CriptoWorldsFair @ 4b5ffa5
Stars
0
Last push (original)
2026-09-29
Languages
TypeScript, CSS, Rust, PLpgSQL, Dockerfile, JavaScript
Detected stack
@solana/kitAnchorNext.jsweb3.js
Categories
Other
Licence
MIT

Architecture

48 source files. By extension: .ts ×41, .tsx ×6, .rs ×1.

Top-level directorySource files
apps18
scripts8
examples8
packages6
tests5
(root)2
programs1

On-chain programs: programs/proofcommerce

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/criptoworldsfair/. 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.

rosario1709/CriptoWorldsFair · programs/proofcommerce/src/lib.rs L61–84 @ 4b5ffa5 · MIT · original
        require!(a.state==State::Created && Clock::get()?.unix_timestamp>=a.deadline, ErrorCode::Transition);        a.state=State::Cancelled; changed(a); Ok(())    }} fn live(a:&Agreement)->Result<()> { require!(Clock::get()?.unix_timestamp<a.deadline,ErrorCode::Deadline);Ok(()) }fn refundable(state:State, now:i64, deadline:i64)->bool { state==State::Rejected || (now>=deadline && matches!(state,State::Funded|State::Accepted|State::Submitted)) }fn changed(a:&Account<Agreement>) {emit!(Changed{agreement:a.key(),state:a.state,hash:a.delivery_hash});} #[derive(Accounts)]#[instruction(id:[u8;32])]pub struct Initialize<'info> {    #[account(mut)] pub buyer:Signer<'info>,    /// CHECK: Immutable recipient identity; not read or mutated.    pub provider:UncheckedAccount<'info>,    /// CHECK: Immutable verification authority chosen by buyer and visible to provider before acceptance.    pub verifier:UncheckedAccount<'info>,    pub mint:Account<'info,Mint>,    #[account(init,payer=buyer,space=8+Agreement::INIT_SPACE,seeds=[b"agreement",id.as_ref(),buyer.key().as_ref(),provider.key().as_ref(),mint.key().as_ref()],bump)]    pub agreement:Account<'info,Agreement>,    #[account(init,payer=buyer,associated_token::mint=mint,associated_token::authority=agreement)]    pub vault:Account<'info,TokenAccount>,    pub token_program:Program<'info,Token>, pub associated_token_program:Program<'info,AssociatedToken>, pub system_program:Program<'info,System>,}
  1. Line 61 require!(a.state==State::Created && Clock::get()?.unix_timestamp>=a.deadline, ErrorCode::T: An explicit validation that aborts the instruction with an error.
  2. Line 61 require!(a.state==State::Created && Clock::get()?.unix_timestamp>=a.deadline, ErrorCode::T: Reads on-chain time from the Clock sysvar.
  3. Line 68 fn changed(a:&Account<Agreement>) {emit!(Changed{agreement:a.key(),state:a.state,hash:a.de: Emits an Anchor event that clients can parse from the logs.
  4. Line 73 #[account(mut)] pub buyer:Signer<'info>,: Requires this account to have signed the transaction.
  5. Line 79 #[account(init,payer=buyer,space=8+Agreement::INIT_SPACE,seeds=[b"agreement",id.as_ref(),b: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  6. Line 79 #[account(init,payer=buyer,space=8+Agreement::INIT_SPACE,seeds=[b"agreement",id.as_ref(),b: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
  7. Line 79 #[account(init,payer=buyer,space=8+Agreement::INIT_SPACE,seeds=[b"agreement",id.as_ref(),b: Creates and pays for a new account. Space and payer must be specified.
rosario1709/CriptoWorldsFair · packages/solana/src/index.ts L109–132 @ 4b5ffa5 · MIT · original
      provider: AgentSigner;      verifier: AgentSigner;    },  ) {    this.connection = new Connection(rpc, {      commitment: "confirmed",      confirmTransactionInitialTimeout: 45000,      fetch: async (input, init) =>        fetch(input, { ...init, signal: AbortSignal.timeout(15000) }),    });    this.programId = new PublicKey(programId);  }  address(a: Agreement) {    return PublicKey.findProgramAddressSync(      [        Buffer.from("agreement"),        idBytes(a.id),        new PublicKey(a.buyerWallet).toBuffer(),        new PublicKey(a.providerWallet).toBuffer(),        new PublicKey(a.mint).toBuffer(),      ],      this.programId,    )[0].toBase58();  }
  1. Line 117 fetch(input, { ...init, signal: AbortSignal.timeout(15000) }),: Creates and pays for a new account. Space and payer must be specified.
  2. Line 122 return PublicKey.findProgramAddressSync(: Derives a PDA from seeds and the program ID and returns the address with its canonical bump.

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 devconcurrently -k -n api,web "pnpm dev:api" "pnpm dev:web"
.npm run buildpnpm typecheck && tsup apps/api/src/server.ts --format esm --platform node --out-dir dist/api && pnpm --filter @proofcom
.npm run testtsx scripts/test-db.ts && vitest run
.npm run linteslint .
apps/webnpm run devnext dev --hostname 127.0.0.1
apps/webnpm run startnext start
apps/webnpm run buildnext build
.anchor buildcompile programs and generate IDLs
.anchor testlocal validator + test suite
.anchor run testpnpm test:chain
.cargo buildRust workspace build
.cargo testRust tests

What you could build from it

Used in lessons