Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# OpenAI API Configuration
OPENAI_API_KEY=your_openai_api_key_here

# Email Configuration
EMAIL_SERVICE=gmail
[email protected]
EMAIL_PASS=your_app_password_here

# Server Configuration
PORT=3001
NODE_ENV=development

# Web3 Configuration (Optional - for advanced features)
ETHEREUM_RPC_URL=https://mainnet.infura.io/v3/your_project_id
POLYGON_RPC_URL=https://polygon-mainnet.infura.io/v3/your_project_id

# Security
JWT_SECRET=your_jwt_secret_here
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX_REQUESTS=100
48 changes: 48 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Dependencies
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Environment variables
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Coverage directory used by tools like istanbul
coverage/

# Build outputs
dist/
build/

# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# IDE files
.vscode/
.idea/
*.swp
*.swo

# Temporary files
tmp/
temp/
214 changes: 213 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,214 @@
# AI-Time-Machines
adding AI Agents to everything with Time Machines
## lippytm ChatGPT AI with Web3 Wallet & Payment Integration

A Web3-enabled ChatGPT AI assistant with integrated wallet connectivity and payment system. This application allows users to interact with an AI assistant while performing decentralized transactions seamlessly.

### πŸš€ Features

- **AI Chat Interface**: Interactive ChatGPT-powered AI assistant
- **Web3 Wallet Integration**: MetaMask and other Web3 wallet support
- **Decentralized Payments**: ETH transaction capabilities
- **Email Notifications**: Automated notifications to [email protected]
- **Security-First Design**: Rate limiting, input validation, and secure practices
- **Responsive UI**: Modern, mobile-friendly interface

### πŸ› οΈ Technology Stack

- **Frontend**: HTML5, CSS3, JavaScript (ES6+)
- **Backend**: Node.js, Express.js
- **Web3**: ethers.js for blockchain interactions
- **Email**: Nodemailer for email notifications
- **Security**: Helmet, CORS, rate limiting

### πŸ“‹ Prerequisites

- Node.js 16.0.0 or higher
- npm or yarn package manager
- Web3 wallet (MetaMask recommended)
- Gmail account with app password (for notifications)

### πŸ”§ Installation & Setup

1. **Clone the repository**
```bash
git clone https://github.com/lippytm/AI-Time-Machines.git
cd AI-Time-Machines
```

2. **Install dependencies**
```bash
npm install
```

3. **Environment Configuration**
```bash
cp .env.example .env
```

Edit `.env` file with your configuration:
```env
# OpenAI API Configuration (optional - demo mode available)
OPENAI_API_KEY=your_openai_api_key_here

# Email Configuration
EMAIL_SERVICE=gmail
[email protected]
EMAIL_PASS=your_gmail_app_password_here

# Server Configuration
PORT=3000
NODE_ENV=development

# Security
JWT_SECRET=your_jwt_secret_here
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX_REQUESTS=100
```

4. **Gmail App Password Setup**
- Enable 2-factor authentication on your Gmail account
- Generate an app password: Google Account > Security > App passwords
- Use the generated password in `EMAIL_PASS`

5. **Start the application**
```bash
npm start
```

6. **Access the application**
Open http://localhost:3000 in your browser

### πŸ” Web3 Wallet Setup

1. **Install MetaMask**: Download from [metamask.io](https://metamask.io/)
2. **Create/Import Wallet**: Set up your Ethereum wallet
3. **Connect to App**: Click "Connect Wallet" in the application
4. **Test Payment**: Use small amounts on testnets first

### πŸ’° Payment System

The payment system supports:
- **ETH Transactions**: Direct Ethereum payments
- **Transaction Notifications**: Email alerts for all payments
- **Security Validation**: Address and transaction hash verification
- **Error Handling**: Comprehensive error messages

### πŸ“§ Email Notification System

Automated notifications are sent to `[email protected]` for:
- New wallet connections
- Payment transactions
- System alerts
- Test notifications

### πŸ”’ Security Features

- **Rate Limiting**: Prevents API abuse
- **Input Validation**: Sanitizes all user inputs
- **CORS Protection**: Configured for production security
- **Helmet.js**: Security headers and CSP
- **Address Validation**: Ethereum address format verification
- **Transaction Verification**: Hash format validation

### πŸ§ͺ Testing

1. **Connect Wallet**: Use MetaMask on a testnet
2. **Test Chat**: Send messages to the AI assistant
3. **Test Payments**: Send small testnet transactions
4. **Test Notifications**: Use the "Test Notification" button

### πŸ“± API Endpoints

#### Chat API
- `POST /api/chat` - Send message to AI assistant
- `GET /api/chat/history` - Get chat history (future feature)

#### Wallet API
- `POST /api/wallet/connect` - Notify wallet connection
- `GET /api/wallet/info/:address` - Get wallet information
- `POST /api/wallet/disconnect` - Notify wallet disconnection

#### Payment API
- `POST /api/payment/notify` - Payment notification
- `GET /api/payment/history/:address` - Payment history (future feature)
- `POST /api/payment/test-notification` - Send test notification

### πŸš€ Deployment

1. **Production Environment**
```bash
NODE_ENV=production npm start
```

2. **Environment Variables**
- Set all required environment variables
- Use production-grade email service
- Configure proper CORS origins

3. **Security Checklist**
- [ ] SSL/TLS certificate installed
- [ ] Environment variables secured
- [ ] Rate limiting configured
- [ ] Email service configured
- [ ] Wallet addresses validated

### πŸ”§ Development

```bash
# Install development dependencies
npm install

# Start development server
npm run dev

# Check application health
curl http://localhost:3000/health
```

### πŸ“ Future Enhancements

- [ ] OpenAI GPT-4 integration
- [ ] Multi-chain support (Polygon, BSC)
- [ ] Payment history dashboard
- [ ] User authentication system
- [ ] Smart contract integration
- [ ] Advanced AI features

### πŸ› Troubleshooting

**Wallet Connection Issues:**
- Ensure MetaMask is installed and unlocked
- Check network connectivity
- Try refreshing the page

**Email Notifications Not Working:**
- Verify Gmail app password
- Check environment variables
- Ensure 2FA is enabled on Gmail account

**Payment Failures:**
- Check wallet balance
- Verify network fees
- Ensure correct network selection

### πŸ“„ License

This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.

### 🀝 Contributing

1. Fork the repository
2. Create a feature branch
3. Commit your changes
4. Push to the branch
5. Create a Pull Request

### πŸ“ž Support

For support and questions:
- Email: [email protected]
- GitHub Issues: [Create an issue](https://github.com/lippytm/AI-Time-Machines/issues)

---

**Β© 2024 lippytm AI Time Machines | Web3 & AI Integration**
Loading