Skip to content
Merged
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
218 changes: 119 additions & 99 deletions .env.production.example
Original file line number Diff line number Diff line change
@@ -1,104 +1,124 @@
# Production environment variables
# Copy this file to .env.production and fill in the actual values

# Node environment
NODE_ENV=production
PORT=3000

# Convex
VITE_CONVEX_URL=https://your-project.convex.cloud

# Database
DATABASE_URL=postgresql://username:password@host:5432/memecoingen_prod

# Redis
REDIS_URL=redis://:password@redis-host:6379

# Blockchain RPCs
ETHEREUM_RPC_URL=https://eth-mainnet.g.alchemy.com/v2/YOUR_ALCHEMY_KEY
BSC_RPC_URL=https://bsc-dataseed.binance.org/
SOLANA_RPC_URL=https://api.mainnet-beta.solana.com

# Deployer Wallets (KEEP THESE SECURE!)
DEPLOYER_PRIVATE_KEY=0x0000000000000000000000000000000000000000000000000000000000000000
SOLANA_DEPLOYER_KEYPAIR=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]

# API Keys
COINGECKO_API_KEY=CG-xxxxxxxxxxxxxxxxxxxx
ETHERSCAN_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
BSCSCAN_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

# Social Media
TWITTER_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
TWITTER_API_SECRET=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
TWITTER_ACCESS_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
TWITTER_ACCESS_SECRET=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/XXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
TELEGRAM_BOT_TOKEN=XXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
TELEGRAM_CHANNEL_ID=@your_channel

# Stripe
STRIPE_SECRET_KEY=sk_live_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
STRIPE_WEBHOOK_SECRET=whsec_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
STRIPE_PRO_PRICE_ID=price_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
STRIPE_ENTERPRISE_PRICE_ID=price_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

# IPFS (Infura)
IPFS_PROJECT_ID=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
IPFS_PROJECT_SECRET=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

# Monitoring
SENTRY_DSN=https://XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX@sentry.io/XXXXXXX
PROMETHEUS_REMOTE_WRITE_URL=https://prometheus-prod.memecoingen.com/api/v1/write
PROMETHEUS_REMOTE_WRITE_USERNAME=prometheus
PROMETHEUS_REMOTE_WRITE_PASSWORD=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

# Security
JWT_SECRET=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ENCRYPTION_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
SESSION_SECRET=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

# CORS
ALLOWED_ORIGINS=https://memecoingen.com,https://www.memecoingen.com,https://api.memecoingen.com

# Rate Limiting
RATE_LIMIT_WINDOW_MS=60000
RATE_LIMIT_MAX_REQUESTS=100
DEPLOYMENT_RATE_LIMIT_MAX=3
# Production Environment Variables
# NEVER commit actual values to git

# ============================================
# KMS Configuration (Choose one)
# ============================================

# AWS (for backups and storage)
AWS_ACCESS_KEY_ID=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
AWS_SECRET_ACCESS_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# AWS KMS
KMS_PROVIDER=aws
AWS_REGION=us-east-1
S3_BUCKET_NAME=memecoingen-assets
AWS_KMS_KEY_ID=arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012

# Azure Key Vault
# KMS_PROVIDER=azure
# AZURE_KEY_VAULT_URL=https://your-vault.vault.azure.net/
# AZURE_CLIENT_ID=your-client-id
# AZURE_CLIENT_SECRET=your-client-secret
# AZURE_TENANT_ID=your-tenant-id

# HashiCorp Vault
# KMS_PROVIDER=hashicorp
# VAULT_ADDR=https://vault.example.com
# VAULT_TOKEN=your-vault-token
# VAULT_NAMESPACE=your-namespace

# ============================================
# Encrypted Keys (stored in KMS)
# ============================================

# These should be encrypted references, not actual keys
ETHEREUM_DEPLOYER_KEY_ENCRYPTED=encrypted:base64encodedciphertext...
BSC_DEPLOYER_KEY_ENCRYPTED=encrypted:base64encodedciphertext...
SOLANA_DEPLOYER_KEY_ENCRYPTED=encrypted:base64encodedciphertext...

