{"id":19024129,"url":"https://github.com/pathak-ashutosh/pedigree-pal","last_synced_at":"2026-05-07T08:32:50.380Z","repository":{"id":190006155,"uuid":"623987502","full_name":"pathak-ashutosh/pedigree-pal","owner":"pathak-ashutosh","description":"Blockchain-based Dog Pedigree and Ownership Verification System","archived":false,"fork":false,"pushed_at":"2023-05-15T00:00:26.000Z","size":89003,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-02T01:26:53.710Z","etag":null,"topics":["ethereum","security","solidity"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pathak-ashutosh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-05T14:03:14.000Z","updated_at":"2023-08-22T16:46:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"8405d5b5-308e-4149-8aae-3f217c82657a","html_url":"https://github.com/pathak-ashutosh/pedigree-pal","commit_stats":null,"previous_names":["pathak-ashutosh/pedigree-pal"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pathak-ashutosh%2Fpedigree-pal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pathak-ashutosh%2Fpedigree-pal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pathak-ashutosh%2Fpedigree-pal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pathak-ashutosh%2Fpedigree-pal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pathak-ashutosh","download_url":"https://codeload.github.com/pathak-ashutosh/pedigree-pal/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240072065,"owners_count":19743527,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ethereum","security","solidity"],"created_at":"2024-11-08T20:34:56.575Z","updated_at":"2026-05-07T08:32:50.372Z","avatar_url":"https://github.com/pathak-ashutosh.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PedigreePal\n\n\u003e A blockchain-based decentralized dog pedigree and ownership verification system.\n\nPedigreePal is an Ethereum dApp that lets dog owners, breeders, veterinarians, and animal shelters register and verify dog pedigree information on-chain — creating a transparent, immutable, and accessible registry that replaces costly kennel club registrations.\n\n---\n\n## Table of Contents\n\n- [Overview](#overview)\n- [Features](#features)\n- [Architecture](#architecture)\n- [Tech Stack](#tech-stack)\n- [Getting Started](#getting-started)\n  - [Prerequisites](#prerequisites)\n  - [Installation](#installation)\n  - [Local Development](#local-development)\n  - [Testnet Deployment](#testnet-deployment)\n- [Usage](#usage)\n- [Smart Contract](#smart-contract)\n- [Project Structure](#project-structure)\n- [Contributing](#contributing)\n- [License](#license)\n\n---\n\n## Overview\n\nTraditional dog pedigree registrations are expensive, centralized, and susceptible to falsification. PedigreePal solves this by storing pedigree data on the blockchain — making records public, tamper-proof, and accessible to anyone with a Web3 wallet.\n\n**Problem:**\n- Kennel club registration is costly and geographically limited\n- Pedigree documents can be forged by unethical breeders\n- No universal, accessible system ties microchip IDs to verifiable ancestry\n\n**Solution:**\n- On-chain dog registry with immutable records\n- Parent-child relationships stored as a pedigree chain\n- Owner address recorded for each dog — enabling vets and shelters to contact owners\n\n---\n\n## Features\n\n- **Register Dogs** — Record name, breed, age, sex, and parentage on-chain\n- **Pedigree Lookup** — Retrieve any dog's certificate by ID\n- **Ownership Proof** — Each dog is tied to an Ethereum address\n- **Parent Linking** — Connect dogs to their mother and father by ID\n- **MetaMask Integration** — Wallet-based authentication, no accounts needed\n- **Transaction Feedback** — Real-time status for pending and failed transactions\n\n---\n\n## Architecture\n\n```\n┌─────────────────────────────────────────┐\n│              User Browser               │\n│   React dApp (Vite + Tailwind/DaisyUI)  │\n│         ethers.js (Web3 layer)          │\n└──────────────┬──────────────────────────┘\n               │ JSON-RPC\n               ▼\n┌─────────────────────────────────────────┐\n│            MetaMask Wallet              │\n│     Signs transactions / manages keys   │\n└──────────────┬──────────────────────────┘\n               │\n               ▼\n┌─────────────────────────────────────────┐\n│         Ethereum / Polygon Network      │\n│    PedigreePal.sol (Solidity ^0.8)      │\n│    Dog registry stored in mapping       │\n└─────────────────────────────────────────┘\n```\n\n**Data flow:**\n1. User connects MetaMask wallet\n2. Frontend initializes ethers.js provider + contract instance\n3. User submits registration form → frontend calls `registerDog()` on contract\n4. MetaMask prompts user to sign and send transaction\n5. On confirmation, `Register` event emitted, UI shows success toast\n6. Lookup queries `retrieveDog(id)` — a read-only call, no gas needed\n\n---\n\n## Tech Stack\n\n| Layer | Technology |\n|---|---|\n| Smart Contracts | Solidity ^0.8, Hardhat |\n| Web3 | ethers.js v6 |\n| Frontend | React 18, Vite |\n| Styling | Tailwind CSS v4, DaisyUI v5 |\n| Icons | Lucide React |\n| Testnet | Polygon Amoy (via Alchemy) |\n| Wallet | MetaMask |\n\n---\n\n## Getting Started\n\n### Prerequisites\n\n- [Node.js](https://nodejs.org/) v18+\n- [MetaMask](https://metamask.io/) browser extension\n- [Alchemy](https://alchemy.com/) account (for testnet deployment only)\n\n### Installation\n\n```bash\n# Clone the repository\ngit clone https://github.com/pathak-ashutosh/pedigree-pal.git\ncd pedigree-pal\n\n# Install smart contract dependencies\nnpm install\n\n# Install frontend dependencies\ncd frontend \u0026\u0026 npm install\n```\n\n### Environment Setup\n\nCopy the example env file and fill in your values:\n\n```bash\ncp .env.example .env\n```\n\n```env\n# .env\nAPI_URL=https://polygon-amoy.g.alchemy.com/v2/YOUR_ALCHEMY_API_KEY\nMETAMASK_PRIVATE_KEY=your_private_key_without_0x_prefix\n```\n\n\u003e **Security:** Never commit your `.env` file or expose your private key. The `.env` file is already in `.gitignore`.\n\n### Local Development\n\nRun the full stack locally using Hardhat's built-in network:\n\n```bash\n# Terminal 1 — start local Ethereum node\nnpx hardhat node\n\n# Terminal 2 — compile and deploy contract to local node\nnpx hardhat run scripts/deploy.js --network localhost\n\n# Terminal 3 — start the frontend dev server\ncd frontend\nnpm start\n```\n\nThe dApp will be available at `http://localhost:5173`.\n\n**Configure MetaMask for local development:**\n1. Add a new network in MetaMask:\n   - Network Name: `Hardhat Local`\n   - RPC URL: `http://127.0.0.1:8545`\n   - Chain ID: `31337`\n   - Currency Symbol: `ETH`\n2. Import one of the accounts printed by `npx hardhat node` using its private key\n\n### Testnet Deployment\n\nDeploy to Polygon Amoy testnet:\n\n```bash\nnpx hardhat run scripts/deploy.js --network amoy\n```\n\nAfter deployment, update `frontend/src/contracts/contract-address.json` with the new address.\n\nGet Amoy testnet MATIC from the [Polygon Faucet](https://faucet.polygon.technology/).\n\n---\n\n## Usage\n\n### Registering a Dog\n\n1. Open the dApp and click **Connect Wallet**\n2. Approve the MetaMask connection prompt\n3. Click **Register Dog** and fill in:\n   - Name, breed, age, sex\n   - Mother ID and Father ID (use `0` if unknown)\n4. Submit — MetaMask will prompt for transaction approval\n5. Wait for confirmation; a success notification will appear with the new dog's ID\n\n### Looking Up a Dog\n\n1. Click **Check Dog**\n2. Enter the dog's ID\n3. The pedigree certificate will display: name, breed, age, sex, owner address, and parent IDs\n\n### Tracing a Pedigree\n\nUse the parent IDs on any dog's certificate to recursively look up ancestors by their IDs.\n\n---\n\n## Smart Contract\n\n**Contract:** `PedigreePal.sol`\n**Deployed (Hardhat Local):** `0x5FbDB2315678afecb367f032d93F642f64180aa3`\n\n### Dog Struct\n\n```solidity\nstruct Dog {\n    uint id;        // Auto-incremented unique ID\n    string name;    // Dog's name\n    uint age;       // Age in years\n    string breed;   // Breed name\n    string sex;     // \"M\" or \"F\"\n    uint mother;    // Mother's dog ID (0 = unknown)\n    uint father;    // Father's dog ID (0 = unknown)\n    address owner;  // Ethereum address of the registrant\n}\n```\n\n### Key Functions\n\n| Function | Description | Access |\n|---|---|---|\n| `registerDog(name, age, breed, sex, mother, father)` | Register a new dog, returns new dog ID | Public |\n| `retrieveDog(id)` | Returns the Dog struct for a given ID | Public view |\n\n### Events\n\n```solidity\nevent Register(uint id, string name, address owner);\n```\n\nEmitted on every successful registration.\n\n### ABI\n\nThe compiled ABI is at `frontend/src/contracts/PedigreePal.json`. It is auto-generated by Hardhat on compilation and copied to the frontend by the deploy script.\n\n---\n\n## Project Structure\n\n```\npedigree-pal/\n├── contracts/\n│   └── PedigreePal.sol          # Main smart contract\n├── scripts/\n│   └── deploy.js                # Hardhat deployment script\n├── test/\n│   └── PedigreePal.js           # Contract unit tests\n├── frontend/\n│   ├── public/                  # Static assets (favicon, logos)\n│   ├── src/\n│   │   ├── components/\n│   │   │   ├── Dapp.jsx         # Root app component, state management\n│   │   │   ├── RegisterDog.jsx  # Dog registration form\n│   │   │   ├── CheckDog.jsx     # Pedigree lookup UI\n│   │   │   ├── DogCertificateCard.jsx  # Pedigree display card\n│   │   │   ├── ConnectWallet.jsx\n│   │   │   ├── Navbar.jsx\n│   │   │   ├── Footer.jsx\n│   │   │   └── ...              # Status/error message components\n│   │   ├── contracts/\n│   │   │   ├── PedigreePal.json # Contract ABI (generated)\n│   │   │   └── contract-address.json   # Deployed address\n│   │   ├── index.jsx            # App entry point\n│   │   └── index.css            # Tailwind + DaisyUI theme\n│   ├── index.html\n│   ├── vite.config.js\n│   └── package.json\n├── hardhat.config.js\n├── .env.example\n└── package.json\n```\n\n---\n\n## Contributing\n\nContributions are welcome. Please follow these steps:\n\n1. Fork the repository\n2. Create a feature branch: `git checkout -b feat/your-feature`\n3. Commit your changes: `git commit -m 'feat: add your feature'`\n4. Push to your fork: `git push origin feat/your-feature`\n5. Open a pull request against `main`\n\nPlease run tests before submitting:\n\n```bash\nnpx hardhat test\n```\n\n---\n\n## Roadmap\n\n- [ ] Encrypt sensitive owner data — only authorized addresses can decrypt\n- [ ] Role-based access (breeders, vets, shelters) via contract roles\n- [ ] Microchip ID integration\n- [ ] IPFS photo storage for dog profiles\n- [ ] Multi-chain support (Ethereum mainnet, Polygon mainnet)\n- [ ] Mobile-friendly PWA\n\n---\n\n## License\n\nMIT — see [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpathak-ashutosh%2Fpedigree-pal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpathak-ashutosh%2Fpedigree-pal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpathak-ashutosh%2Fpedigree-pal/lists"}