|
--- |
|
language: |
|
- en |
|
tags: |
|
- web3 |
|
- blockchain |
|
- dapp |
|
- smart-contracts |
|
- ethereum |
|
- solidity |
|
- defi |
|
- nft |
|
- ai-assistant |
|
--- |
|
# CHAINR AI |
|
|
|
An intelligent AI assistant that specializes in building decentralized applications (DApps) for Web3. This platform combines conversational AI with automated smart contract deployment, frontend generation, and blockchain integration. |
|
|
|
## Features |
|
|
|
- ๐ค AI-powered DApp architecture and code generation |
|
- โ๏ธ Multi-blockchain support (Ethereum, Polygon, BSC, Arbitrum) |
|
- ๐ Smart contract creation and deployment |
|
- ๐จ Automated frontend generation with Web3 integration |
|
- ๐ฌ Real-time chat interface for development guidance |
|
- ๐ Wallet connection and authentication |
|
- ๐๏ธ IPFS integration for decentralized storage |
|
- ๐ Gas optimization and cost estimation |
|
- ๐ Contract verification and security auditing |
|
- โก One-click deployment pipeline |
|
- ๐งช Automated testing suite generation |
|
- ๐ฑ Mobile-responsive DApp interfaces |
|
|
|
## Tech Stack |
|
|
|
### Backend |
|
- Node.js with Express |
|
- MongoDB with Mongoose |
|
- Socket.IO for real-time communication |
|
- OpenAI API integration |
|
- Web3.js/Ethers.js for blockchain interaction |
|
- Hardhat for smart contract development |
|
- IPFS client for decentralized storage |
|
- Docker containerization |
|
|
|
### Frontend |
|
- React 18 with hooks |
|
- Next.js for SSR and optimization |
|
- Web3Modal for wallet connections |
|
- Wagmi for React Web3 hooks |
|
- React Query for state management |
|
- Tailwind CSS for styling |
|
- Chart.js for analytics dashboards |
|
|
|
### Blockchain |
|
- Solidity for smart contracts |
|
- Hardhat development environment |
|
- OpenZeppelin contract libraries |
|
- Chainlink oracles integration |
|
- The Graph for indexing |
|
- MetaMask and WalletConnect support |
|
|
|
## Quick Start |
|
|
|
### Using Docker (Recommended) |
|
|
|
1. Clone the repository: |
|
```bash |
|
git clone https://huggingface.co/chainr-ai/CHAINR |
|
cd CHAINR |
|
``` |
|
|
|
2. Set up environment variables: |
|
```bash |
|
cp .env.example .env |
|
# Add your API keys and configuration |
|
``` |
|
|
|
3. Start with Docker Compose: |
|
```bash |
|
docker-compose up -d |
|
``` |
|
|
|
4. Access the application: |
|
- Frontend: http://localhost:3000 |
|
- Backend API: http://localhost:5000 |
|
- Documentation: http://localhost:3000/docs |
|
|
|
### Manual Installation |
|
|
|
1. Install dependencies: |
|
```bash |
|
# Backend |
|
cd backend |
|
npm install |
|
|
|
# Frontend |
|
cd ../frontend |
|
npm install |
|
|
|
# Smart contracts |
|
cd ../contracts |
|
npm install |
|
``` |
|
|
|
2. Start MongoDB and Redis: |
|
```bash |
|
docker run -d -p 27017:27017 mongo |
|
docker run -d -p 6379:6379 redis |
|
``` |
|
|
|
3. Run the development servers: |
|
```bash |
|
# Backend (Terminal 1) |
|
cd backend |
|
npm run dev |
|
|
|
# Frontend (Terminal 2) |
|
cd frontend |
|
npm run dev |
|
|
|
# Hardhat node (Terminal 3) |
|
cd contracts |
|
npx hardhat node |
|
``` |
|
|
|
## Environment Variables |
|
|
|
```env |
|
# API Keys |
|
OPENAI_API_KEY=your_openai_api_key |
|
INFURA_PROJECT_ID=your_infura_project_id |
|
ETHERSCAN_API_KEY=your_etherscan_api_key |
|
PINATA_API_KEY=your_pinata_api_key |
|
|
|
# Database |
|
MONGODB_URI=mongodb://localhost:27017/chainr-ai |
|
REDIS_URL=redis://localhost:6379 |
|
|
|
# Blockchain |
|
PRIVATE_KEY=your_deployment_private_key |
|
NETWORK=hardhat |
|
|
|
# Application |
|
JWT_SECRET=your_jwt_secret |
|
FRONTEND_URL=http://localhost:3000 |
|
``` |
|
|
|
## Usage |
|
|
|
### Creating a DApp |
|
|
|
1. **Chat with AI**: Describe your DApp idea in natural language |
|
2. **Review Architecture**: AI generates project structure and tech recommendations |
|
3. **Smart Contracts**: Auto-generated Solidity contracts based on requirements |
|
4. **Frontend Creation**: React components with Web3 integration |
|
5. **Testing**: Automated test suite generation |
|
6. **Deployment**: One-click deployment to chosen blockchain |
|
|
|
### Example Conversation |
|
|
|
``` |
|
User: "Create a NFT marketplace with royalties and auction features" |
|
|
|
CHAINR AI: "I'll help you build an NFT marketplace DApp. Let me break this down: |
|
|
|
๐ Smart Contracts Needed: |
|
- ERC721 NFT contract with royalty support (EIP-2981) |
|
- Marketplace contract with auction functionality |
|
- Payment splitter for royalty distribution |
|
|
|
๐จ Frontend Components: |
|
- NFT gallery and detail pages |
|
- Auction bidding interface |
|
- Artist dashboard |
|
- Wallet integration |
|
|
|
Would you like me to start with the smart contracts?" |
|
``` |
|
|
|
## API Endpoints |
|
|
|
### DApp Generation |
|
``` |
|
POST /api/dapp/generate |
|
POST /api/dapp/deploy |
|
GET /api/dapp/:id/status |
|
``` |
|
|
|
### Smart Contracts |
|
``` |
|
POST /api/contracts/compile |
|
POST /api/contracts/deploy |
|
GET /api/contracts/:address/verify |
|
``` |
|
|
|
### IPFS Integration |
|
``` |
|
POST /api/ipfs/upload |
|
GET /api/ipfs/:hash |
|
``` |
|
|
|
## Supported DApp Types |
|
|
|
- ๐จ **NFT Marketplaces**: Trading, minting, royalties |
|
- ๐ฆ **DeFi Protocols**: DEX, lending, staking |
|
- ๐ฎ **GameFi**: Play-to-earn, NFT games |
|
- ๐ณ๏ธ **DAOs**: Governance, voting, treasury |
|
- ๐ช **E-commerce**: Decentralized marketplaces |
|
- ๐ **Education**: Certificate verification, courses |
|
- ๐ฅ **Healthcare**: Medical records, insurance |
|
- ๐ฑ **Carbon Credits**: Environmental tracking |
|
|
|
## Contributing |
|
|
|
1. Fork the repository |
|
2. Create a feature branch: `git checkout -b feature/amazing-feature` |
|
3. Commit changes: `git commit -m 'Add amazing feature'` |
|
4. Push to branch: `git push origin feature/amazing-feature` |
|
5. Open a Pull Request |
|
|
|
## Security |
|
|
|
- Smart contracts audited by OpenZeppelin |
|
- Rate limiting and DDoS protection |
|
- Input sanitization and validation |
|
- Secure wallet connection handling |
|
- Private key encryption at rest |
|
|
|
## Support |
|
|
|
- ๐ง Email: [email protected] |
|
- ๐ Website: chainrai.xyz |
|
- ๐ Issues: [GitHub Issues](https://huggingface.co/chainr-ai/CHAINR/discussions) |