# ============================================
# API Keys (encrypted)
# ============================================

ETHEREUM_RPC_API_KEY_ENCRYPTED=encrypted:base64encodedciphertext...
BSC_RPC_API_KEY_ENCRYPTED=encrypted:base64encodedciphertext...
SOLANA_RPC_API_KEY_ENCRYPTED=encrypted:base64encodedciphertext...
COINGECKO_API_KEY_ENCRYPTED=encrypted:base64encodedciphertext...

# ============================================
# Security Configuration
# ============================================

# Key rotation intervals (milliseconds)
KEY_ROTATION_INTERVAL_DEPLOYER=2592000000 # 30 days
KEY_ROTATION_INTERVAL_API=7776000000 # 90 days
KEY_ROTATION_INTERVAL_SIGNING=604800000 # 7 days

# Rate limiting
RATE_LIMIT_WINDOW_MS=60000 # 1 minute
RATE_LIMIT_MAX_REQUESTS=100

# Security headers
SECURITY_HEADERS_CSP="default-src 'self'; script-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net; style-src 'self' 'unsafe-inline';"
SECURITY_HEADERS_HSTS="max-age=31536000; includeSubDomains"

# ============================================
# Monitoring & Alerting
# ============================================

# Sentry
SENTRY_DSN=https://your-key@sentry.io/your-project
SENTRY_ENVIRONMENT=production
SENTRY_TRACES_SAMPLE_RATE=0.1

# DataDog
DATADOG_API_KEY_ENCRYPTED=encrypted:base64encodedciphertext...
DATADOG_APP_KEY_ENCRYPTED=encrypted:base64encodedciphertext...

# PagerDuty (for critical alerts)
PAGERDUTY_INTEGRATION_KEY_ENCRYPTED=encrypted:base64encodedciphertext...

# ============================================
# Infrastructure
# ============================================

# Logging
LOG_LEVEL=info
LOG_FORMAT=json
# CDN
CDN_URL=https://cdn.tokenforge.com
CDN_PURGE_KEY_ENCRYPTED=encrypted:base64encodedciphertext...

# Database (if using external)
DATABASE_URL_ENCRYPTED=encrypted:base64encodedciphertext...
DATABASE_REPLICA_URLS=replica1.example.com,replica2.example.com

# Redis (for distributed caching)
REDIS_URL_ENCRYPTED=encrypted:base64encodedciphertext...
REDIS_CLUSTER_NODES=redis1:6379,redis2:6379,redis3:6379

# ============================================
# Compliance & Audit
# ============================================

# Audit log retention (days)
AUDIT_LOG_RETENTION_DAYS=2555 # 7 years

# Data encryption at rest
ENCRYPTION_AT_REST_KEY_ID=your-kms-key-for-data-encryption

# Backup configuration
BACKUP_S3_BUCKET=tokenforge-backups-prod
BACKUP_ENCRYPTION_KEY_ID=your-kms-key-for-backups
BACKUP_RETENTION_DAYS=90

# ============================================
# Feature Flags
ENABLE_TESTNET=false
ENABLE_MAINNET=true
ENABLE_SOCIAL_SHARES=true
ENABLE_ANALYTICS=true
ENABLE_PREMIUM_FEATURES=true

# Email (SendGrid)
SENDGRID_API_KEY=SG.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
FROM_EMAIL=noreply@memecoingen.com
SUPPORT_EMAIL=support@memecoingen.com

# Admin
ADMIN_EMAIL=admin@memecoingen.com
ADMIN_WEBHOOK_URL=https://admin.memecoingen.com/webhooks

# Backup
BACKUP_RETENTION_DAYS=30
BACKUP_S3_BUCKET=memecoingen-backups

# Performance
MAX_CONCURRENT_DEPLOYMENTS=10
DEPLOYMENT_QUEUE_TIMEOUT=300000
CACHE_TTL=300
DATABASE_POOL_SIZE=20
REDIS_MAX_CONNECTIONS=50
# ============================================

