DEV Community

Kanak Waradkar
Kanak Waradkar

Posted on

ChainPaws โ€” Stopping Lost Pet Scams with Solana Escrow & Tamper-Proof Registries ๐Ÿ•๐Ÿพ

DEV Weekend Challenge: Dog Days Edition Submission ๐Ÿ•

This is a submission for Weekend Challenge: Dog Days Edition

๐Ÿ• What I Built

"1 in every 3 family pets will go missing in their lifetime. Over 10 million dogs and cats disappear every single year in the US alone." โ€” National Humane Society

Every dog parent knows that stomach-dropping panic when a backyard gate swings open or a collar snaps in the park. But what happens next is often a second heartbreak: the predatory lost-pet scam epidemic.

When grieving owners post flyers and neighborhood alerts offering cash rewards, over 70% of responses are extortion scammers. Bad actors claim they have your dog locked in a crate and demand upfront wire transfers, CashApp, or crypto before sending "proof of life." Meanwhile, legitimate microchip registries (HomeAgain, 24PetWatch, AKC Reunite) sit in siloed, non-interoperable private databases that don't talk to each other โ€” if your pup is registered on one system and scanned at a shelter using another, the record comes back blank.

This weekend, for International Dog Day, I built ChainPaws: a decentralized, zero-database pet identification registry and trustless escrow recovery network running natively on Solana.

       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
       โ”‚   Traditional Lost Dog Flyer: 70%+ extortion scams    โ”‚
       โ”‚   ChainPaws: Non-Custodial On-Chain Escrow Protection  โ”‚
       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
Enter fullscreen mode Exit fullscreen mode

ChainPaws turns the lost-and-found experience into a transparent, cryptographic guarantee:

  • ๐Ÿ• Immutable Canine Identity: Binds your dog's 15-digit ISO 11784/11785 microchip ID to your Solana wallet as a deterministic Program Derived Account (PDA) (["pet", owner_pubkey, chip_hash]).
  • ๐Ÿ”’ Trustless Escrow Bounty Vaults: If your dog goes missing, you lock a SOL reward into an autonomous BountyEscrow PDA (["bounty", pet_pda]). No middleman holds your funds; the smart contract programmatically pays out the finder only upon verified recovery.
  • ๐Ÿ—บ๏ธ Live OpenStreetMap Telemetry Radar: A real-time geospatial radar tracking missing pet alerts across 7 major metro hubs (San Francisco, Los Angeles, Austin, Seattle, New York, Chicago, Miami) with pulsing medical-urgency indicators and 1-click sighting claims.
  • ๐Ÿ“ข AI Multilingual Emergency Bulletin & Voice Siren: Generates printable high-visibility emergency flyers translated dynamically into 5 languages (English, Espaรฑol, Franรงais, ไธญๆ–‡, ๆ—ฅๆœฌ่ชž) with an integrated browser audio voice siren for neighborhood search parties.
  • ๐Ÿฅ Veterinary & Shelter Clinic Terminal: Dedicated RFID microchip scanner and NFC smart collar interface enabling registered veterinary clinics to verify lost pets and execute authorized handovers.
  • ๐Ÿ† Guardian Badges & Collective Rescue Impact: A gamified on-chain milestone network (Guardian Genesis, Bounty Sentinel, First Responder, Reunion Champion, Licensed Clinic Node) celebrating every life saved.

The goal: Ensure no pet parent ever gets scammed while searching for their best friend, and give good Samaritans the cryptographic confidence that their rescue efforts will be honored instantly.


๐ŸŽฌ Demo

Video Link: Watch 2-Minute Demo Walkthrough on YouTube

๐ŸŒ Live Application: https://chain-paws.vercel.app

๐Ÿ’ป Solana Cluster: Devnet

๐Ÿ“œ Program ID: GnEv5qz2xufNJqsqbkBvmgAa6ByWEmnygN6zayJ1SD8h

You need a wallet to interact on-chain. Install Phantom or Solflare, switch it to Devnet (Settings โ†’ Developer Settings โ†’ Devnet), and grab free test SOL from faucet.solana.com. It's a test network โ€” no real money, no financial claims.


