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 directory | Source files |
|---|---|
apps | 18 |
scripts | 8 |
examples | 8 |
packages | 6 |
tests | 5 |
(root) | 2 |
programs | 1 |
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.
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>,}- 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. - Line 61
require!(a.state==State::Created && Clock::get()?.unix_timestamp>=a.deadline, ErrorCode::T: Reads on-chain time from the Clock sysvar. - 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. - Line 73
#[account(mut)] pub buyer:Signer<'info>,: Requires this account to have signed the transaction. - 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. - 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. - 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.
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(); }- Line 117
fetch(input, { ...init, signal: AbortSignal.timeout(15000) }),: Creates and pays for a new account. Space and payer must be specified. - 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.
| Directory | Command | Runs |
|---|---|---|
. | npm run dev | concurrently -k -n api,web "pnpm dev:api" "pnpm dev:web" |
. | npm run build | pnpm typecheck && tsup apps/api/src/server.ts --format esm --platform node --out-dir dist/api && pnpm --filter @proofcom |
. | npm run test | tsx scripts/test-db.ts && vitest run |
. | npm run lint | eslint . |
apps/web | npm run dev | next dev --hostname 127.0.0.1 |
apps/web | npm run start | next start |
apps/web | npm run build | next build |
. | anchor build | compile programs and generate IDLs |
. | anchor test | local validator + test suite |
. | anchor run test | pnpm test:chain |
. | cargo build | Rust workspace build |
. | cargo test | Rust tests |
What you could build from it
- Fork the SuperStack copy and extend it within the Other gaps listed on the idea page.