ENABLE_BONDING_CURVE=true
ENABLE_SOCIAL_SHARING=true
ENABLE_TESTNET_DEPLOYMENT=false
ENABLE_MAINNET_DEPLOYMENT=true
MAINTENANCE_MODE=false

# ============================================
# Emergency Contacts
# ============================================

EMERGENCY_CONTACT_EMAIL=security@tokenforge.com
EMERGENCY_CONTACT_PHONE=+1-xxx-xxx-xxxx
ON_CALL_WEBHOOK_ENCRYPTED=encrypted:base64encodedciphertext...
112 changes: 112 additions & 0 deletions CODEBASE_AUDIT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Codebase Audit Results

## 🚨 Critical Issues

### 1. **NO REAL BLOCKCHAIN DEPLOYMENT**
- `convex/blockchain.ts` is entirely simulated with mock addresses and delays
- `ERC20_BYTECODE = "0x"` - No compiled contract bytecode
- All deployments return fake contract addresses and transaction hashes
- 95% "success rate" is just `Math.random()`

### 2. **Missing Contract Compilation**
- `/contracts/MemeCoin.sol` exists but is never compiled
- No Hardhat setup to compile contracts
- No deployment scripts to actually deploy to blockchain

### 3. **Social Media Posts are Mocked**
- Twitter returns mock tweet IDs
- Telegram returns mock success responses
- Discord might work (uses webhooks) but untested

### 4. **Analytics are Completely Fake**
- Random price changes every 1-5 minutes
- Fake holder counts and transaction volumes
- No connection to real blockchain data

## 🟑 Functionality Status

### Working βœ…
- User authentication (Convex Auth)
- Database operations (Convex)
- UI components and navigation
- Rate limiting (3 coins per day)
- Basic CRUD operations

### Partially Working 🟑
- CoinGecko integration (API connected but not used)
- Alchemy RPC endpoints (configured but not used for deployment)
- Social share formatting (creates messages but doesn't post)

### Not Working ❌
- Actual token deployment
- Real blockchain transactions
- Bonding curve implementation
- DEX pool creation
- Contract verification
- Real-time price tracking

## πŸ”§ What Needs to be Fixed

### Immediate Fixes
1. **Compile Smart Contracts**
```bash
npx hardhat compile
```

2. **Switch to Real Deployment**
- Use the `ethereum.ts` and `solana.ts` implementations
- Remove the mock `blockchain.ts`
- Update `memeCoins.ts` to call real deployment functions

3. **Add Fallbacks**
- If deployment fails, show proper error messages
- Add retry mechanisms
- Store failed deployments for manual intervention

### Code to Update

1. **convex/memeCoins.ts** (line 182):
```typescript
// Change from:
await ctx.scheduler.runAfter(0, internal.blockchain.deployContract, {

// To:
await ctx.scheduler.runAfter(0,
args.blockchain === "solana"
? internal.blockchain.solana.deploySPLToken
: internal.blockchain.ethereum.deployERC20Contract, {
```

2. **Add Contract Compilation**:
```bash
npm install --save-dev hardhat @nomicfoundation/hardhat-toolbox
npx hardhat compile
```

3. **Update Environment Check**:
```typescript
// Add to blockchain deployment files
if (process.env.USE_MOCK_DEPLOYMENT === 'true') {
// Use mock deployment
} else {
// Use real deployment
}
```

## πŸ“Š Current State Summary

The app is a **beautiful UI with no real blockchain functionality**. It's essentially a demo that:
- Saves token metadata to database βœ…
- Shows fake deployment animations βœ…
- Generates random price movements βœ…
- But NEVER actually deploys tokens ❌

## πŸš€ Next Steps

1. **Compile the Solidity contract**
2. **Switch to real deployment functions**
3. **Add proper error handling**
4. **Test with small amounts on testnet**
5. **Add monitoring for real transactions**

The infrastructure is there (Alchemy, wallets, etc.) but it's not being used. The app is currently a "fake it till you make it" implementation.
Loading
Loading