A decentralized warranty management system built on the Sui blockchain, providing transparent and immutable warranty tracking for electronics and consumer goods.
WarranChain revolutionizes warranty management by leveraging blockchain technology to create tamper-proof warranty records. Our platform enables manufacturers, sellers, and buyers to issue, transfer, and track warranties seamlessly while promoting sustainability through e-waste reduction and repair tracking.
- NFT Warranty Issuance: Issue warranty NFTs directly to customers
- Sponsored Transactions: Gasless minting using Enoki sponsored transactions
- Product Management: Organize warranties by product categories and models
- Analytics Dashboard: Track warranty performance and sustainability metrics
- Bulk Operations: Efficient batch warranty creation
- Digital Warranty Ownership: Own your warranties as transferable NFTs
- Warranty Transfer: Seamlessly transfer warranties when selling products
- Repair Tracking: Log repairs and maintenance history on-chain
- Expiry Notifications: Get reminded before warranty expiration
- Sustainability Impact: Track your contribution to e-waste reduction
- Sui Blockchain Integration: Fast, low-cost transactions
- zkLogin Authentication: Secure Google OAuth integration
- Smart Contract Security: Immutable warranty logic
- Real-time Updates: Live warranty status and transfer tracking
WarranChain/
├── frontend/ # React.js Frontend Application
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ ├── pages/ # Dashboard pages (Buyer/Seller)
│ │ ├── hooks/ # Custom React hooks
│ │ ├── services/ # API and blockchain services
│ │ └── utils/ # Utility functions
│ └── public/ # Static assets
├── backend/ # Node.js Backend Server
│ ├── services/ # Business logic services
│ ├── api/ # API endpoints
│ └── index.js # Main server file
├── contracts/ # Move Smart Contracts
│ └── warranty_nft/ # Warranty NFT contract
│ ├── sources/ # Move source files
│ └── tests/ # Contract tests
└── scripts/ # Deployment and utility scripts
- Node.js (v18+)
- npm or yarn
- Sui CLI
- Git
-
Clone the repository
git clone https://github.com/yongjing479/WarranChain.git cd WarranChain/WarranChain -
Install Frontend Dependencies
cd frontend npm install -
Install Backend Dependencies
cd ../backend npm install -
Environment Configuration
Frontend (.env)
REACT_APP_GOOGLE_CLIENT_ID=your_google_client_id REACT_APP_ENOKI_API_KEY=your_enoki_public_key REACT_APP_SUI_NETWORK=testnet REACT_APP_BACKEND_URL=http://localhost:3001
Backend (.env)
ENOKI_API_KEY=your_enoki_private_key SUI_RPC_URL=https://fullnode.testnet.sui.io:443 OAUTH_CLIENT_ID=your_google_client_id PACKAGE_ID=0xddf9437133e37cdc9278a3ffaf625eb54ff0cba8dc60797f8a84a0e09596f49d SUPABASE_URL=your_supabase_url SUPABASE_SERVICE_KEY=your_supabase_key
-
Start the Backend Server
cd backend npm start -
Start the Frontend Application
cd frontend npm start -
Access the Application
- Frontend: http://localhost:3000
- Backend API: http://localhost:3001
-
Build the Contract
cd contracts/warranty_nft sui move build -
Deploy to Testnet
sui client publish --gas-budget 100000000
-
Update Package ID
- Copy the package ID from deployment output
- Update
PACKAGE_IDin backend.env - Update
PACKAGE_IDin frontendcontractConfig.js
Windows PowerShell:
cd contracts/warranty_nft
./mint_test_nft.ps1Linux/Mac:
cd contracts/warranty_nft
chmod +x mint_test_nfts.sh
./mint_test_nfts.sh- Google OAuth: Users sign in with Google
- zkLogin Integration: Convert Google JWT to Sui address
- Sponsored Transactions: Enoki handles gas fees for minting
- Wallet Creation: Automatic wallet generation from email
- Sign Up: Create seller account with Google OAuth
- Issue Warranty: Fill product details and buyer information
- Mint NFT: System creates warranty NFT automatically
- Track Performance: Monitor issued warranties on dashboard
- Receive Warranty: Get warranty NFT in your wallet
- View Details: Check warranty status and expiry
- Transfer Ownership: Transfer warranty when selling product
- Log Repairs: Record maintenance and repair history
- E-waste Tracking: Monitor prevented e-waste through repairs
- Carbon Footprint: Calculate CO2 reduction from extended product life
- Repair Incentives: Gamify repair tracking with sustainability scores
- Local Business Support: Connect with local repair services
Backend with Hot Reload:
cd backend
npm run devFrontend with Hot Reload:
cd frontend
npm startsrc/
├── components/
│ ├── Buyer/ # Buyer-specific components
│ ├── Seller/ # Seller-specific components
│ └── EnokiContext.js # Authentication context
├── hooks/
│ └── useWarranties.js # Warranty management hook
├── pages/
│ ├── BuyerDashboard.js
│ ├── SellerDashboard.js
│ └── LoginPage.js
├── services/
│ ├── suiService.js # Blockchain interactions
│ └── saltService.js # zkLogin salt management
└── config/
└── contractConfig.js # Smart contract configuration
cd frontend
npm testcd backend
npm testcd contracts/warranty_nft
sui move testPOST /mint-nft-sponsored- Mint warranty NFT with sponsorshipPOST /get-address-from-email- Get Sui address from emailPOST /get-salt- Get zkLogin salt for authenticationPOST /sign-transaction- Sign transactions with zkLogin
- React.js - UI framework
- Mantine - Component library
- @mysten/sui.js - Sui blockchain integration
- @mysten/enoki - Sponsored transactions
- React Router - Navigation
- Node.js - Runtime environment
- Express.js - Web framework
- @mysten/enoki - Enoki SDK
- Supabase - Database and authentication
- jsonwebtoken - JWT handling
- Sui Blockchain - Layer 1 blockchain
- Move Language - Smart contract language
- zkLogin - Privacy-preserving authentication
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
Backend Connection Refused
- Ensure backend server is running on port 3001
- Check
.envconfiguration - Verify CORS settings
Sponsored Transaction Failures
- Check Enoki API key validity
- Verify package ID in contract config
- Ensure sufficient Enoki credits
zkLogin Authentication Issues
- Verify Google OAuth client ID
- Check redirect URI configuration
- Ensure proper JWT handling
Built with love by the WarranChain Team
Transforming warranty management through blockchain technology
