BLGV Ecosystem Migration Roadmap
Complete Migration to Unified DigitalOcean Database
๐ STATUS: Phase 1 Complete - Pool Platform Migrated Successfullyโ
โ COMPLETED PHASE 1: Pool Platform Migrationโ
- Database: Migrated from Neon to DigitalOcean unified database
- Real Mining: Bitaxe BM1370 v2.7.1 actively mining (25 shares, 0.5 TH/s)
- Production Server: Upgraded to Gunicorn production WSGI server
- Domain: pool.blgvbtc.com operational
- GitHub: Repository renamed to
blgv-ecosystem
๐ PHASE 2: DEX Platform Migrationโ
Current DEX State Analysis:โ
- Database: Neon PostgreSQL (
ep-odd-feather-a59mn0nt.us-east-2.aws.neon.tech) - Schema: 15+ tables (tokens, liquidity_pools, swap_transactions, amm_pools, etc.)
- Status: Functional DEX with AMM, BTCPay integration, test mode support
- Authentication: Advanced wallet signature system (INSTITUTIONAL GRADE โ )
DEX Migration Steps:โ
Step 2.1: Database Schema Analysis & Exportโ
# Export current DEX database
pg_dump "postgresql://neondb_owner:[email protected]/neondb" > dex_database_backup.sql
# Analyze schema structure
psql "postgresql://neondb_owner:[email protected]/neondb" -c "\dt"
Step 2.2: Create DEX Schema in Unified Databaseโ
-- Connect to DigitalOcean unified database
-- Create all DEX tables in 'dex' schema:
SET search_path TO dex, public;
-- Import schema from shared/schema.ts
-- Key tables: tokens, liquidityPools, swapTransactions, ammPools,
-- treasuryStats, marketData, adminUsers, btcPayStores, etc.
Step 2.3: Data Migration to Unified Databaseโ
# Modify dump to target 'dex' schema
sed 's/public\./dex\./g' dex_database_backup.sql > dex_schema_migration.sql
# Import to unified database
psql "postgresql://doadmin:AVNS_XYQr4PImhwsPrz7EM0m@blgv-ecosystem-do-user-9886684-0.e.db.ondigitalocean.com:25060/defaultdb" < dex_schema_migration.sql
Step 2.4: Update DEX Environment Configurationโ
# platforms/dex/.env (new)
DATABASE_URL=postgresql://doadmin:AVNS_XYQr4PImhwsPrz7EM0m@blgv-ecosystem-do-user-9886684-0.e.db.ondigitalocean.com:25060/defaultdb?sslmode=require
PGDATABASE=defaultdb
PGHOST=blgv-ecosystem-do-user-9886684-0.e.db.ondigitalocean.com
PGPORT=25060
PGUSER=doadmin
PGPASSWORD=AVNS_XYQr4PImhwsPrz7EM0m
# Update connection in platforms/dex/server/db.ts to set search_path=dex
Step 2.5: Create DigitalOcean App for DEXโ
- App Name:
blgv-dex - Domain:
dex.blgvbtc.com - Environment: All current DEX environment variables + new database config
- Build: Node.js app with Vite build process
Step 2.6: Test DEX Migrationโ
# Test unified database connection
curl -s "https://dex-staging.blgvbtc.com/api/health"
# Test wallet authentication
curl -s "https://dex-staging.blgvbtc.com/api/tokens"
# Test AMM functionality
curl -s "https://dex-staging.blgvbtc.com/api/pools"
๐ PHASE 3: Treasury Platform Migrationโ
Current Treasury State Analysis:โ
- Database: Neon PostgreSQL (
ep-wandering-firefly-w4k6m77y.c-2.us-east-1.aws.neon.tech) - Schema: User auth, financial intelligence, DEX event tracking, treasury balances
- Status: Live deployment via Replit agent with email/password authentication
- Authentication: Email/password + 2FA system
Treasury Migration Steps:โ
Step 3.1: Database Schema Analysis & Exportโ
# Export current Treasury database
pg_dump "postgresql://neondb_owner:npg_DP3e7MShngsW@ep-wandering-firefly-w4k6m77y.c-2.us-east-1.aws.neon.tech/neondb" > treasury_database_backup.sql
Step 3.2: Create Treasury Schema in Unified Databaseโ
SET search_path TO treasury, public;
-- Key tables: sessions, users, newsArticles, timelineEvents,
-- companyMetrics, creditFacility, dexEvents, treasuryBalances, wsEvents
Step 3.3: Data Migration & User Account Preservationโ
# Critical: Preserve all user accounts and sessions
# Treasury has live users with email/password authentication
sed 's/public\./treasury\./g' treasury_database_backup.sql > treasury_schema_migration.sql
psql "postgresql://doadmin:AVNS_XYQr4PImhwsPrz7EM0m@blgv-ecosystem-do-user-9886684-0.e.db.ondigitalocean.com:25060/defaultdb" < treasury_schema_migration.sql
Step 3.4: Create DigitalOcean App for Treasuryโ
- App Name:
blgv-treasury - Domain:
blgvbtc.com(main domain) - Environment: All current Treasury environment variables + new database config
๐ PHASE 4: Authentication Unificationโ
Current Authentication Systems:โ
- Pool: Manual wallet address entry
- DEX: Wallet signature authentication (INSTITUTIONAL GRADE โ )
- Treasury: Email/password + 2FA
- Mobile: Cross-platform wallet-based sync
Authentication Strategy:โ
KEEP EXISTING SYSTEMS - They're already institutional grade and work well:
- Treasury: Keep email/password for financial intelligence platform
- DEX/Pool: Keep wallet signature authentication
- Unified: Use the existing ProfileSyncManager for cross-platform synchronization
Sync Layer Updates:โ
// Update ProfileSyncManager to use unified database
const UNIFIED_DATABASE_CONFIG = {
pool: 'postgresql://...?search_path=pool',
dex: 'postgresql://...?search_path=dex',
treasury: 'postgresql://...?search_path=treasury',
shared: 'postgresql://...?search_path=shared'
};
๐ PHASE 5: Cross-Platform Integrationโ
Step 5.1: Update Sync Layerโ
- Modify ProfileSyncManager to use unified database
- Update cross-platform event tracking
- Implement real-time sync across all platforms
Step 5.2: Test Cross-Platform Functionalityโ
# Test wallet authentication flows between platforms
# Test data synchronization
# Test real-time updates
Step 5.3: Update Mobile App Configurationโ
// Update API endpoints to point to unified ecosystem
const API_ENDPOINTS = {
pool: 'https://pool.blgvbtc.com/api',
dex: 'https://dex.blgvbtc.com/api',
treasury: 'https://blgvbtc.com/api',
sync: 'https://api.blgvbtc.com/sync'
};
๐ฏ SUCCESS CRITERIAโ
Phase 2 Success (DEX):โ
- โ DEX migrated to unified database
- โ dex.blgvbtc.com operational
- โ All trading functionality preserved
- โ Wallet authentication working
- โ AMM pools and liquidity intact
Phase 3 Success (Treasury):โ
- โ Treasury migrated to unified database
- โ blgvbtc.com operational
- โ All user accounts preserved
- โ Financial intelligence features working
- โ Email/password authentication intact
Phase 4-5 Success (Integration):โ
- โ All platforms using unified database
- โ Cross-platform sync working
- โ Authentication systems preserved
- โ Real-time data synchronization
- โ Mobile app integration complete
โ ๏ธ CRITICAL CONSIDERATIONSโ
Security Requirements:โ
- Database Migration: Zero user data loss
- Authentication: Preserve all existing auth mechanisms (they're already institutional grade)
- Live Services: Maintain 100% uptime for Treasury platform (has live users)
- Testing: Comprehensive testing before switching production traffic
Migration Order:โ
- DEX First: Less critical, can have brief downtime
- Treasury Second: More critical, has live users requiring careful migration
- Integration Last: After both platforms are stable on unified database
๐ UNIFIED ECOSYSTEM ARCHITECTURE (FINAL STATE)โ
BLGV Unified Ecosystem
โโโ pool.blgvbtc.com โ
LIVE (Mining Pool - Unified DB)
โโโ dex.blgvbtc.com ๐ TO MIGRATE (DEX Platform)
โโโ blgvbtc.com ๐ TO MIGRATE (Treasury Intelligence)
โโโ api.blgvbtc.com ๐ FUTURE (Unified API Gateway)
Database: DigitalOcean Managed PostgreSQL
โโโ pool schema โ
LIVE (mining data)
โโโ dex schema ๐ TO CREATE (trading data)
โโโ treasury schema ๐ TO CREATE (intelligence data)
โโโ shared schema โ
READY (cross-platform auth)
โโโ regtest schema โ
READY (testing environment)
๐ IMMEDIATE NEXT ACTIONSโ
- Export DEX database from current Neon instance
- Create DEX schema in unified DigitalOcean database
- Test DEX migration in regtest schema first
- Create DigitalOcean app for DEX platform
- Switch DEX traffic to unified database
Status: Ready to execute Phase 2 (DEX Migration) Timeline: 2-3 days per phase with proper testing Risk: Low (proven migration strategy from successful Pool migration)