๐Ÿ“ธ Screenshots & Feature Walkthrough

1. Live OpenStreetMap Missing Pet Radar

ChainPaws Live Missing Pet Discovery Map showing real-time OpenStreetMap tiles with custom pet marker pins, active city navigators, and pulsing alert rings across metropolitan hubs

Real-time street map rendering OpenStreetMap tiles with animated pulse rings for medical-urgency alerts, city flyTo camera transitions, and instant on-map sighting claims.


2. AI Multilingual Emergency Flyer & Voice Siren Broadcast

ChainPaws Multilingual Emergency Flyer Generator featuring high-contrast layout, ISO microchip QR tag, and 5-language translation switcher with browser speech siren

Generate high-visibility printable flyers with instant translations into 5 languages and trigger an audible voice siren broadcast for on-the-ground search teams.


3. Owner Escrow Vault Console & Bounty Settlement

ChainPaws Owner Console showing registered companions, active bounty escrow vaults, and one-click verified settlement payout

Manage registered dogs, lock non-custodial SOL bounties, and release rewards directly to finders with zero administrative intermediary fees.


4. Guardian Badges & Collective Rescue Network

ChainPaws Guardian Badges and Collective Rescue Impact Network showing total SOL escrowed, verified safe reunifications, and unlocked on-chain achievements

Every registration, sighting report, and verified reunion unlocks permanent Guardian Badges while contributing to global community rescue metrics.


โšก Try It in 30 Seconds:

  1. Explore the Map: Browse the live radar across San Francisco, Los Angeles, Austin, Seattle, New York, Chicago, or Miami. Click any dog's marker pin to inspect verified microchip details and reward bounties.
  2. Register a Dog: Go to Register Pet, select a preset (Atlas the Husky, Luna the Frenchie, or Mochi the Shiba), enter a 15-digit microchip ID, and mint your immutable identity PDA.
  3. Generate an Emergency Flyer: Open any missing pet card, tap the Flyer icon, switch between English, Espaรฑol, Franรงais, ไธญๆ–‡, ๆ—ฅๆœฌ่ชž, and press Play Voice Siren to hear the audible alert.
  4. Lock an Escrow Bounty: In My Pets, click Report Missing & Lock Reward, and lock 1.5 SOL into the non-custodial smart escrow vault.
  5. Verify Recovery & Disburse: Test a finder claim or scan the pet in the Clinic Portal. As the owner, click Confirm & Pay SOL to disburse the bounty directly to the finder's wallet with celebration confetti!
  6. Track Rescue Milestones: Open the Badges tab to view your unlocked on-chain achievements and network-wide recovery impact metrics.

๐Ÿ’ป Code

GitHub

https://github.com/Labreo/ChainPaws

๐Ÿ“ฆ Key Tech Stack & Libraries:

  • Blockchain: Solana Devnet, Rust, Anchor Framework 0.30, @solana/web3.js, @coral-xyz/anchor
  • Frontend: Next.js 14 (App Router), React 18, TypeScript, Tailwind CSS, Lucide Icons, Canvas Confetti
  • Mapping: OpenStreetMap, Leaflet.js, React-Leaflet
  • Wallets: @solana/wallet-adapter-react, @solana/wallet-adapter-phantom, @solana/wallet-adapter-solflare
  • Security & Memos: Web Crypto SHA-256, Solana SPL Memo Program (MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr)

๐Ÿ› ๏ธ How I Built It

1. The Zero-Database On-Chain Architecture

ChainPaws runs with zero traditional databases. The blockchain is the sole source of truth. Every pet profile, missing status, escrow balance, and clinic authority is derived deterministically using Solana Program Derived Accounts (PDAs):

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  15-Digit ISO Microchip ID     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                โ”‚ Web Crypto SHA-256
                โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  32-Byte Cryptographic Digest  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                โ”‚
                โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                โ”‚                                          โ”‚
                โ–ผ                                          โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  PetRecord PDA                 โ”‚       โ”‚  BountyEscrow PDA              โ”‚
