Full lesson
GhBounty
Automated GitHub bounty marketplace with AI-verified PRs. Opus analyzes, GenLayer juries on-chain, humans pick the winner. Solana-first, agent-native via x402 + MCP.
What it does
From the project README:
Ghbounty is a bounty platform for GitHub issues where **companies post bounties, developers (human or AI) submit PRs, and an automated evaluation pipeline decides the ranking**. Final winner selection is always human.
- Original
- Ghbounty/GhBounty
- SuperStack fork
- Blockchains/GhBounty @
2c12467 - Stars
- 1
- Last push (original)
- 2026-05-21
- Languages
- TypeScript, CSS, Rust, PLpgSQL, Python, JavaScript
- Detected stack
- @solana/kitAnchorNext.jsweb3.js
- Categories
- AI & Agents
- Licence
- MIT
- Homepage
- https://gh-bounty-frontend.vercel.app
Architecture
272 source files. By extension: .ts ×200, .tsx ×60, .rs ×6, .py ×5, .js ×1.
| Top-level directory | Source files |
|---|---|
frontend | 130 |
packages | 55 |
apps | 41 |
relayer | 33 |
contracts | 6 |
bounty_judge | 5 |
scripts | 2 |
On-chain programs: contracts/solana/programs/ghbounty_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/ghbounty/. 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.
contracts/solana/programs/ghbounty_escrow/src/lib.rs L145–168 @ 2c12467 · MIT · original pub fn init_stake_deposit( ctx: Context<InitStakeDeposit>, amount: u64, ) -> Result<()> { require!(amount >= MIN_STAKE_LAMPORTS, EscrowError::StakeTooSmall); let stake = &mut ctx.accounts.stake; stake.owner = ctx.accounts.owner.key(); stake.amount = amount; stake.status = StakeStatus::Active; stake.created_at = Clock::get()?.unix_timestamp; stake.locked_until = stake.created_at + STAKE_LOCK_SECONDS; stake.bump = ctx.bumps.stake; // Transfer lamports from owner to the stake PDA. invoke( &system_instruction::transfer( &ctx.accounts.owner.key(), &stake.key(), amount, ), &[ ctx.accounts.owner.to_account_info(), stake.to_account_info(),- Line 149
require!(amount >= MIN_STAKE_LAMPORTS, EscrowError::StakeTooSmall);: An explicit validation that aborts the instruction with an error. - Line 151
let stake = &mut ctx.accounts.stake;: Touches staking state: the amount locked and when it was locked. - Line 155
stake.created_at = Clock::get()?.unix_timestamp;: Reads on-chain time from the Clock sysvar. - Line 157
stake.bump = ctx.bumps.stake;: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve. - Line 160
invoke(: Makes a cross-program invocation into another program.
frontend/lib/solana.ts L433–456 @ 2c12467 · MIT · original }) .instruction();} /* ================================================================ * GHB-188: init_stake_deposit helpers (MCP account activation) * ================================================================ */ /** * Derive the stake-deposit PDA. Mirrors the on-chain seeds * seeds = [STAKE_DEPOSIT_SEED, owner.key().as_ref()] * so callers can compute the address before sending the tx. * * The PDA is one-per-owner; trying to init a second time fails with * Anchor's "account already exists" error. */export function deriveStakeDepositPda(owner: PublicKey): [PublicKey, number] { return PublicKey.findProgramAddressSync( [STAKE_DEPOSIT_SEED, owner.toBuffer()], PROGRAM_ID, );} /**- Line 442
* Derive the stake-deposit PDA. Mirrors the on-chain seeds: Touches staking state: the amount locked and when it was locked. - Line 443
* seeds = [STAKE_DEPOSIT_SEED, owner.key().as_ref()]: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match. - Line 450
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 build | pnpm -r build |
. | npm run test | pnpm -r test |
. | npm run lint | pnpm -r lint |
relayer | npm run dev | tsx watch src/index.ts |
relayer | npm run start | tsx src/index.ts |
relayer | npm run build | tsc |
relayer | npm run test | vitest run |
apps/mcp | npm run dev | next dev --port 3001 |
apps/mcp | npm run start | next start --port 3001 |
apps/mcp | npm run build | next build |
apps/mcp | npm run test | vitest run |
frontend | npm run dev | next dev |
frontend | npm run start | next start |
frontend | npm run build | next build |
frontend | npm run test | vitest run |
frontend | npm run lint | eslint |
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