Skip to main content

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:โ€‹

  1. Pool: Manual wallet address entry
  2. DEX: Wallet signature authentication (INSTITUTIONAL GRADE โœ…)
  3. Treasury: Email/password + 2FA
  4. 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:โ€‹

  1. Database Migration: Zero user data loss
  2. Authentication: Preserve all existing auth mechanisms (they're already institutional grade)
  3. Live Services: Maintain 100% uptime for Treasury platform (has live users)
  4. Testing: Comprehensive testing before switching production traffic

Migration Order:โ€‹

  1. DEX First: Less critical, can have brief downtime
  2. Treasury Second: More critical, has live users requiring careful migration
  3. 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โ€‹

  1. Export DEX database from current Neon instance
  2. Create DEX schema in unified DigitalOcean database
  3. Test DEX migration in regtest schema first
  4. Create DigitalOcean app for DEX platform
  5. 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)