โ”‚  ["pet", owner_pubkey, hash]   โ”‚ โ”€โ”€โ”€โ”€> โ”‚  ["bounty", pet_pda_pubkey]    โ”‚
โ”‚  Status: Safe | Missing        โ”‚       โ”‚  Vault Balance: 1.5 SOL        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                โ”‚
                โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Official Solana SPL Memo      โ”‚
โ”‚  JSON Block Ledger Engraving   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
Enter fullscreen mode Exit fullscreen mode
  • Microchip Hash Avalanche Property: The 15-digit microchip number is hashed using SHA-256 prior to seed derivation. A single altered digit results in an entirely different PDA address, preventing collisions and unauthorized overrides.
  • Rent Exemption Reclamation (close = recipient): When an escrow bounty is claimed by a finder or cancelled by the owner, the smart contract zeroes the state and closes the BountyEscrow account, immediately refunding the rent exemption balance (~0.00144 SOL). No orphaned accounts or wasted rent.
  • Official Solana SPL Memo Program: Every state transition writes an immutable, human-readable JSON receipt to the Solana transaction log for instant verification on Solana Explorer.

2. Rust Anchor Smart Contract

The core smart contract (anchor/programs/chainpaws/src/lib.rs) enforces strict ownership validations and atomic escrow transfers:

use anchor_lang::prelude::*;
use anchor_lang::system_program::{transfer, Transfer};

declare_id!("GnEv5qz2xufNJqsqbkBvmgAa6ByWEmnygN6zayJ1SD8h");

#[program]
pub mod chainpaws {
    use super::*;

    /// Registers a new pet identity on Solana (PetRecord PDA derived from ["pet", owner, chip_hash])
    pub fn register_pet(
        ctx: Context<RegisterPet>,
        chip_hash: [u8; 32],
        species: u8,
        name: String,
        breed: String,
        metadata_uri: String,
    ) -> Result<()> {
        let pet = &mut ctx.accounts.pet_record;
        pet.owner = ctx.accounts.owner.key();
        pet.chip_hash = chip_hash;
        pet.species = species;
        pet.name = name;
        pet.breed = breed;
        pet.metadata_uri = metadata_uri;
        pet.status = PetStatus::Safe as u8;
        pet.created_at = Clock::get()?.unix_timestamp;
        pet.bump = ctx.bumps.pet_record;
        Ok(())
    }

    /// Reports pet missing and transfers SOL into non-custodial BountyEscrow PDA
    pub fn report_lost(ctx: Context<ReportLost>, bounty_lamports: u64) -> Result<()> {
        let pet = &mut ctx.accounts.pet_record;
        require!(pet.status == PetStatus::Safe as u8, ChainPawsError::PetAlreadyMissing);

        pet.status = PetStatus::Missing as u8;

        let escrow = &mut ctx.accounts.bounty_escrow;
        escrow.pet_record = pet.key();
        escrow.owner = ctx.accounts.owner.key();
        escrow.bounty_amount = bounty_lamports;
        escrow.status = BountyStatus::Active as u8;
        escrow.bump = ctx.bumps.bounty_escrow;
        escrow.created_at = Clock::get()?.unix_timestamp;

        // Transfer SOL from owner wallet into Escrow PDA
        transfer(
            CpiContext::new(
                ctx.accounts.system_program.to_account_info(),
                Transfer {
                    from: ctx.accounts.owner.to_account_info(),
                    to: ctx.accounts.bounty_escrow.to_account_info(),
                },
            ),
            bounty_lamports,
        )?;

        Ok(())
    }

    /// Disburses escrow bounty to finder upon verified recovery and reclaims rent
    pub fn claim_bounty(ctx: Context<ClaimBounty>) -> Result<()> {
        let pet = &mut ctx.accounts.pet_record;
        pet.status = PetStatus::Safe as u8;
        // Anchor close constraint releases escrowed SOL + rent directly to finder
        Ok(())
    }
}
Enter fullscreen mode Exit fullscreen mode

3. Automated Invariant & Security Test Suite

To guarantee trust and mathematical safety before launch, an automated cryptographic test suite was written in TypeScript:

npx tsx anchor/tests/chainpaws.ts
Enter fullscreen mode Exit fullscreen mode
Running ChainPaws Solana PDA & Cryptographic Invariant Tests...

TEST 1: Deterministic PetRecord PDA Derivation
  [PASS] Pet PDA:  Fif8gkWoEAe6uA6LPn6qCfDH7rPBGWP2FtfxwNtGwNUZ (Bump: 254)

TEST 2: Deterministic BountyEscrow PDA Derivation
  [PASS] Bounty PDA: EJqERUpLacR96HF3YDd27ePUrchJVMYYEfB6kTZGcGnJ (Bump: 255)

TEST 3: Clinic Authority PDA Derivation
  [PASS] Clinic PDA: 3Zcd3E4ohvggV3WWZH2yLABYXbCk4AVnUZTwBkYhG2GK (Bump: 254)

TEST 4: Microchip Hash Avalanche & Non-Collision Property
  [PASS] Tampered PDA: GJjDvcEePJYxTyDYBEEqkEBksMxTRJxjmYmZeoy9jHRM

ALL 4 SOLANA PROTOCOL TESTS PASSED DETERMINISTICALLY!
Enter fullscreen mode Exit fullscreen mode

4. Why Solana Was the ONLY Viable Chain for Pet Recovery

Requirement Ethereum / EVM L1 Traditional Web2 Apps Solana Devnet (ChainPaws)
Micro-Bounty Escrow Fees $15 โ€“ $40 per escrow lock $0 (Vulnerable to fraud) <$0.001 per transaction
Emergency Broadcast Latency 2 โ€“ 15 minutes (12+ blocks) Instant (Siloed database) 400ms Sub-Second Finality
Escrow Safety High gas makes micro-rewards impossible High risk of wire-transfer scams Non-Custodial PDA Smart Vaults
State Storage Economics Forever state bloat Private server lock-in Rent Exemption Reclamation (close = owner)
Global Interoperability Fragmented L2s Siloed proprietary registries Universal Global Blockchain State

When an animal is wandering near a busy road, waiting 15 minutes for block confirmations or paying $30 in gas to lock a $20 reward is completely unviable. Solana's sub-second finality and sub-cent fees make decentralized lost-and-found escrow practical for everyday pet parents.


๐Ÿ† Prize Categories

๐Ÿฅ‡ Best Use of Solana

  • Custom Rust Anchor Smart Contract: Full implementation of multi-seed deterministic PDAs, non-custodial escrow vaults, and state teardown rent refunds.
  • Zero-Database Architecture: The Solana blockchain serves as the single source of truth for identities, escrows, and claim handovers.
  • SPL Memo Program Integration: Permanent on-chain JSON records for public Explorer auditability.
  • Native Wallet & RPC Layer: Direct Devnet balance streaming, Phantom/Solflare adapter support, and deterministic cryptographic testing.
  • Guardian Badges & Collective Rescue Network: Gamified on-chain achievement milestones and network-wide impact metrics.

๐Ÿค– Best Use of Google AI

  • Gemini 2.5 Flash Dynamic Multilingual Pipeline (/api/translate): Translates arbitrary companion traits, medical urgency tags, and neighborhood search bulletins in real time across 5 languages (English, Espaรฑol, Franรงais, ไธญๆ–‡, ๆ—ฅๆœฌ่ชž) on demand, with serverless edge caching for instant neighborhood mobilization.

๐Ÿ”ฎ What's Next for ChainPaws

  1. Hardware Smart Collar Tags: Physical NFC/RFID collar charms with embedded cryptographic keypairs that trigger Solana wallet interactions on any smartphone tap.
  2. Municipal Shelter DAO Grants: Community-funded quadratic escrow pools that subsidize emergency veterinary treatment for rescued stray animals.
  3. Zero-Knowledge Microchip Proofs: Enabling owners to prove pet ownership without revealing private contact information until verified by a certified clinic.

Built by @kakeroth with love for dogs, cats, and all four-legged family members everywhere. Keep your pets safe on-chain. ๐Ÿพ๐Ÿ•

Top comments (0)