Sol.College

Full lesson

cypherpunk-hackathon2025

A decentralized prediction market platform on Solana empowering users to forecast real-world events. Focused on transparency & accountability.

What it does

From the project README:

[](https://cypherpunk-hackathon2025-three.vercel.app/) [](https://solana.com) [](https://nextjs.org) [](https://www.typescriptlang.org/)
Original
Edgadafi/cypherpunk-hackathon2025
SuperStack fork
Blockchains/cypherpunk-hackathon2025 @ 495cde8
Stars
1
Last push (original)
2025-11-14
Languages
TypeScript, Rust, Shell, JavaScript, HTML, PowerShell
Detected stack
AnchorNext.jsweb3.js
Categories
DeFi
Licence
MIT
Homepage
https://cypherpunk-hackathon2025-three.vercel.app

Architecture

129 source files. By extension: .tsx ×69, .ts ×42, .js ×13, .rs ×5.

Top-level directorySource files
prediction-market74
archive27
prediction-market-latam12
config11
playground-versions4
(root)1

On-chain programs: prediction-market-latam/programs/prediction-market

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/cypherpunk-hackathon2025/. 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.

Edgadafi/cypherpunk-hackathon2025 · playground-versions/PRISMAFI_SOLANA_PLAYGROUND_FINAL.rs L205–228 @ 495cde8 · MIT · original
pub struct CreateMarket<'info> {    #[account(        init,        payer = authority,        space = 8 + Market::INIT_SPACE,        seeds = [b"market", authority.key().as_ref(), &Sha256::digest(question.as_bytes())[..]],        bump    )]    pub market: Account<'info, Market>,        #[account(mut)]    pub authority: Signer<'info>,        pub system_program: Program<'info, System>,} #[derive(Accounts)]pub struct PlaceBet<'info> {    #[account(mut)]    pub market: Account<'info, Market>,        #[account(        init_if_needed,        payer = user,
  1. Line 207 init,: Creates and pays for a new account. Space and payer must be specified.
  2. Line 210 seeds = [b"market", authority.key().as_ref(), &Sha256::digest(question.as_bytes())[..]],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  3. Line 211 bump: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
  4. Line 216 pub authority: Signer<'info>,: Requires this account to have signed the transaction.
  5. Line 227 init_if_needed,: Creates the account only if it doesn't exist. Watch for re-initialisation bugs.
Edgadafi/cypherpunk-hackathon2025 · playground-versions/PRISMAFI_SOLANA_PLAYGROUND.rs L205–228 @ 495cde8 · MIT · original
    #[account(        init,        payer = authority,        space = 8 + Market::INIT_SPACE,        seeds = [b"market", authority.key().as_ref(), question.as_bytes()],        bump    )]    pub market: Account<'info, Market>,        #[account(mut)]    pub authority: Signer<'info>,        pub system_program: Program<'info, System>,} #[derive(Accounts)]pub struct PlaceBet<'info> {    #[account(mut)]    pub market: Account<'info, Market>,        #[account(        init_if_needed,        payer = user,        space = 8 + UserPosition::INIT_SPACE,
  1. Line 206 init,: Creates and pays for a new account. Space and payer must be specified.
  2. Line 209 seeds = [b"market", authority.key().as_ref(), question.as_bytes()],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  3. Line 210 bump: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
  4. Line 215 pub authority: Signer<'info>,: Requires this account to have signed the transaction.
  5. Line 226 init_if_needed,: Creates the account only if it doesn't exist. Watch for re-initialisation bugs.
Edgadafi/cypherpunk-hackathon2025 · playground-versions/PRISMAFI_SIMPLE_PLAYGROUND.rs L37–60 @ 495cde8 · MIT · original
    pub fn place_bet(        ctx: Context<PlaceBet>,        outcome: bool,        amount: u64,    ) -> Result<()> {        require!(amount > 0, PredictionMarketError::InvalidAmount);                let market = &mut ctx.accounts.market;        require!(!market.resolved, PredictionMarketError::MarketResolved);        require!(            Clock::get()?.unix_timestamp < market.end_time,            PredictionMarketError::MarketExpired        );         let position = &mut ctx.accounts.position;        position.user = ctx.accounts.user.key();        position.market = market.key();        position.outcome = outcome;        position.amount = position.amount.checked_add(amount).unwrap();        position.claimed = false;        position.bump = ctx.bumps.position;         if outcome {            market.total_yes_amount = market.total_yes_amount.checked_add(amount).unwrap();
  1. Line 42 require!(amount > 0, PredictionMarketError::InvalidAmount);: An explicit validation that aborts the instruction with an error.
  2. Line 47 Clock::get()?.unix_timestamp < market.end_time,: Reads on-chain time from the Clock sysvar.
  3. Line 55 position.amount = position.amount.checked_add(amount).unwrap();: Uses checked arithmetic so overflow fails instead of wrapping.
  4. Line 57 position.bump = ctx.bumps.position;: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
Edgadafi/cypherpunk-hackathon2025 · playground-versions/PRISMAFI_MINIMAL.rs L37–60 @ 495cde8 · MIT · original
         // Transfer SOL        let cpi_ctx = CpiContext::new(            ctx.accounts.system_program.to_account_info(),            anchor_lang::system_program::Transfer {                from: ctx.accounts.user.to_account_info(),                to: ctx.accounts.vault.to_account_info(),            },        );        anchor_lang::system_program::transfer(cpi_ctx, amount)?;        Ok(())    }} #[derive(Accounts)]pub struct CreateMarket<'info> {    #[account(        init,        payer = authority,        space = 8 + 32 + 100 + 8 + 8 + 8 + 1,        seeds = [b"market", authority.key().as_ref()],        bump    )]    pub market: Account<'info, Market>,
  1. Line 39 let cpi_ctx = CpiContext::new(: Makes a cross-program invocation into another program.
  2. Line 54 init,: Creates and pays for a new account. Space and payer must be specified.
  3. Line 57 seeds = [b"market", authority.key().as_ref()],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  4. Line 58 bump: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.

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 devnext dev
.npm run startnext start
.npm run buildnext build
.npm run lintnext lint
prediction-market-latamnpm run devnext dev
prediction-market-latamnpm run startnext start
prediction-market-latamnpm run buildnext build
prediction-market-latamnpm run testvitest
prediction-market-latamnpm run lintnext lint
prediction-marketnpm run devnext dev
prediction-marketnpm run startnext start
prediction-marketnpm run buildnext build
prediction-marketnpm run testecho 'No tests configured yet' && exit 0
prediction-marketnpm run linteslint
prediction-market-latamanchor buildcompile programs and generate IDLs
prediction-market-latamanchor testlocal validator + test suite

What you could build from it