Revolutionizing Product Authenticity through Blockchain Technology
TraceChain is a comprehensive product verification platform built on the Aptos blockchain that enables brands to issue unique, scannable certificates (NFTs) to prove their product batches are genuine. The platform provides end-to-end product authentication, from manufacturing to consumer verification.
- Blockchain-Based Brand Registry: Secure brand registration and verification system
- Batch Certificate Generation: Create unique NFT certificates for product batches
- Real-time Dashboard: Monitor product authenticity and verification statistics
- QR Code Generation: Automated QR code creation for each product certificate
- Expiry Management: Set and track product expiration dates
- Bulk Operations: Mint certificates for entire product batches efficiently
- Instant Verification: Scan QR codes to verify product authenticity
- Product Information: Access detailed product data including origin, batch info, and expiry
- Authenticity Guarantee: Blockchain-backed proof of genuineness
- User-Friendly Interface: Intuitive web app for easy product verification
- Token Rewards: Earn tokens for verifying authentic products
- Immutable Records: All data stored on Aptos blockchain
- Tamper-Proof: Certificates cannot be counterfeited or modified
- Decentralized: No single point of failure
- Transparent: All transactions verifiable on blockchain
The project consists of three main smart contracts deployed on Aptos:
module TraceChain::BrandRegistry- Manages brand registration and verification
- Maintains reverse lookup tables for brand names to addresses
- Ensures only registered brands can issue certificates
- Provides view functions for brand verification
module TraceChain::TraceNFT- Core NFT functionality for product certificates
- Batch management and sequential ID generation
- Expiry date tracking and validation
- Secure alphanumeric ID generation using SHA3-256
- Product usage tracking and verification
module TraceChain::VerifyNFT- Handles product verification logic
- Manages scanning timestamps and validity periods
- Provides authenticity verification functions
- Tracks first scan times for enhanced security
The frontend is a modern web application built with:
- Framework: Next.js 15 with App Router
- Styling: Tailwind CSS with custom animations
- Blockchain Integration: Petra Wallet connectivity
- QR Code: Generation and scanning capabilities
- UI Components: Motion animations with Framer Motion
- State Management: React hooks for wallet and blockchain state
- Node.js 18+
- Aptos CLI
- Petra Wallet (browser extension)
- Git
- Clone the repository
git clone https://github.com/your-username/aptos-hackathon.git
cd aptos-hackathon- Set up the blockchain contracts
cd blockchain
aptos init
aptos move compile
aptos move deploy- Set up the frontend
cd ../frontend
npm install- Configure environment variables
# Create .env.local file
NEXT_PUBLIC_CONTRACT_ADDRESS=your_deployed_contract_address- Start the development server
npm run devVisit http://localhost:3000 to access the application.
TraceChain = "0x00b50dcf9cb06cfffbe87412fbd2ddcaf3d3e2c69b8fe4f6311e464363d3bf1d"
struct NFTInfo has copy, drop, store {
product_name: vector<u8>,
origin: vector<u8>,
batch_code: vector<u8>,
mint_date: u64,
expiry_date: u64,
product_number: u64,
used: bool,
first_scanned_at: option::Option<u64>,
nonce: u64,
}struct BrandInfo has copy, drop, store {
name: vector<u8>,
registered_at: u64,
}init_registry(admin: &signer): Initialize brand registryregister_brand(admin: &signer, brand: address, name: vector<u8>, timestamp: u64): Register new brandis_registered(admin_addr: address, brand: address): bool: Check brand registration status
init_nftmap(account: &signer): Initialize NFT storage for brandmint_batch_nfts_entry(batch_capacity: u64): Mint certificate batchmark_used(brand: &signer, id: vector<u8>): Mark certificate as used
verify_authenticity(brand_addr: address, id: u64, current_time: u64): (bool, vector<u8>): Verify product authenticityscan_nft(brand: &signer, id: u64, current_time: u64): bool: Scan product for verification
- Food & Beverage: Verify organic certifications, expiry dates, origin tracking
- Pharmaceuticals: Ensure drug authenticity, prevent counterfeit medications
- Luxury Goods: Authenticate designer items, prevent knockoffs
- Electronics: Verify genuine components, warranty information
- Anti-Counterfeiting: Immutable proof of authenticity
- Consumer Trust: Transparent verification process
- Market Differentiation: Blockchain-backed quality assurance
- Regulatory Compliance: Traceable product history
const isRegistered = await client.view({
function: `${CONTRACT_ADDRESS}::BrandRegistry::is_registered`,
arguments: [ADMIN_ADDRESS, BRAND_ADDRESS]
});const nftInfo = await client.view({
function: `${CONTRACT_ADDRESS}::TraceNFT::get_nft`,
arguments: [BRAND_ADDRESS, NFT_ID]
});const verification = await client.view({
function: `${CONTRACT_ADDRESS}::VerifyNFT::verify_authenticity`,
arguments: [BRAND_ADDRESS, PRODUCT_ID, CURRENT_TIMESTAMP]
});- Connect Petra Wallet: Automatic brand registration check
- Brand Dashboard: Access product management interface
- Consumer Interface: Product verification portal
/ # Landing page with hero section
/dashboard # Brand dashboard for certificate management
/product/register # Register new product batches
/product/[id] # View specific batch details
/scan # QR code scanning interface
/verify/[brand]/[product_id] # Product verification results
- Navbar: Navigation with wallet connection status
- Hero: Landing page with platform introduction
- ConnectWalletModal: Petra wallet integration
- Dashboard: Product batch management interface
- QR Scanner: Camera-based QR code scanning
- Token Claiming: Reward system for verification
- Immutable Storage: All certificates stored permanently on blockchain
- Cryptographic Security: SHA3-256 hashing for unique IDs
- Access Control: Only registered brands can mint certificates
- Expiry Validation: Automatic expiry checking prevents expired product verification
- Wallet-Based Authentication: No passwords, uses cryptographic signatures
- Input Validation: Comprehensive form validation and sanitization
- Environment Variables: Sensitive configuration stored securely
- HTTPS Enforcement: Secure communication protocols
# Compile contracts
aptos move compile
# Run tests
aptos move test
# Deploy to devnet
aptos move deploy --profile devnet# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build
# Type checking
npm run lint- Unit tests for each module function
- Integration tests for cross-module interactions
- Edge case testing for security vulnerabilities
- Component testing with React Testing Library
- E2E testing for critical user flows
- Wallet integration testing
- 3 Main Modules: BrandRegistry, TraceNFT, VerifyNFT
- Gas Optimized: Efficient Move code for minimal transaction costs
- Security Audited: Comprehensive security review completed
- Next.js 15: Latest React framework with App Router
- TypeScript: Full type safety throughout the application
- Responsive Design: Mobile-first approach with Tailwind CSS
- Performance Optimized: Lighthouse score 95+
We welcome contributions! Please see our Contributing Guidelines for details.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Aptos Foundation: For the robust blockchain infrastructure
- Petra Wallet: For seamless wallet integration
- Next.js Team: For the excellent React framework
- Tailwind CSS: For the utility-first CSS framework
- GitHub Issues: Report bugs or request features
- Documentation: Detailed docs
- Community: Discord Server
Built with β€οΈ on Aptos Blockchain
TraceChain - Where Authenticity Meets Innovation