A comprehensive blockchain-enabled federated learning platform with real ML algorithms, complete on-chain aggregation, and production-ready features.
- Complete aggregation results stored on blockchain with participant weights
- Real-time blockchain event monitoring and updates
- Automatic aggregation triggering when threshold is met
- Cryptographic verification of all aggregation results
- Actual neural networks, linear regression, and decision trees
- Real model training with gradient descent and backpropagation
- Comprehensive model evaluation with precision, recall, F1-score
- Federated averaging with mathematically correct weight aggregation
- Real contract calls with proper gas estimation and monitoring
- Comprehensive error handling with user-friendly messages
- Network switching and connection management
- Transaction monitoring with retry mechanisms
- Real hyperparameter optimization with grid search
- Working model selector with actual model data
- Model storage with IPFS integration
- Differential privacy with mathematically correct mechanisms
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Frontend (React + Vite) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β βββββββββββββββββββ βββββββββββββββββββ ββββββββββββββββ β
β β Model β β Federated β β Dashboard β β
β β Optimizer β β Aggregation β β Analytics β β
β βββββββββββββββββββ βββββββββββββββββββ ββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β ML Engine (TensorFlow.js) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β βββββββββββββββββββ βββββββββββββββββββ ββββββββββββββββ β
β β Blockchain β β IPFS β β Firebase β β
β β Service β β Service β β (Cache) β β
β βββββββββββββββββββ βββββββββββββββββββ ββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Enhanced Smart Contract (Sepolia) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Node.js (v18 or higher)
- MetaMask browser extension
- Sepolia testnet ETH (get from faucet)
# Clone the repository
git clone <repository-url>
cd Noice/frontend
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env
# Edit .env with your configurationUpdate frontend/.env:
# Firebase Config
VITE_FIREBASE_API_KEY=your_firebase_api_key
VITE_FIREBASE_PROJECT_ID=your_project_id
# ... other Firebase config
# Enhanced Contract Address (Deploy FederatedAggregationRegistry.sol)
VITE_FEDERATED_CONTRACT_ADDRESS=0x1234567890123456789012345678901234567890
# IPFS Config
VITE_IPFS_GATEWAY=https://ipfs.io/ipfs/
VITE_IPFS_API_URL=https://api.pinata.cloud/pinning/pinFileToIPFS
# ML Engine Config
VITE_ML_BACKEND=tensorflow
VITE_MAX_MODEL_SIZE=50000000
VITE_DEFAULT_BATCH_SIZE=32-
Deploy Enhanced Contract:
# Use Thirdweb Dashboard or Remix IDE # Deploy: src/contracts/FederatedAggregationRegistry.sol # Network: Sepolia Testnet
-
Update Contract Address:
# Update VITE_FEDERATED_CONTRACT_ADDRESS in .env
# Start development server
npm run dev
# Build for production
npm run buildFile: src/contracts/FederatedAggregationRegistry.sol
- Complete on-chain aggregation result storage
- Participant weight tracking and management
- Automatic aggregation triggering
- Organization registration and management
- Event emissions for real-time monitoring
File: src/lib/realMLEngine.js
- Neural Networks: Multi-layer perceptrons with dropout and regularization
- Linear Regression: With L2 regularization and proper optimization
- Logistic Regression: Binary and multi-class classification
- Decision Trees: Neural network approximation with tree-like structure
- Federated Averaging: Mathematically correct weight aggregation
- Model Evaluation: Comprehensive metrics (accuracy, precision, recall, F1)
File: src/lib/realBlockchainService.js
- Real contract interactions with gas estimation
- Transaction monitoring and retry mechanisms
- Network switching and error handling
- Event listening for real-time updates
- Comprehensive error messages and recovery
File: src/components/ModelOptimizer.jsx
- Real hyperparameter optimization with grid search
- Working model selector with actual model data
- Model storage with metadata and versioning
- Differential privacy integration
- Performance evaluation and comparison
File: src/components/FederatedAggregationInterface.jsx
- Real blockchain integration for round management
- Automatic aggregation triggering
- Participant weight calculation
- IPFS model storage integration
- Real-time status monitoring
File: src/pages/Dashboard.jsx
- Real-time blockchain data integration
- Event-driven updates
- Comprehensive analytics and metrics
- On-chain verification status
- Performance monitoring
- Navigate to Federated Aggregation page
- Configure round parameters:
- Minimum participants: 2-10
- Maximum participants: 10-100
- Duration: 1-24 hours
- Aggregation threshold: 50-100%
- Click Start New Round
- Approve MetaMask transaction
- Navigate to Model Optimizer page
- Select ML algorithm (Neural Network, Linear Regression, etc.)
- Configure hyperparameters to test
- Set privacy parameters if needed
- Click Start Optimization
- Review results and apply best configuration
- Navigate to Submit Update page
- Enter model parameters and metrics
- Configure privacy settings
- Submit update (stored on blockchain)
- Monitor aggregation progress
- Navigate to Dashboard
- View real-time metrics and statistics
- Monitor blockchain verification status
- Analyze trends and performance
- Laplace and Gaussian noise mechanisms
- Configurable privacy budgets (epsilon)
- Automatic noise application to model updates
- Immutable aggregation results
- Cryptographic hash verification
- Organization-based access control
- Event-driven audit trails
- Comprehensive error messages
- Recovery action suggestions
- Automatic retry mechanisms
- Graceful fallback to cached data
# Run ML engine tests
npm test src/lib/realMLEngine.test.js
# Run blockchain service tests
npm test src/lib/realBlockchainService.test.js# Test complete federated learning workflow
npm test src/integration/federatedLearning.test.js- Model Training: Test with different algorithms and datasets
- Blockchain Integration: Test with real Sepolia transactions
- Error Scenarios: Test network failures and recovery
- Performance: Test with large models and datasets
Vercel (Recommended):
# Install Vercel CLI
npm i -g vercel
# Deploy
vercel --prod
# Set environment variables in Vercel dashboardNetlify:
# Build the project
npm run build
# Deploy dist/ folder to Netlify-
Using Thirdweb Dashboard:
- Go to https://thirdweb.com/dashboard
- Upload
FederatedAggregationRegistry.sol - Deploy to Sepolia testnet
- Copy contract address to
.env
-
Using Remix IDE:
- Open https://remix.ethereum.org
- Upload contract file
- Compile and deploy to Sepolia
- Update environment variables
- Tensor memory management and cleanup
- Batch processing for large datasets
- Model compression and quantization
- Efficient weight serialization
- Gas optimization with batched operations
- Transaction queuing and retry logic
- Event filtering and caching
- Connection pooling
- Code splitting and lazy loading
- Component memoization
- Virtual scrolling for large lists
- Optimistic UI updates
-
MetaMask Connection:
- Ensure MetaMask is installed and unlocked
- Switch to Sepolia testnet
- Add test ETH from faucet
-
Contract Deployment:
- Verify contract address in
.env - Check network configuration
- Ensure sufficient gas for deployment
- Verify contract address in
-
ML Training Errors:
- Check browser memory usage
- Reduce batch size or model complexity
- Verify data format and dimensions
-
IPFS Storage:
- Configure IPFS gateway URL
- Check network connectivity
- Verify API credentials
# Enable debug logging
VITE_DEBUG=true npm run dev
# Check browser console for detailed logs- 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
This project is licensed under the MIT License - see the LICENSE file for details.
- TensorFlow.js for ML capabilities
- Ethereum for blockchain infrastructure
- Firebase for data storage and caching
- React and Vite for frontend framework
- Tailwind CSS for styling
- Framer Motion for animations
- Add more ML algorithms (Random Forest, SVM)
- Implement secure aggregation protocols
- Add model versioning and lineage tracking
- Create mobile-responsive design
- Multi-chain support (Polygon, Arbitrum)
- Advanced privacy mechanisms (homomorphic encryption)
- Automated model deployment pipelines
- Integration with popular ML frameworks
- Comprehensive test suite
- Performance monitoring and alerting
- Automated deployment pipelines
- Documentation and tutorials
Built with β€οΈ for the federated learning community