SnapPass (snappass) — Gasless Prepaid Vouchers, Scoped Virtual Cards & AI Safe-Spend Guardrails on Solana
- Solana Devnet Program ID:
9Zg8VjTxxAUHJycmZsJt27krSgPySbEuPn5habnnu8wv- Live Demo (Incognito, 0 SOL, 0 Extensions): https://snappass-solana.vercel.app
- Gasless Relayer Health: https://snappass-relayer-api.onrender.com/health
- Demo Video (< 3 min): https://youtu.be/o_slzYxHRKk
In Latin America—especially Argentina—paying $0.75 to $3.00 for an international SaaS module, developer API, or micro-subscription with a credit/debit card triggers +30% FX tax surcharges and frequent issuer blocks. Meanwhile, standard crypto checkouts force mainstream users through a high-drop-off 5-step funnel (Exchange KYC → P2P → Browser Extension Install → Seed Phrase Backup → Buying SOL for gas).
As autonomous AI agents increasingly purchase APIs, compute, and real-time data feeds on behalf of users, handing an LLM agent a funded master hot wallet is a critical security liability: a single prompt injection or model hallucination can drain the entire wallet balance in seconds.
SnapPass solves both problems with a single on-chain primitive:
- Prepaid SHA-256 USDC Vouchers (
VoucherAccountPDA): Acquired off-chain without international card taxes and backed 1:1 by USDC escrowed in the protocol's non-custodial SPL Token Vault PDA. - Zero-Friction Ephemeral Wallets + Role-Pinned Gasless Relayer: The browser auto-generates a local Ed25519 keypair (or optionally connects Phantom). Our FastAPI Relayer pays 100% of Solana gas fees (
Slot 0 = payer) while the user co-signs asSlot 1 = owner. - Scoped Disposable Virtual Cards (
TempCardAccountPDA): Claiming a voucher mints or tops up a temporary virtual debit card with an immutable per-transactionspending_limitand automaticexpires_atTTL. Any human or AI agent charge exceedingspending_limitis deterministically rejected on-chain by Solana (ErrorCode::ExceedsSpendingLimit/0x1775).
| Hackathon Track | Prize | How SnapPass Qualifies & Concrete On-Chain Proof |
|---|---|---|
| 1. Best App Overall on Solana | $5,000 | Full-stack consumer + developer protocol combining Rust/Anchor PDAs, a Python solders Gasless Relayer & Binary Verifier SDK, and a React/TS @solana/web3.js Command Center where judges mint, claim, unlock, and verify on Solana Explorer in 1 screen with 0 SOL. |
| 2. Dev3pack Argentina Local Track | $500 | Directly eliminates Argentina's +30% international card FX surcharge and 5-step P2P onboarding via Prepaid USDC Vouchers (SNAP-2026-XXXX-XXXX) redeemable gaslessly into a local browser wallet in <3 seconds. |
| 3. Best DeFi App on Solana | $250 | Non-custodial SPL Token Vault Escrow PDA ([b"vault", usdc_mint]), programmable virtual debit cards (TempCardAccount) with on-chain spending_limit & TTL, atomic merchant treasury settlement, and instant gasless Close & Refund Card (close_card). |
| 4. Best Agentic App on Solana | $250 | AI Agent Safe-Spend Firewall (POST /api/v1/agent/auto-unlock): Judges test both (A) Safe Autonomous Purchase ($0.75 <= $1.50 cap → UNLOCKED + Explorer tx) and (B) Hallucinated AI Overspend ($3.00 > $1.50 cap → blocked on-chain by AnchorError 6005: ExceedsSpendingLimit / 0x1775). |
flowchart LR
subgraph L3["Layer 3: React + TS Frontend (@solana/web3.js)"]
EW["Ephemeral Ed25519 Wallet<br/>(or Optional Phantom)<br/>Signs Slot 1 (owner)"]
VC["3D Scoped Virtual Card UI<br/>+ Live Judge Quest Bar"]
end
subgraph L2["Layer 2: FastAPI Relayer & Verifier SDK (Python solders)"]
FW["Instruction Firewall<br/>Role-Pinning (Slot 0 = payer)<br/>+ Discriminator Whitelist"]
AG["AI Agent Safe-Spend Evaluator<br/>POST /api/v1/agent/auto-unlock"]
VR["Direct 206-Byte PDA Deserializer<br/>GET /api/v1/entitlements/..."]
end
subgraph L1["Layer 1: Solana Devnet Smart Contract (Anchor / Rust)"]
PC["ProtocolConfig PDA (74 B)<br/>Pins Official USDC Mint"]
VP["VoucherAccount PDA (90 B)<br/>SHA-256 Secret Commitment"]
TC["TempCardAccount PDA (66 B)<br/>balance + spending_limit + TTL"]
VT["SPL Vault Escrow PDA<br/>1:1 Mock-USDC Backing"]
EP["EntitlementPass PDA (206 B)<br/>On-Chain SaaS License Receipt"]
end
EW -->|"Base64 Partial Tx"| FW
FW -->|"Co-Signs Slot 0 (0 SOL Gas)"| TC
VP -->|"claim_voucher_to_card"| TC
TC -->|"unlock_plan (Checks Limit 0x1775)"| EP
VT -->|"Atomic Settlement / Refund"| TC
AG -->|"Scoped Agent Keypair"| FW
EP -->|"Raw Account Bytes"| VR
All 5 Anchor accounts prepend an 8-byte discriminator (sha256("account:<Name>")[..8]):
| PDA Account | Deterministic Seeds | Exact SPACE |
Key Fields & Role |
|---|---|---|---|
ProtocolConfig |
[b"config"] |
74 B |
admin (32), usdc_mint (32), vault_bump (1), bump (1) — Global anti-fake-mint singleton. |
MerchantPlan |
[b"plan", merchant, plan_id] |
182 B |
merchant (32), treasury (32), plan_id (36), tier (20), feature_tag (36), price_usdc (8), duration_secs (8), active (1), bump (1). |
VoucherAccount |
[b"voucher", voucher_hash] |
90 B |
issuer (32), amount (8), voucher_hash ([u8;32]), is_claimed (1), expires_at (8), bump (1). |
TempCardAccount |
[b"card", owner] |
66 B |
owner (32), balance (8), spending_limit (8), expires_at (8), is_active (1), bump (1). |
EntitlementPass |
[b"entitlement", payer, merchant, plan_id] |
206 B |
payer_wallet (32), merchant (32), plan_id (36), tier (20), feature_tag (36), expires_at (8), active (1), receipt_hash ([u8;32]), bump (1). |
| Protocol Component | Solana Devnet Public Key | Explorer Verification |
|---|---|---|
| SnapPass Anchor Program ID | 9Zg8VjTxxAUHJycmZsJt27krSgPySbEuPn5habnnu8wv |
Inspect on Solana Explorer |
| Mock-USDC SPL Token Mint | 97RkWMrviy4exQQ2dezy1VGrFaQLep1iwGgKoMkUixLs |
Inspect Mint |
ProtocolConfig PDA ([b"config"]) |
6QzjKtREDz1rtvQDApAS4m3SvhjmXiiPm6QiSznU6ZAG |
Inspect Config PDA |
SPL Vault Escrow PDA ([b"vault", mint]) |
C4AJpzoBHvHcYAaCtuKsBxPjFHpmDrThwywgrCJkZyGg |
Inspect Vault PDA |
Gasless Fee-Payer Relayer (Slot 0) |
2qoPLfHtnu6wmqhLPLBVCwHkNadWHtHg8wd9mqs96QT9 |
Inspect Relayer |
| Demo Merchant Authority | AVxrvxEs4MmyoYKLhxP1PFG3NdYpvwX4cQ4tFFCHAwd4 |
Inspect Merchant |
| Merchant Treasury USDC ATA | 2X6WTnAQFm8xYpgDXZSqdsGfCh6GPA7ZUWNpSerSyqYu |
Inspect Treasury |
| Demo Issuer Refund USDC ATA | 3pgVZ2jZNfodWH1sVow2wcjGfLduRH5xXKU7QTdwXXMY |
Inspect Refund Pool |
Plan 1 (analytics-24h • $0.75) |
GYXgMMCGDKasdieSW6fZR7obZCvEwbATNSrXSe2yLeJJ |
Inspect Plan PDA |
Plan 2 (ai-copilot-7d • $1.50) |
HkJizio3kswi4k2zmgJqvUHfkyCSdPVppYys5YD2WrmT |
Inspect Plan PDA |
Plan 3 (pro-bundle-30d • $3.00) |
HPAmpZrW9DuLmPbH3DKGFGsNV71ucuMFiHqT1E6XQPFt |
Inspect Plan PDA |
- Anti Fake-Mint Singleton (
ProtocolConfigPDA): Initialized once viainitialize_protocol(). Pins the officialusdc_mintand canonicalvault_bumpso no attacker can pass a counterfeit SPL token mint intocreate_voucher,unlock_plan, orclose_card. - Strict SPL Vault PDA Pinning: Every token-moving instruction enforces
seeds = [b"vault", config.usdc_mint.as_ref()], bump = config.vault_bumpandtoken::authority = config, preventing vault substitution attacks. - Relayer Discriminator Whitelist + Role-Pinning (
Slot 0/1) + Anti-ALT:- The public
/api/v1/relayfirewall only accepts transactions targetingSNAPPASS_PROGRAM_ID(and optionalComputeBudget) with the 3 user discriminators (claim_voucher_to_card,unlock_plan,close_card). - Role-Pinning: Verifies
num_required_signatures == 2, pinsRELAYER_PUBKEY(Account Index0) strictly toix.accounts[0](payer), and forbids Index0from appearing inix.accounts[1..N](owner,issuer,merchant, orrefund_token_account), eliminating fee-payer authority spoofing. - Anti-ALT / Per-IP Rate Limiting: Rejects obfuscated Address Lookup Table privilege escalation and enforces sliding-window IP rate limits (
20 req/minon/relay,5 req/minon/demo/mint-voucher).
- The public
- Ephemeral-Safe Refund Compatibility (
close_card): Because zero-friction browser ephemeral keypairs do not possess pre-funded Associated Token Accounts (ATAs),close_cardverifiesrefund_token_account.mint == config.usdc_mintwhile requiring an explicit cryptographic signature fromowner: Signer<'info>(Slot 1), allowing unspent demo funds to return cleanly to the demo liquidity pool ATA (3pgVZ2...) or any user-designated USDC ATA. - Runtime SHA-256 Preimage Verification (
claim_voucher_to_card): DerivesVoucherAccountvia[b"voucher", voucher_hash.as_ref()]and verifiessolana_program::hash::hash(secret_code.as_bytes()).to_bytes() == voucher.voucher_hashinside the instruction handler, preventing macro expansion pitfalls while guaranteeing cryptographic preimage security.
SnapPass implements a Dual Solana SDK Stack:
- Backend (
backend/): Python 3.12 + FastAPI +solders/solana-pyfor zero-IDL binary PDA deserialization, transaction firewall inspection, and fee-payer co-signing. - Frontend (
frontend/): React 18 + TypeScript + Vite +@solana/web3.jsfor client-side Ed25519 keypair persistence, Borsh instruction encoding, and partial transaction signing (requireAllSignatures: false).
cd frontend
cp .env.example .env
npm install
npm run devOpen http://localhost:5173. Toggle between Live Relayer Mode (Solana Devnet) and Mock Sandbox Mode from the top-right status pill at any time.
cd backend
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8000Any Web2 backend can verify whether a user wallet holds an active, non-expired EntitlementPass PDA on Solana Devnet with a single HTTP GET call—no Web3 wallet popups required:
curl -s "http://localhost:8000/api/v1/entitlements/<PAYER_WALLET>/AVxrvxEs4MmyoYKLhxP1PFG3NdYpvwX4cQ4tFFCHAwd4/analytics-24h" \
| jq '{valid: .valid, tier: .tier, feature_tag: .feature_tag, pda: .pda, explorer: .explorer_url}'