Full lesson
aha-hackathon
AHA! — on-chain fan economy for music and movie games. Solana Frontier Hackathon submission, May 2026.
What it does
From the project README:
AHA! is a multi-language music guessing game (Hindi, English, Tamil, Telugu, Kannada) that turns fan engagement into an on-chain economy: players wager SOL on 1v1 matches, earn non-transferable Fandom XP through gameplay, and steer the roadmap via dual-weighted governance. The base game has been live with real users since 2025; this hackathon adds the on-chain layer — three Anchor programs, wallet-native matches, and a working governance loop integrated into the existing frontend.
- Original
- rachanseeba/aha-hackathon
- SuperStack fork
- Blockchains/aha-hackathon @
32f437b - Stars
- 0
- Last push (original)
- 2026-05-07
- Languages
- TypeScript, JavaScript, Rust, HTML, PLpgSQL
- Detected stack
- Anchorweb3.js
- Categories
- GamingConsumer & Social
- Licence
- MIT
- Homepage
- https://playaha.app
Architecture
15 source files. By extension: .ts ×6, .js ×6, .rs ×3.
| Top-level directory | Source files |
|---|---|
frontend | 6 |
scripts | 5 |
programs | 3 |
tests | 1 |
On-chain programs: programs/aha-escrow, programs/aha-fandom, programs/aha-governance
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/aha-hackathon/. 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/aha-governance/src/lib.rs L61–84 @ 32f437b · MIT · original ) -> Result<()> { require!(title.len() <= 80, GovernanceError::TitleTooLong); require!(description_uri.len() <= 200, GovernanceError::UriTooLong); let proposal = &mut ctx.accounts.proposal; let now = Clock::get()?.unix_timestamp; proposal.proposal_id = proposal_id; proposal.proposer = ctx.accounts.proposer.key(); proposal.title = title; proposal.description_uri = description_uri; proposal.created_at = now; proposal.voting_ends_at = now + ctx.accounts.config.voting_period_seconds; proposal.yes_weight = 0; proposal.no_weight = 0; proposal.total_voters = 0; proposal.status = ProposalStatus::Active; proposal.bump = ctx.bumps.proposal; emit!(ProposalCreated { proposal_id, proposer: proposal.proposer, }); Ok(())- Line 62
require!(title.len() <= 80, GovernanceError::TitleTooLong);: An explicit validation that aborts the instruction with an error. - Line 66
let now = Clock::get()?.unix_timestamp;: Reads on-chain time from the Clock sysvar. - Line 78
proposal.bump = ctx.bumps.proposal;: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve. - Line 80
emit!(ProposalCreated {: Emits an Anchor event that clients can parse from the logs.
programs/aha-fandom/src/lib.rs L49–72 @ 32f437b · MIT · original profile.bump = ctx.bumps.profile; emit!(ProfileCreated { owner: profile.owner, }); Ok(()) } /// Increment XP. Only callable by the configured XP authority (aha-escrow). /// Recomputes tier on every call. pub fn award_xp(ctx: Context<AwardXp>, amount: u64) -> Result<()> { let profile = &mut ctx.accounts.profile; let new_xp = profile.xp.checked_add(amount).ok_or(FandomError::Overflow)?; let new_tier = compute_tier(new_xp); let tier_changed = new_tier != profile.tier; profile.xp = new_xp; profile.tier = new_tier; profile.matches_played = profile.matches_played.checked_add(1).unwrap_or(profile.matches_played); profile.matches_won = profile.matches_won.checked_add(1).unwrap_or(profile.matches_won); profile.last_updated = Clock::get()?.unix_timestamp; emit!(XpAwarded {- Line 49
profile.bump = ctx.bumps.profile;: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve. - Line 51
emit!(ProfileCreated {: Emits an Anchor event that clients can parse from the logs. - Line 62
let new_xp = profile.xp.checked_add(amount).ok_or(FandomError::Overflow)?;: Uses checked arithmetic so overflow fails instead of wrapping. - Line 70
profile.last_updated = Clock::get()?.unix_timestamp;: Reads on-chain time from the Clock sysvar.
programs/aha-escrow/src/lib.rs L241–264 @ 32f437b · MIT · original} // ----------------------------------------------------------------------------// Account structs// ---------------------------------------------------------------------------- #[derive(Accounts)]pub struct InitializeConfig<'info> { #[account( init, payer = authority, space = 8 + EscrowConfig::INIT_SPACE, seeds = [b"config"], bump )] pub config: Account<'info, EscrowConfig>, #[account(mut)] pub authority: Signer<'info>, pub system_program: Program<'info, System>,} #[derive(Accounts)]#[instruction(match_id: u64)]pub struct CreateMatch<'info> {- Line 250
init,: Creates and pays for a new account. Space and payer must be specified. - Line 253
seeds = [b"config"],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match. - Line 254
bump: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve. - Line 258
pub authority: Signer<'info>,: Requires this account to have signed the transaction.
scripts/simulate-init-profile.ts L25–48 @ 32f437b · MIT · original ); console.log("simulating initialize_profile for owner:", owner.toBase58()); const conn = new Connection(clusterApiUrl("devnet"), "confirmed"); const walletPath = path.join(os.homedir(), ".config", "solana", "id.json"); const kp = Keypair.fromSecretKey( new Uint8Array(JSON.parse(fs.readFileSync(walletPath, "utf8"))), ); const provider = new AnchorProvider(conn, new Wallet(kp), { commitment: "confirmed", }); anchor.setProvider(provider); const fandom = anchor.workspace.AhaFandom as Program<AhaFandom>; const [profilePda, bump] = PublicKey.findProgramAddressSync( [Buffer.from("profile"), owner.toBuffer()], fandom.programId, ); console.log("derived profile PDA:", profilePda.toBase58(), "bump:", bump); const ix = await fandom.methods .initializeProfile() .accountsPartial({ profile: profilePda,- Line 39
const [profilePda, bump] = PublicKey.findProgramAddressSync(: Derives a PDA from seeds and the program ID and returns the address with its canonical bump. - Line 39
const [profilePda, bump] = PublicKey.findProgramAddressSync(: 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.
| Directory | Command | Runs |
|---|---|---|
. | anchor build | compile programs and generate IDLs |
. | anchor test | local validator + test suite |
. | anchor run test | yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts |
. | cargo build | Rust workspace build |
. | cargo test | Rust tests |
What you could build from it
- Fork the SuperStack copy and extend it within the Gaming gaps listed on the idea page.
- Learn the pattern first: Program Derived Addresses (PDAs)
- Learn the pattern first: Building and sending transactions from a client