Files
ringnet/demo.js
2025-06-14 00:46:35 +02:00

73 líneas
2.5 KiB
JavaScript

#!/usr/bin/env node
import chalk from 'chalk';
console.log(chalk.blue.bold('🔗 Ring Network Demo Setup\n'));
console.log(`
${chalk.green('Welcome to the Ring Network!')}
Your two-ring network with WebRTC and Oracle nodes is now ready to use.
${chalk.yellow('🚀 Quick Start Guide:')}
1. ${chalk.cyan('Start the first node (Oracle) as bootstrap:')}
npm run start:oracle -- --port 8080
2. ${chalk.cyan('In a new terminal, start a regular node:')}
npm run start:node -- --port 8081 --bootstrap localhost:8080
3. ${chalk.cyan('In another terminal, start another Oracle:')}
npm run start:oracle -- --port 8082 --bootstrap localhost:8080
4. ${chalk.cyan('Add more nodes as needed:')}
npm run start:node -- --port 8083 --bootstrap localhost:8080
${chalk.magenta('💡 Interactive Commands (once nodes are running):')}
${chalk.yellow('Regular Node Commands:')}
• send <message> - Send message through the ring
• info - Show network information
• peers - List connected peers
• help - Show all commands
• quit - Exit the node
${chalk.yellow('Oracle Node Commands (additional):')}
• health - Perform network health check
• metrics - Show network metrics
• analyze - Analyze network topology
• store <key> <val> - Store data in distributed storage
• get <key> - Retrieve stored data
• propose <text> - Create consensus proposal
• vote <id> <y/n> - Vote on a proposal
${chalk.blue('🔮 Oracle Services Available:')}
• Network Analysis - Topology and health monitoring
• Data Storage - Distributed key-value store
• Consensus - Distributed decision making
• Routing - Advanced routing strategies
• Health Monitoring - Continuous network monitoring
• Metrics Collection - Performance and usage statistics
${chalk.red('📖 Additional Resources:')}
• Run example: npm run example
• Run tests: npm test
• View help: npm start
• Read README.md for detailed documentation
${chalk.green('🎯 Network Features:')}
✅ Double ring topology (inner + outer rings)
✅ WebRTC peer-to-peer connections
✅ Automatic peer discovery
✅ Message routing through rings
✅ Oracle nodes with enhanced capabilities
✅ Distributed data storage
✅ Consensus mechanisms
✅ Network health monitoring
✅ Fault tolerance and resilience
${chalk.cyan('Happy networking! 🌐')}
`);
process.exit(0);