File size: 5,442 Bytes
62c3f77
 
 
 
 
 
 
 
 
 
 
 
 
 
d3d31c7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5e54ae5
d3d31c7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
---
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)