Node Operations
Operational guide for running and maintaining a BLVM node.
Starting the Node
Basic Startup
# Regtest mode (default, safe for development)
blvm
# Testnet mode
blvm --network testnet
# Mainnet mode (use with caution)
blvm --network mainnet
With Configuration
blvm --config blvm.toml
Node Lifecycle
The node follows a lifecycle with multiple states and transitions.
Lifecycle States
The node operates in the following states:
Initial → Headers → Blocks → Synced
↓ ↓ ↓ ↓
Error Error Error Error
State Descriptions:
- Initial: Node starting up, initializing components
- Headers: Downloading and validating block headers
- Blocks: Downloading and validating full blocks
- Synced: Fully synchronized, normal operation
- Error: Error state (can transition from any state)
Code: sync.rs
State Transitions
State transitions are managed by the SyncStateMachine:
- Initial → Headers: When sync begins
- Headers → Blocks: When headers are complete (30% progress)
- Blocks → Synced: When blocks are complete (60% progress)
- Any → Error: On error conditions
Code: sync.rs
Initial Sync
When starting for the first time, the node will:
- Initialize Components: Storage, network, RPC, modules
- Connect to P2P Network: Discover peers via DNS seeds or persistent peers
- Download Headers: Request and validate block headers
- Download Blocks: Request and validate blocks
- Build UTXO Set: Construct UTXO set from validated blocks
- Sync to Current Height: Continue until caught up with network
Code: sync.rs
Running State
Once synced, the node maintains:
- Peer Connections: Active P2P connections
- Block Validation: Validates and relays new blocks (via blvm-consensus)
- Transaction Processing: Validates and relays transactions
- Chain State Updates: Updates chain tip and height
- RPC Requests: Serves JSON-RPC API requests
- Health Monitoring: Periodic health checks
Code: mod.rs
Health States
The node tracks health status for each component:
- Healthy: Component operating normally
- Degraded: Component functional but with issues
- Unhealthy: Component not functioning correctly
- Down: Component not responding
Code: health.rs
Error Recovery
The node implements graceful error recovery:
- Network Errors: Automatic reconnection with exponential backoff
- Storage Errors: Timeout protection, graceful degradation
- Validation Errors: Logged and reported, node continues operation
- Disk Space: Periodic checks with warnings
Code: mod.rs
Monitoring
Health Checks
# Check if node is running
curl http://localhost:8332/health
# Get blockchain info via RPC
curl -X POST http://localhost:8332 \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "getblockchaininfo", "params": [], "id": 1}'
Logging
The node uses structured logging. Set log level via environment variable:
# Set log level
RUST_LOG=info blvm
# Debug mode
RUST_LOG=debug blvm
# Trace all operations
RUST_LOG=trace blvm
Maintenance
Database Maintenance
The node automatically maintains block storage, UTXO set, chain indexes, and transaction indexes.
Backup
Regular backups recommended:
# Backup data directory
tar -czf blvm-backup-$(date +%Y%m%d).tar.gz /var/lib/blvm
Updates
When updating the node:
- Stop the node gracefully
- Backup data directory
- Download new binary from GitHub Releases
- Replace old binary with new one
- Restart node
Troubleshooting
See Troubleshooting for detailed solutions to common issues.
See Also
- Node Configuration - Configuration options
- Node Overview - Node architecture and features
- RPC API Reference - Complete RPC API documentation
- Troubleshooting - Common issues and solutions
- Performance Optimizations - Performance tuning