ToxChain is a Web3 + AI platform that enables pharmaceutical companies to contribute toxicity data anonymously, trains ML models on aggregated data, and rewards contributors via smart contracts. This decentralized approach solves the data sharing problem in drug development while maintaining privacy and incentivizing participation.
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Frontend β β Smart β β ML API β
β (Next.js) βββββΊβ Contracts βββββΊβ (FastAPI) β
β β β (Solidity) β β β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β β β
β β β
βΌ βΌ βΌ
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β RainbowKit β β Ethereum/ β β PostgreSQL β
β + wagmi β β Arbitrum β β + IPFS β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
- Node.js 18+ and pnpm
- Python 3.10+
- Git
- Clone the repository:
git clone https://github.com/toxchain/toxchain.git
cd toxchain- Install dependencies:
pnpm install- Set up environment variables:
# Copy example files
cp frontend/env.example frontend/.env.local
cp contracts/env.example contracts/.env
cp ml-api/env.example ml-api/.env- Deploy the stack:
# Development deployment
./scripts/deploy.sh localhost development
# Production deployment to testnet
./scripts/deploy.sh sepolia production- Frontend: http://localhost:3000
- ML API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
- Contract Explorer: Arbiscan
toxchain/
βββ frontend/ # Next.js 14 application
β βββ src/
β β βββ app/ # App Router pages
β β βββ components/ # Reusable UI components
β β βββ hooks/ # Custom React hooks
β β βββ store/ # Zustand state management
β β βββ lib/ # Utility functions
β βββ package.json
βββ contracts/ # Smart contracts
β βββ contracts/ # Solidity contracts
β βββ test/ # Contract tests
β βββ scripts/ # Deployment scripts
β βββ hardhat.config.ts
βββ ml-api/ # Python ML API
β βββ app/ # FastAPI application
β βββ models/ # ML model files
β βββ data/ # Training data
β βββ requirements.txt
βββ scripts/ # Deployment utilities
βββ docs/ # Documentation
βββ package.json # Root package.json
cd frontend
pnpm devcd contracts
pnpm compile
pnpm test
pnpm deploy:localhostcd ml-api
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
uvicorn main:app --reload# Frontend tests
cd frontend && pnpm test
# Smart contract tests
cd contracts && pnpm test
# ML API tests
cd ml-api && pytest# Start all services
./scripts/deploy.sh localhost development
# Run E2E tests
cd frontend && pnpm test:e2e./scripts/deploy.sh localhost development# Deploy to Arbitrum Sepolia
./scripts/deploy.sh arbitrum-sepolia production
# Deploy to Ethereum Sepolia
./scripts/deploy.sh sepolia production- Smart Contracts: Deploy to Arbitrum One
- ML API: Deploy to Railway/Render
- Frontend: Deploy to Vercel
- β Data Contribution: Submit toxicity data with SMILES validation
- β AI Prediction: Real-time toxicity prediction with confidence scores
- β Reward System: Token rewards based on data quality and model improvement
- β Leaderboard: Gamified contributor rankings
- β Privacy: Anonymous data submission with IPFS storage
- π Model Retraining: Automatic model updates with new data
- π Analytics Dashboard: Model performance and contribution metrics
- π Reputation System: Contributor validation accuracy tracking
- π Access Control: Pay-per-use data access for pharmaceutical companies
- Framework: Next.js 14 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS + shadcn/ui
- Web3: wagmi + RainbowKit + viem
- State: Zustand + TanStack Query
- Charts: Recharts
- Language: Solidity 0.8.24
- Framework: Hardhat
- Libraries: OpenZeppelin
- Networks: Ethereum, Arbitrum
- Framework: FastAPI
- Language: Python 3.11
- ML: PyTorch + Transformers
- Database: PostgreSQL + Redis
- Chemistry: RDKit
- Prediction Latency: < 200ms average
- Model Accuracy: 88% on DILIrank dataset
- Gas Costs: ~$0.50 per contribution
- Uptime: 99.9% target
- Smart Contracts: Audited by OpenZeppelin
- Data Privacy: IPFS + encryption
- Access Control: Role-based permissions
- Input Validation: Comprehensive sanitization
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
MIT License - see LICENSE file for details.
- Documentation: docs/
- Issues: GitHub Issues
- Discord: Join our community
Built with β€οΈ by the ToxChain team