|
| 1 | +# What to Do After Nodes Have Started |
| 2 | + |
| 3 | +This guide covers the steps to take after your `keep-client` nodes have successfully started. |
| 4 | + |
| 5 | +## Current Status |
| 6 | + |
| 7 | +✅ Nodes are running |
| 8 | +✅ Peer IDs have been extracted and updated in config files |
| 9 | +⏭️ Next: Restart nodes to establish connections |
| 10 | + |
| 11 | +## Step-by-Step Guide |
| 12 | + |
| 13 | +### 1. Verify Current Status |
| 14 | + |
| 15 | +```bash |
| 16 | +# Check which nodes are running |
| 17 | +./configs/check-nodes.sh |
| 18 | + |
| 19 | +# Check individual node diagnostics |
| 20 | +curl -s http://localhost:9601/diagnostics | jq '.client_info' |
| 21 | +curl -s http://localhost:9602/diagnostics | jq '.client_info' |
| 22 | +``` |
| 23 | + |
| 24 | +### 2. Restart Nodes (Required for Peer Connections) |
| 25 | + |
| 26 | +After updating peer IDs, nodes need to be restarted to establish LibP2P connections: |
| 27 | + |
| 28 | +```bash |
| 29 | +# Stop all nodes |
| 30 | +./configs/stop-all-nodes.sh |
| 31 | + |
| 32 | +# Wait a moment for cleanup |
| 33 | +sleep 3 |
| 34 | + |
| 35 | +# Start all nodes again (now with peer IDs configured) |
| 36 | +./configs/start-all-nodes.sh |
| 37 | + |
| 38 | +# Wait for nodes to initialize and connect |
| 39 | +sleep 10 |
| 40 | +``` |
| 41 | + |
| 42 | +### 3. Verify Peer Connectivity |
| 43 | + |
| 44 | +```bash |
| 45 | +# Check node status |
| 46 | +./configs/check-nodes.sh |
| 47 | + |
| 48 | +# Check connected peers for each node |
| 49 | +curl -s http://localhost:9601/diagnostics | jq '.connected_peers | length' |
| 50 | +curl -s http://localhost:9602/diagnostics | jq '.connected_peers | length' |
| 51 | +curl -s http://localhost:9603/diagnostics | jq '.connected_peers | length' |
| 52 | + |
| 53 | +# View connected peers |
| 54 | +curl -s http://localhost:9601/diagnostics | jq '.connected_peers' |
| 55 | +``` |
| 56 | + |
| 57 | +**Expected:** Each node should show other nodes in `connected_peers` array. |
| 58 | + |
| 59 | +### 4. Check LibP2P Metrics |
| 60 | + |
| 61 | +```bash |
| 62 | +# Check connection metrics |
| 63 | +curl -s http://localhost:9601/metrics | grep libp2p |
| 64 | +curl -s http://localhost:9602/metrics | grep libp2p |
| 65 | + |
| 66 | +# Look for: |
| 67 | +# - connected_peers_count (should be > 0) |
| 68 | +# - No connection errors |
| 69 | +``` |
| 70 | + |
| 71 | +### 5. Verify Operator Registration |
| 72 | + |
| 73 | +Before triggering DKG, ensure all operators are registered: |
| 74 | + |
| 75 | +```bash |
| 76 | +# Check registration status for all nodes |
| 77 | +for i in {1..3}; do |
| 78 | + OPERATOR=$(curl -s http://localhost:960$i/diagnostics | jq -r '.client_info.chain_address') |
| 79 | + echo "Node $i operator: $OPERATOR" |
| 80 | + KEEP_ETHEREUM_PASSWORD=password ./keep-client ethereum ecdsa wallet-registry is-operator-in-pool \ |
| 81 | + "$OPERATOR" --config configs/config.toml --developer 2>&1 | tail -1 |
| 82 | +done |
| 83 | +``` |
| 84 | + |
| 85 | +### 6. Trigger DKG (Distributed Key Generation) |
| 86 | + |
| 87 | +Once nodes are connected and operators are registered, trigger a DKG: |
| 88 | + |
| 89 | +```bash |
| 90 | +# Request a new wallet (this triggers DKG) |
| 91 | +KEEP_ETHEREUM_PASSWORD=password ./keep-client ethereum ecdsa wallet-registry request-new-wallet \ |
| 92 | + --submit \ |
| 93 | + --config configs/config.toml \ |
| 94 | + --developer |
| 95 | +``` |
| 96 | + |
| 97 | +This will: |
| 98 | +- Create a DKG request |
| 99 | +- Select operators from the sortition pool |
| 100 | +- Initiate the DKG process |
| 101 | + |
| 102 | +### 7. Monitor DKG Progress |
| 103 | + |
| 104 | +```bash |
| 105 | +# Watch logs for DKG activity |
| 106 | +tail -f logs/node1.log | grep -i dkg |
| 107 | +tail -f logs/node2.log | grep -i dkg |
| 108 | +tail -f logs/node3.log | grep -i dkg |
| 109 | + |
| 110 | +# Check DKG state via diagnostics (if available) |
| 111 | +curl -s http://localhost:9601/diagnostics | jq '.DkgState // "not available"' |
| 112 | +``` |
| 113 | + |
| 114 | +**DKG States:** |
| 115 | +- `IDLE` (0) - No DKG in progress |
| 116 | +- `AWAITING_SEED` (1) - Waiting for seed submission |
| 117 | +- `AWAITING_RESULT` (2) - Waiting for DKG result |
| 118 | +- `CHALLENGE` (3) - DKG result challenged |
| 119 | + |
| 120 | +### 8. Verify DKG Completion |
| 121 | + |
| 122 | +```bash |
| 123 | +# Check for wallet creation |
| 124 | +KEEP_ETHEREUM_PASSWORD=password ./keep-client ethereum ecdsa wallet-registry wallets \ |
| 125 | + --config configs/config.toml \ |
| 126 | + --developer |
| 127 | + |
| 128 | +# Check logs for completion messages |
| 129 | +grep -i "wallet.*created\|dkg.*complete" logs/node*.log |
| 130 | +``` |
| 131 | + |
| 132 | +## Troubleshooting |
| 133 | + |
| 134 | +### Nodes Won't Connect |
| 135 | + |
| 136 | +**Symptoms:** |
| 137 | +- `connected_peers` array is empty |
| 138 | +- No LibP2P connections in metrics |
| 139 | + |
| 140 | +**Solutions:** |
| 141 | +1. Verify peer IDs are correct: |
| 142 | + ```bash |
| 143 | + grep Peers configs/node*.toml |
| 144 | + ``` |
| 145 | + |
| 146 | +2. Check network ports aren't blocked: |
| 147 | + ```bash |
| 148 | + netstat -an | grep -E "3919|3920|3921" |
| 149 | + ``` |
| 150 | + |
| 151 | +3. Ensure nodes were restarted after updating peer IDs |
| 152 | + |
| 153 | +4. Check logs for connection errors: |
| 154 | + ```bash |
| 155 | + tail -f logs/node*.log | grep -i "connection\|peer\|libp2p" |
| 156 | + ``` |
| 157 | + |
| 158 | +### DKG Not Starting |
| 159 | + |
| 160 | +**Check:** |
| 161 | +- All selected operators are running |
| 162 | +- Operators are registered in both RandomBeacon and WalletRegistry |
| 163 | +- Sufficient authorization amounts |
| 164 | +- Network connectivity is stable |
| 165 | + |
| 166 | +### DKG Stuck |
| 167 | + |
| 168 | +**Check:** |
| 169 | +- All operators can communicate (LibP2P connections) |
| 170 | +- DKG timeout hasn't expired |
| 171 | +- Check logs for errors: |
| 172 | + ```bash |
| 173 | + tail -f logs/node*.log | grep -i error |
| 174 | + ``` |
| 175 | + |
| 176 | +## Quick Reference |
| 177 | + |
| 178 | +```bash |
| 179 | +# Complete workflow (after nodes started) |
| 180 | +./scripts/update-peer-ids.sh # Update peer IDs (already done) |
| 181 | +./configs/stop-all-nodes.sh # Stop nodes |
| 182 | +./configs/start-all-nodes.sh # Restart with peer IDs |
| 183 | +sleep 10 # Wait for connections |
| 184 | +./configs/check-nodes.sh # Verify status |
| 185 | +curl -s http://localhost:9601/diagnostics | jq '.connected_peers | length' # Check connections |
| 186 | +KEEP_ETHEREUM_PASSWORD=password \ |
| 187 | + ./keep-client ethereum ecdsa wallet-registry request-new-wallet \ |
| 188 | + --submit --config configs/config.toml --developer # Trigger DKG |
| 189 | +tail -f logs/node*.log | grep -i dkg # Monitor DKG |
| 190 | +``` |
| 191 | + |
| 192 | +## Next Steps After DKG Completes |
| 193 | + |
| 194 | +Once DKG completes successfully: |
| 195 | +- ✅ Wallet is created and ready |
| 196 | +- ✅ Operators can participate in signing |
| 197 | +- ✅ System is ready for use |
| 198 | + |
| 199 | +For production deployment, ensure: |
| 200 | +- All operators are properly registered |
| 201 | +- Sufficient stake and authorization |
| 202 | +- Network connectivity is stable |
| 203 | +- Monitoring is in place |
| 204 | + |
0 commit comments