Sol.College

Full lesson

zone-runners

Faster experience for Solana DePIN users.

What it does

From the project README:

Zone Runners is a stake-and-challenge game built on top of existing DePIN infrastructure. Operators stake SOL to claim H3 geographic zones and prove their hardware covers them. Any other operator with better hardware coverage can challenge and take a zone by proving it on-chain. The challenger wins the defender's stake. Failed challenges cost only gas.
Original
nidhinmahesh/zone-runners
SuperStack fork
Blockchains/zone-runners @ 1ce0477
Stars
0
Last push (original)
2026-05-10
Languages
Rust, TypeScript
Detected stack
Anchorweb3.js
Categories
DePIN
Licence
Apache-2.0

Architecture

13 source files. By extension: .rs ×9, .ts ×4.

Top-level directorySource files
programs9
app3
tests1

On-chain programs: programs/zone-runners

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/zone-runners/. 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.

nidhinmahesh/zone-runners · programs/zone-runners/src/instructions/season.rs L61–84 @ 1ce0477 · Apache-2.0 · original
} // ─── Accounts ──────────────────────────────────────────────────────────────── #[derive(Accounts)]pub struct CreateSeason<'info> {    #[account(mut)]    pub admin: Signer<'info>,     #[account(        mut,        seeds = [ZONE_CONFIG_SEED, &zone_config.club_id],        bump = zone_config.bump,        has_one = admin @ ZoneError::Unauthorized,    )]    pub zone_config: Account<'info, ZoneConfig>,     #[account(        init,        payer = admin,        space = 8 + Season::MAX_SIZE,        seeds = [SEASON_SEED, zone_config.key().as_ref(), &zone_config.season_count.to_be_bytes()],        bump    )]
  1. Line 68 pub admin: Signer<'info>,: Requires this account to have signed the transaction.
  2. Line 72 seeds = [ZONE_CONFIG_SEED, &zone_config.club_id],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  3. Line 73 bump = zone_config.bump,: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
  4. Line 74 has_one = admin @ ZoneError::Unauthorized,: Checks that a stored pubkey field matches the passed account.
  5. Line 79 init,: Creates and pays for a new account. Space and payer must be specified.
nidhinmahesh/zone-runners · programs/zone-runners/src/instructions/passport.rs L49–72 @ 1ce0477 · Apache-2.0 · original
 #[derive(Accounts)]pub struct UpdatePassport<'info> {    #[account(mut)]    pub payer: Signer<'info>,     /// CHECK: the wallet whose passport we are updating; does not need to sign    pub authority: AccountInfo<'info>,     #[account(        init_if_needed,        payer = payer,        space = 8 + ContributionPassport::MAX_SIZE,        seeds = [PASSPORT_SEED, authority.key().as_ref()],        bump    )]    pub passport: Account<'info, ContributionPassport>,     pub system_program: Program<'info, System>,} #[derive(Accounts)]pub struct RecordSeasonParticipation<'info> {    #[account(mut)]
  1. Line 53 pub payer: Signer<'info>,: Requires this account to have signed the transaction.
  2. Line 59 init_if_needed,: Creates the account only if it doesn't exist. Watch for re-initialisation bugs.
  3. Line 62 seeds = [PASSPORT_SEED, authority.key().as_ref()],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
  4. Line 63 bump: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
nidhinmahesh/zone-runners · programs/zone-runners/src/instructions/initialize.rs L13–34 @ 1ce0477 · Apache-2.0 · original
    cfg.season_count = 0;    cfg.bump = ctx.bumps.zone_config;    Ok(())} #[derive(Accounts)]#[instruction(club_id: u64)]pub struct InitializeZoneConfig<'info> {    #[account(mut)]    pub admin: Signer<'info>,     #[account(        init,        payer = admin,        space = 8 + ZoneConfig::MAX_SIZE,        seeds = [ZONE_CONFIG_SEED, &club_id.to_le_bytes()],        bump    )]    pub zone_config: Account<'info, ZoneConfig>,     pub system_program: Program<'info, System>,}
  1. Line 14 cfg.bump = ctx.bumps.zone_config;: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
  2. Line 22 pub admin: Signer<'info>,: Requires this account to have signed the transaction.
  3. Line 25 init,: Creates and pays for a new account. Space and payer must be specified.
  4. Line 28 seeds = [ZONE_CONFIG_SEED, &club_id.to_le_bytes()],: Declares the PDA seeds. Anchor re-derives the address and rejects the account if it doesn't match.
nidhinmahesh/zone-runners · programs/zone-runners/src/instructions/zone.rs L13–36 @ 1ce0477 · Apache-2.0 · original
    let season = &mut ctx.accounts.season;     require!(now >= season.start_ts, ZoneError::SeasonNotStarted);    require!(now < season.end_ts, ZoneError::SeasonEnded);    require!(!season.is_settled, ZoneError::SeasonAlreadySettled);    require!(stake_lamports >= MIN_ZONE_STAKE, ZoneError::StakeBelowMinimum);     let claim = &mut ctx.accounts.zone_claim;    claim.season = season.key();    claim.h3_index = h3_index;    claim.operator = ctx.accounts.operator.key();    claim.facility = facility;    claim.claimed_at = now;    claim.is_verified = false;    claim.verified_at = 0;    claim.snapshot_buffer = Pubkey::default();    claim.stake_lamports = stake_lamports;    claim.coverage_score = 0;    claim.challenge_count = 0;    claim.bump = ctx.bumps.zone_claim;     // Transfer stake SOL from operator → ZoneClaim PDA    let cpi_ctx = CpiContext::new(        ctx.accounts.system_program.to_account_info(),
  1. Line 15 require!(now >= season.start_ts, ZoneError::SeasonNotStarted);: An explicit validation that aborts the instruction with an error.
  2. Line 32 claim.bump = ctx.bumps.zone_claim;: Uses the bump seed, the extra byte that pushes the derived address off the ed25519 curve.
  3. Line 34 // Transfer stake SOL from operator → ZoneClaim PDA: Touches staking state: the amount locked and when it was locked.
  4. Line 35 let cpi_ctx = CpiContext::new(: Makes a cross-program invocation into another program.

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 lintprettier */*.js "*/**/*{.js,.ts}" --check
appnpm run buildtsc
.anchor buildcompile programs and generate IDLs
.anchor testlocal validator + test suite
.anchor run testyarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts
.cargo buildRust workspace build
.cargo testRust tests

What you could build from it