|
| 1 | +# BitCell Admin Console |
| 2 | + |
| 3 | +A comprehensive web-based administrative interface for managing and monitoring BitCell blockchain nodes. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +### 🎛️ Node Management |
| 8 | +- **Register and manage multiple nodes** (validators, miners, full nodes) |
| 9 | +- **Start/stop nodes** remotely via web interface |
| 10 | +- **Real-time status monitoring** with automatic updates |
| 11 | +- **Node health checks** and diagnostics |
| 12 | + |
| 13 | +### 📊 Metrics & Monitoring |
| 14 | +- **Chain Metrics**: Block height, transactions, pending pool, block times |
| 15 | +- **Network Metrics**: Peer connections, bandwidth usage, message throughput |
| 16 | +- **EBSL Metrics**: Active miners, banned miners, trust scores, slashing events |
| 17 | +- **System Metrics**: CPU usage, memory usage, disk usage, uptime |
| 18 | + |
| 19 | +### 🚀 Deployment Management |
| 20 | +- **Automated node deployment** with configurable parameters |
| 21 | +- **Multi-node deployment** for testnets and production |
| 22 | +- **Deployment status tracking** and history |
| 23 | +- **Configuration management** with validation |
| 24 | + |
| 25 | +### 🧪 Testing Utilities |
| 26 | +- **Battle simulation testing** with custom glider patterns |
| 27 | +- **Transaction testing** for stress testing and validation |
| 28 | +- **Network connectivity testing** for peer discovery |
| 29 | +- **Performance benchmarking** tools |
| 30 | + |
| 31 | +### ⚙️ Configuration |
| 32 | +- **Network configuration**: Listen addresses, bootstrap peers, max peers |
| 33 | +- **Consensus configuration**: Battle steps, tournament rounds, block time |
| 34 | +- **EBSL configuration**: Evidence thresholds, slash percentages, decay rates |
| 35 | +- **Economics configuration**: Rewards, halving intervals, gas pricing |
| 36 | + |
| 37 | +## Quick Start |
| 38 | + |
| 39 | +### Running the Admin Console |
| 40 | + |
| 41 | +```bash |
| 42 | +# Start on default port (8080) |
| 43 | +cargo run -p bitcell-admin |
| 44 | + |
| 45 | +# Start on custom port |
| 46 | +cargo run -p bitcell-admin -- 0.0.0.0:9999 |
| 47 | +``` |
| 48 | + |
| 49 | +### Access the Dashboard |
| 50 | + |
| 51 | +Open your browser and navigate to: |
| 52 | +``` |
| 53 | +http://localhost:8080 |
| 54 | +``` |
| 55 | + |
| 56 | +## API Endpoints |
| 57 | + |
| 58 | +### Node Management |
| 59 | +- `GET /api/nodes` - List all nodes |
| 60 | +- `GET /api/nodes/:id` - Get node details |
| 61 | +- `POST /api/nodes/:id/start` - Start a node |
| 62 | +- `POST /api/nodes/:id/stop` - Stop a node |
| 63 | + |
| 64 | +### Metrics |
| 65 | +- `GET /api/metrics` - Get all metrics |
| 66 | +- `GET /api/metrics/chain` - Chain-specific metrics |
| 67 | +- `GET /api/metrics/network` - Network-specific metrics |
| 68 | + |
| 69 | +### Deployment |
| 70 | +- `POST /api/deployment/deploy` - Deploy new nodes |
| 71 | +- `GET /api/deployment/status` - Get deployment status |
| 72 | + |
| 73 | +### Configuration |
| 74 | +- `GET /api/config` - Get current configuration |
| 75 | +- `POST /api/config` - Update configuration |
| 76 | + |
| 77 | +### Testing |
| 78 | +- `POST /api/test/battle` - Run battle simulation |
| 79 | +- `POST /api/test/transaction` - Send test transaction |
| 80 | + |
| 81 | +## API Examples |
| 82 | + |
| 83 | +### Deploy Validator Nodes |
| 84 | + |
| 85 | +```bash |
| 86 | +curl -X POST http://localhost:8080/api/deployment/deploy \ |
| 87 | + -H "Content-Type: application/json" \ |
| 88 | + -d '{ |
| 89 | + "node_type": "validator", |
| 90 | + "count": 3, |
| 91 | + "config": { |
| 92 | + "network": "testnet", |
| 93 | + "log_level": "info", |
| 94 | + "port_start": 9000 |
| 95 | + } |
| 96 | + }' |
| 97 | +``` |
| 98 | + |
| 99 | +### Run Battle Test |
| 100 | + |
| 101 | +```bash |
| 102 | +curl -X POST http://localhost:8080/api/test/battle \ |
| 103 | + -H "Content-Type: application/json" \ |
| 104 | + -d '{ |
| 105 | + "glider_a": "Standard", |
| 106 | + "glider_b": "Heavyweight", |
| 107 | + "steps": 1000 |
| 108 | + }' |
| 109 | +``` |
| 110 | + |
| 111 | +### Update Configuration |
| 112 | + |
| 113 | +```bash |
| 114 | +curl -X POST http://localhost:8080/api/config \ |
| 115 | + -H "Content-Type: application/json" \ |
| 116 | + -d '{ |
| 117 | + "network": { |
| 118 | + "listen_addr": "0.0.0.0:9000", |
| 119 | + "bootstrap_peers": ["127.0.0.1:9001"], |
| 120 | + "max_peers": 50 |
| 121 | + }, |
| 122 | + "consensus": { |
| 123 | + "battle_steps": 1000, |
| 124 | + "tournament_rounds": 5, |
| 125 | + "block_time": 6 |
| 126 | + }, |
| 127 | + "ebsl": { |
| 128 | + "evidence_threshold": 0.7, |
| 129 | + "slash_percentage": 0.1, |
| 130 | + "decay_rate": 0.95 |
| 131 | + }, |
| 132 | + "economics": { |
| 133 | + "initial_reward": 50000000, |
| 134 | + "halving_interval": 210000, |
| 135 | + "base_gas_price": 1000 |
| 136 | + } |
| 137 | + }' |
| 138 | +``` |
| 139 | + |
| 140 | +## Architecture |
| 141 | + |
| 142 | +``` |
| 143 | +bitcell-admin/ |
| 144 | +├── src/ |
| 145 | +│ ├── lib.rs # Main library interface |
| 146 | +│ ├── main.rs # Binary entry point |
| 147 | +│ ├── api/ # REST API endpoints |
| 148 | +│ │ ├── mod.rs # API types and core |
| 149 | +│ │ ├── nodes.rs # Node management |
| 150 | +│ │ ├── metrics.rs # Metrics endpoints |
| 151 | +│ │ ├── deployment.rs # Deployment endpoints |
| 152 | +│ │ ├── config.rs # Configuration endpoints |
| 153 | +│ │ └── test.rs # Testing utilities |
| 154 | +│ ├── web/ # Web interface |
| 155 | +│ │ ├── mod.rs # Template engine setup |
| 156 | +│ │ └── dashboard.rs # Dashboard HTML/JS |
| 157 | +│ ├── deployment.rs # Deployment manager |
| 158 | +│ ├── config.rs # Configuration manager |
| 159 | +│ └── metrics.rs # Metrics collector |
| 160 | +└── static/ # Static assets (CSS, JS, images) |
| 161 | +``` |
| 162 | + |
| 163 | +## Security Considerations |
| 164 | + |
| 165 | +⚠️ **CRITICAL SECURITY WARNING** ⚠️ |
| 166 | + |
| 167 | +**NO AUTHENTICATION IS CURRENTLY IMPLEMENTED** |
| 168 | + |
| 169 | +The admin console currently allows **unrestricted access** to all endpoints. This is a **critical security vulnerability**. |
| 170 | + |
| 171 | +**DO NOT expose this admin console to any network (including localhost) in production without implementing authentication first.** |
| 172 | + |
| 173 | +For production deployments, you MUST: |
| 174 | + |
| 175 | +1. **Implement authentication** before exposing to any network |
| 176 | +2. **Use HTTPS/TLS** for all communication (never HTTP in production) |
| 177 | +3. **Restrict network access** via firewall rules, VPN, or IP allowlisting |
| 178 | +4. **Use strong passwords** and rotate them regularly |
| 179 | +5. **Enable comprehensive audit logging** for all administrative actions |
| 180 | +6. **Implement API rate limiting** to prevent abuse |
| 181 | +7. **Run with least-privilege** user accounts (never as root) |
| 182 | + |
| 183 | +## Development |
| 184 | + |
| 185 | +### Building |
| 186 | + |
| 187 | +```bash |
| 188 | +cargo build -p bitcell-admin |
| 189 | +``` |
| 190 | + |
| 191 | +### Testing |
| 192 | + |
| 193 | +```bash |
| 194 | +cargo test -p bitcell-admin |
| 195 | +``` |
| 196 | + |
| 197 | +### Running in Development |
| 198 | + |
| 199 | +```bash |
| 200 | +# With auto-reload (requires cargo-watch) |
| 201 | +cargo watch -x 'run -p bitcell-admin' |
| 202 | +``` |
| 203 | + |
| 204 | +## Future Enhancements |
| 205 | + |
| 206 | +- [ ] Authentication and authorization (JWT tokens) |
| 207 | +- [ ] WebSocket support for real-time updates |
| 208 | +- [ ] Advanced charting and visualization |
| 209 | +- [ ] Log aggregation and search |
| 210 | +- [ ] Automated health checks and alerting |
| 211 | +- [ ] Backup and restore functionality |
| 212 | +- [ ] Multi-chain support |
| 213 | +- [ ] Mobile-responsive UI improvements |
| 214 | + |
| 215 | +## License |
| 216 | + |
| 217 | +Same as BitCell project |
| 218 | + |
| 219 | +## Contributing |
| 220 | + |
| 221 | +Contributions welcome! Please follow the BitCell contribution guidelines. |
0 commit comments