Skip to content

Instantly share code, notes, and snippets.

@mgild
Last active October 5, 2025 14:55
Show Gist options
  • Save mgild/8d178cf821219eac323edca698ccbe61 to your computer and use it in GitHub Desktop.
Save mgild/8d178cf821219eac323edca698ccbe61 to your computer and use it in GitHub Desktop.

Switchboard DevRel Take-Home (Solana)

Assignment 1 — Docs Review (Switchboard)

Review docs.switchboard.xyz and the Switchboard Examples repository.

Prompt

  • Which sections lack clarity, feel incomplete, or are out of order?
  • Propose 3 concrete improvements (titles, placement, code, diagrams, examples).
  • For each, explain why it helps adoption and where it should live in the nav.

Deliverable

  • docs-review.md (≤ 2 pages)

Assignment 2 — Oracle Use-Case Exploration

You’re building an on-chain app on Solana that uses an oracle.

Prompt

  • Why choose Switchboard vs alternatives (technical + ops tradeoffs)?
  • Which app types would you prioritize and why (price feeds, custom jobs, verifiable randomness, sports/weather, etc.)?
  • Which dev resources/tools should Switchboard add or improve (SDKs, templates, dashboards, CLI flows)?

Deliverable

  • use-cases.md (≤ 2 pages)

Assignment 3 — Build on Solana (Program + UI + Switchboard)

What to Build (choose one track)

A. Consume an existing price feed

  • On devnet, read a Switchboard feed (e.g., SOL/USD). See https://explorer.switchboardlabs.xyz/
  • Anchor program exposes record_price(aggregator_pubkey) that:
    • Verifies the price feed,
    • Reads latest result + slot,
    • Stores it in your program state (PDA) with the signer’s pubkey and block time.

B. Create & consume your own feed

  • Use Switchboard to create a custom feed (e.g., HTTP price or off-chain metric),
  • Same on-chain consume path as (A).

Required Features

  1. Solana Program (Anchor)

    • initialize(...) to set config (e.g., authority, aggregator).
    • record_price(...) verifies the Switchboard account (no spoofing) and persists:
      • value (i128 or fixed-point),
      • caller pubkey.
    • Unit test reading a mock or devnet aggregator and asserting parse & storage.
  2. Devnet Deployment

    • Deploy to devnet. Provide Program ID and an example tx that calls record_price.
    • Include Anchor.toml and IDL in target/idl committed.
  3. UI (minimal, but real)

    • React/Next.js (or Svelte) single page:
      • Connect wallet (Phantom/Solana Wallet Standard).
      • Display live aggregator value (pulled from chain account or RPC) and last stored value from your program state (PDA).
      • Button “Record price” → sends record_price to your program; show resulting tx signature and toast success/error.
      • Show confidence interval and timestamp (humanized).
    • Nice-to-have: small chart of last N stored values from your PDA.
  4. Switchboard Usage (required)

    • Program must verify the Switchboard account layout/signature fields you rely on (no blind reads).
    • Explain in README how you validated aggregator data (checking owner, discriminator/layout, permission gates, staleness threshold).
  5. Repo & Ops

    • Monorepo or two folders is fine:
      /programs/price-recorder      # Anchor program
      /app                          # UI (Next.js)
      /scripts                      # local helpers (keypair, seed, tx)
      README.md
      
    • Provide .env.example for UI + scripts (RPC, program id, aggregator pubkey).
    • Add scripts:
      • anchor test (program unit/integration tests)
      • pnpm dev (or npm run dev) for UI
      • ts-node scripts/record.ts to invoke the ix from CLI
    • Include screenshots or a short screen-cap of the UI recording a price and showing the tx link.

Acceptance Criteria (we will verify)

  • Program is deployed on devnet;
  • At least one tx on devnet calling record_price with a valid aggregator; link provided.
  • UI builds & runs, can connect a wallet, shows an aggregator’s latest value, and can send a tx to your program.
  • Switchboard account checks are present (owner/program id check, data layout/discriminator checks, staleness/slot bounds, optional confidence threshold).
  • README has exact steps to:
    • create/set feed (or choose an existing one),
    • build/deploy program to devnet,
    • run UI, invoke instruction,
    • verify state via solana account <pda> or a helper script.

Submission Requirements

  • Public GitHub repo link containing all code, IDL, and README.
  • Program ID (devnet) and at least one tx signature invoking record_price.
  • Short demo (GIF/video or screenshots).
  • Optional: Deployed UI URL (Vercel/Netlify) pointing to devnet.

Evaluation Rubric (100 pts)

Category Points Description
Docs Review Quality 15 Clear, actionable improvements with rationale.
Use-Case Depth 15 Realistic tradeoffs; specific Switchboard advantages.
On-Chain Correctness 30 Proper aggregator verification, data parsing, checks, clean state model, tests pass.
UI/UX 20 Wallet flow works, values render correctly, tx feedback is clear.
DevEx & README 10 One-shot setup, scripts, .env.example, troubleshooting notes.
Code Quality 10 Structure, types, error handling, small, focused modules.

Suggested Stack (non-binding)

  • Program: Anchor (Rust), SPL types, deterministic PDAs, fixed-point via i128 or Decimal.
  • UI: Next.js + Wallet Standard adapter, @solana/web3.js, small chart (e.g., Recharts).
  • Tooling: pnpm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment