Skip to content

joadataarg/Chainbeef

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

BeefChain - Blockchain Beef Traceability System

StarkNet Cairo Next.js License

πŸ“‹ Description

BeefChain is a comprehensive traceability platform for the meat industry that uses StarkNet to ensure transparency, security and efficiency throughout the supply chain. From producer to end consumer, every step is immutably recorded on the blockchain.

🌟 Key Features

πŸ”— Complete Traceability

  • Immutable History: Every transaction recorded on StarkNet
  • Dynamic QR Codes: Unique codes per cut with real-time data
  • Full Audit Trail: Complete journey from birth to sale

🌱 Sustainability

  • Environmental impact reports
  • Carbon footprint estimation
  • Supply chain efficiency metrics

πŸ”’ Security & Roles

  • Role-based permission system (Access Control)
  • Multiple administration levels
  • User-specific functions

πŸ—οΈ System Architecture

Roles & Participants

  1. Producers - Register animals and manage batches
  2. Slaughterhouses - Process animals and generate QR cuts
  3. Veterinarians - Certify animal health and welfare
  4. IoT Operators - Record real-time sensor data
  5. Certifiers - Validate quality standards
  6. Exporters - Manage international shipments
  7. Auditors - Supervise regulatory compliance
  8. Consumers - Scan QR for traceability

πŸ“‹ Contract Information

Main Contract (AnimalNFT) - LATEST VERSION

  • Address: 0x065f45868a08c394cb54d94a6e4eb08012435b5c9803bb41d22ecb9e603e535d
  • Class Hash: 0x0712b9eac6e7653cd2abe5e45a0da9197da4657fddfb7de8af2ba9532a3ee404
  • Network: StarkNet Sepolia

Previous Contracts (Historical)

  • 0x02d0234b0a1d7015c8fa5f13c3a5d9aed7512ac02a9df2713c3cf1650b22cafe (Previous version)

Project Wallets

  • Deployer: 0x1baaeb194649d3ec0c78942f9b462bfaf602b9a4ec84275f3d8af78ea19df2e (Main funded account)
  • System Wallet: 0x3226a67cc925c443ae7f31971393cece97c0f4abb967e4c5a0dbbb936a08fd9 (2% commissions)
  • Backup Wallet: 0x154b998302478a2377bd8122fb081273494db55407efcb7e3fd8c31d6108679 (Emergencies)

Explorer URLs

πŸ”§ Core Functionalities

For Producers

  • create_animal_simple(raza) - Quick animal creation
  • create_animal() - Complete registration with metadata
  • create_animal_batch() - Batch management
  • update_animal_weight() - Weight updates

For Slaughterhouses

  • procesar_animal() - Individual processing
  • procesar_batch() - Batch processing
  • crear_corte() - Cut generation with QR
  • crear_cortes_para_batch() - Mass production

For Veterinarians

  • add_health_record() - Medical history recording
  • quarantine_animal() - Animal quarantine
  • authorize_veterinarian_for_animal() - Authorizations

For IoT

  • record_iot_reading() - Real-time sensor data
  • get_latest_iot_reading() - Metric queries

For Certifiers

  • certify_animal() - Individual certification
  • certify_batch() - Batch certification
  • certify_corte() - Cut certification

For Exporters

  • prepare_export_batch() - Shipment preparation
  • confirm_export() - Export confirmation
  • update_export_temperature() - Cold chain control

For Consumers

  • get_public_consumer_data() - Traceability data
  • verify_qr_authenticity() - Authenticity verification
  • generate_qr_for_corte() - QR code generation

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • StarkNet wallet
  • Git

Installation

  1. Clone the repository

bash

git clone https://github.com/your-username/beefchain.git

cd beefchain

  1. Install dependencies

bash

cd frontend

npm install --legacy-peer-deps

  1. Configure environment

bash

cp .env.example .env.local

  1. Update environment variables

env

# BeefChain Configuration - StarkNet Sepolia
NEXT_PUBLIC_CONTRACT_ADDRESS=0x065f45868a08c394cb54d94a6e4eb08012435b5c9803bb41d22ecb9e603e535d
NEXT_PUBLIC_CONTRACT_CLASS_HASH=0x0712b9eac6e7653cd2abe5e45a0da9197da4657fddfb7de8af2ba9532a3ee404

NEXT_PUBLIC_RPC_URL=https://starknet-sepolia.public.blastapi.io/rpc/v0_9

  1. Run the development server

bash

npm run dev

πŸ“ Project Structure

text

beefchain/frontend/
β”œβ”€β”€ πŸ“ src/
β”‚ β”œβ”€β”€ πŸ“ app/ # Next.js App Router Pages
β”‚ β”‚ β”œβ”€β”€ πŸ“ admin/ # Admin dashboard
β”‚ β”‚ β”œβ”€β”€ πŸ“ certification/ # Certification interface
β”‚ β”‚ β”œβ”€β”€ πŸ“ consumidor/ # Consumer portal
β”‚ β”‚ β”œβ”€β”€ πŸ“ exportador/ # Exporter management
β”‚ β”‚ β”œβ”€β”€ πŸ“ frigorifico/ # Slaughterhouse operations
β”‚ β”‚ β”œβ”€β”€ πŸ“ productor/ # Producer management
β”‚ β”‚ └── πŸ“ veterinario/ # Veterinarian portal
β”‚ β”œβ”€β”€ πŸ“ components/ # React Components
β”‚ β”‚ β”œβ”€β”€ πŸ“ admin/ # Admin components

β”‚ β”‚ β”œβ”€β”€ πŸ“ common/ # Shared components

β”‚ β”‚ β”œβ”€β”€ πŸ“ exportador/ # Exporter components

β”‚ β”‚ β”œβ”€β”€ πŸ“ frigorifico/ # Slaughterhouse components

β”‚ β”‚ β”œβ”€β”€ πŸ“ productor/ # Producer components

β”‚ β”‚ └── πŸ“ veterinario/ # Veterinarian components

β”‚ β”œβ”€β”€ πŸ“ contracts/ # Smart Contract Integration

β”‚ β”œβ”€β”€ πŸ“ hooks/ # Custom React Hooks

β”‚ β”œβ”€β”€ πŸ“ providers/ # React Providers

β”‚ β”œβ”€β”€ πŸ“ services/ # Business Logic Services

β”‚ β”œβ”€β”€ πŸ“ types/ # TypeScript Definitions

β”‚ └── πŸ“ utils/ # Utility Functions
β”œβ”€β”€ πŸ“ public/ # Static Assets
β”‚ β”œβ”€β”€ next.svg
β”‚ β”œβ”€β”€ vercel.svg
β”‚ └── *.svg icons
β”œβ”€β”€ package.json # Dependencies
β”œβ”€β”€ next.config.ts # Next.js configuration
β”œβ”€β”€ tsconfig.json # TypeScript configuration
└── eslint.config.mjs # ESLint configuration

🌐 Network Configuration

  • RPC URL: https://starknet-sepolia.public.blastapi.io/rpc/v0_9
  • Explorer: https://sepolia.voyager.online
  • Network: sepolia

πŸ” ChipyPay Integration

  • Private Key: sk_dev_916327c90fe67a75d0809810639f6705533dac27573e36afa7147a6e8a352531
  • Public Key: pk_dev_d7e6505de47e23fd8633013288c34f36

🎯 Hackathon Features

Blockchain Innovation

  • βœ… StarkNet L2: Scalability with Ethereum security
  • βœ… Animal NFTs: Unique animal tokenization
  • βœ… Dynamic QR: Real-time traceability
  • βœ… Multiple Roles: Complete participant ecosystem

Real Impact

  • πŸ₯© Total Transparency: From farm to table
  • 🌱 Sustainability: Integrated environmental metrics
  • πŸ”’ Food Safety: Immutable certifications
  • πŸ“± Consumer Access: QR with complete history

Technology

  • ⚑ Cairo Contracts: Business logic in StarkNet
  • 🎨 Next.js Frontend: Modern responsive interface
  • πŸ”— Decentralized APIs: Direct blockchain integration
  • πŸ“Š Real-time Dashboard: Complete system monitoring

πŸ”„ Workflow

  1. Producer registers animal with basic info
  2. Veterinarian adds health records and certifications
  3. IoT devices record environmental data
  4. Slaughterhouse processes animal and creates cuts
  5. Certifier validates quality standards
  6. Exporter prepares international shipment
  7. Consumer scans QR for complete history

πŸ“Š Contract ABI

The project includes comprehensive ABI for all contract functions including:

  • Animal management and tracking
  • Batch processing operations
  • Certification and validation
  • QR code generation and verification
  • IoT data recording
  • Sustainability reporting

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • StarkNet Foundation for L2 infrastructure
  • Cairo language developers
  • The blockchain community for inspiration

BeefChain - Revolutionizing meat traceability with cutting-edge blockchain technology. πŸš€

Transparency from Farm to Fork

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages