Full lesson
agenteco-multichain
The economic layer for AI agents: on-chain escrow, disputes and portable reputation.
What it does
From the project README:
AgentEco The economic layer for AI agents. The escrow, dispute and reputation layer for work between AI agents: one hire() call locks the payment on-chain, checks the result and pays or disputes. Live on BNB Smart Chain Testnet, and deployed, each with a three-deal proof run, on Base Sepolia, Ethereum Sepolia, Arbitrum Sepolia, Tempo, BOT Chain Testnet and Solana devnet, all served by one live website and API.
- Original
- SannyDermawan/agenteco-multichain
- SuperStack fork
- Blockchains/agenteco-multichain @
172edc3 - Stars
- 0
- Last push (original)
- 2026-10-16
- Languages
- TypeScript, Solidity, Rust, Python, CSS, Shell
- Detected stack
- @solana/kitAnchorNext.js
- Categories
- AI & Agents
- Licence
- MIT
- Homepage
- https://agenteco-multichain.vercel.app
Architecture
379 source files. By extension: .ts ×255, .tsx ×107, .sol ×14, .rs ×2, .py ×1.
| Top-level directory | Source files |
|---|---|
frontend | 151 |
backend | 94 |
agent-runtime | 82 |
cli | 29 |
test | 8 |
seller-agent | 4 |
script | 3 |
contracts | 3 |
On-chain programs: solana/programs/agenteco_escrow
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/agenteco-multichain/. 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.
solana/programs/agenteco_escrow/src/lib.rs L145–168 @ 172edc3 · MIT · original escrow.fee_bps = config.fee_bps; escrow.created_at = now; escrow.funded_at = now; escrow.execution_window = execution_window; escrow.review_window = review_window; escrow.accept_deadline = now + config.accept_timeout; escrow.task_hash = task_hash; escrow.bump = ctx.bumps.escrow; escrow.vault_bump = ctx.bumps.vault; ctx.accounts.reputation.seller = ctx.accounts.seller.key(); emit!(EscrowFunded { escrow_id: id, buyer: ctx.accounts.buyer.key(), seller: ctx.accounts.seller.key(), mint: ctx.accounts.mint.key(), amount, task_hash, }); token::transfer( CpiContext::new( ctx.accounts.token_program.key(),- Line 152
escrow.bump = ctx.bumps.escrow;: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve. - Line 157
emit!(EscrowFunded {: Emits an Anchor event that clients can parse from the logs. - Line 166
token::transfer(: An SPL token transfer through the Token Program. - Line 167
CpiContext::new(: Makes a cross-program invocation into another program.
agent-runtime/src/chain/solana-rpc.ts L85–108 @ 172edc3 · MIT · original const { value: blockhash } = await this.rpc.getLatestBlockhash({ commitment: this.commitment }).send() const transaction = await pipe( createTransactionMessage({ version: 0 }), (tx) => setTransactionMessageFeePayerSigner(feePayer, tx), (tx) => setTransactionMessageLifetimeUsingBlockhash(blockhash, tx), (tx) => appendTransactionMessageInstructions(instructions, tx), (tx) => signTransactionMessageWithSigners(tx) ) const signature = getSignatureFromTransaction(transaction) try { // Simulated against the same commitment the reads use, so a rejection is the program's own. await this.rpc .sendTransaction(getBase64EncodedWireTransaction(transaction), { encoding: 'base64', preflightCommitment: this.commitment }) .send() } catch (error) { throw new Error(`transaction rejected: ${describe(error)}`, { cause: error }) } const deadline = Date.now() + this.confirmTimeoutMs while (Date.now() < deadline) { const [status] = (await this.rpc.getSignatureStatuses([signature]).send()).value if (status?.err) throw new Error(`transaction failed: ${JSON.stringify(status.err, (_, v) => (typeof v === 'bigint' ? v.toString() : v))}`) if (status && reached(status.confirmationStatus, this.commitment)) return signature await sleep(this.pollMs) }- Line 85
const { value: blockhash } = await this.rpc.getLatestBlockhash({ commitment: this.commitme: Fetches a recent blockhash. Transactions expire if it gets too old. - Line 97
.sendTransaction(getBase64EncodedWireTransaction(transaction), { encoding: 'base64', prefl: Submits the signed transaction to the cluster.
agent-runtime/scripts/solana-initialize.ts L97–120 @ 172edc3 · MIT · original const mintAccount = await rpc.getAccountInfo(mint, { encoding: 'base64' }).send() if (!mintAccount.value || mintAccount.value.owner !== SPL_TOKEN_PROGRAM_ID) { console.error('refusing: the mint does not exist on this cluster or is not an SPL Token mint') process.exit(1) } if ((await rpc.getAccountInfo(config as Address, { encoding: 'base64' }).send()).value) { console.error('refusing: this program is already initialized') process.exit(1) } const { value: blockhash } = await rpc.getLatestBlockhash().send() const transaction = await pipe( createTransactionMessage({ version: 0 }), (tx) => setTransactionMessageFeePayerSigner(admin, tx), (tx) => setTransactionMessageLifetimeUsingBlockhash(blockhash, tx), (tx) => appendTransactionMessageInstruction(instruction, tx), (tx) => signTransactionMessageWithSigners(tx) ) const signature = await rpc.sendTransaction(getBase64EncodedWireTransaction(transaction), { encoding: 'base64' }).send() for (let i = 0; i < 60; i++) { const [status] = (await rpc.getSignatureStatuses([signature]).send()).value if (status?.err) throw new Error(`initialize failed: ${JSON.stringify(status.err, (_, v) => (typeof v === 'bigint' ? v.toString() : v))}`) if (status?.confirmationStatus === 'confirmed' || status?.confirmationStatus === 'finalized') { console.log(`initialized: ${signature}`)- Line 107
const { value: blockhash } = await rpc.getLatestBlockhash().send(): Fetches a recent blockhash. Transactions expire if it gets too old. - Line 115
const signature = await rpc.sendTransaction(getBase64EncodedWireTransaction(transaction),: 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 start | npm run start:api |
cli | npm run build | tsup |
cli | npm run test | node --import tsx --test "test/**/*.test.ts" |
frontend | npm run dev | next dev |
frontend | npm run start | next start |
frontend | npm run build | next build |
frontend | npm run lint | eslint |
backend | npm run dev | tsx watch --env-file-if-exists=.env src/index.ts |
backend | npm run start | tsx --env-file-if-exists=.env src/index.ts |
backend | npm run test | node --import tsx --test "src/**/*.test.ts" |
buyer-agent | npm run dev | tsx watch --env-file=.env src/index.ts |
buyer-agent | npm run start | tsx --env-file=.env src/index.ts |
seller-agent | npm run dev | tsx watch --env-file=.env src/index.ts |
seller-agent | npm run start | tsx --env-file=.env src/index.ts |
agent-runtime | npm run test | node --import tsx --test "src/**/*.test.ts" |
solana | anchor build | compile programs and generate IDLs |
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