# Next Steps After Genesis.json Update

**Date**: 2025-01-20  
**Action**: Updated genesis.json extraData with current validator addresses

## ✅ Completed Steps

1. **ExtraData Regeneration**
   - ✅ Regenerated extraData field with all 5 current validator addresses
   - ✅ Verified all addresses match validator keys
   - ✅ Validated RLP encoding structure
   - ✅ Confirmed JSON syntax validity

2. **Synchronization**
   - ✅ Synced updated genesis.json to ml110
   - ✅ Verified genesis.json on ml110 matches local

## 📋 Pre-Deployment Checklist

### Files Ready
- ✅ `config/genesis.json` - Updated with current validator addresses
- ✅ `keys/validators/validator-{1-5}/` - All 5 validator keys present
- ✅ Configuration files - No old VMID/IP references
- ✅ All files synchronized to ml110

### Validator Addresses in Genesis.json
```
validator-1: 0x43ea6615474ac886c78182af1acbbf84346f2e9c
validator-2: 0x05db2d6b5584285cc03cd33017c0f8da32652583
validator-3: 0x23e1139cc8359872f8f4ef0d8f01c20355ac5f4b
validator-4: 0x231a55a8ae9946b5dd2dc81c4c07522df42fd3ed
validator-5: 0xc0af7f9251dc57cfb84c192c1bab20f5e312acb3
```

## 🚀 Deployment Options

### Option 1: Complete Validated Deployment (Recommended)

From ml110:
```bash
cd /opt/smom-dbis-138-proxmox
./scripts/deployment/deploy-validated-set.sh \
  --source-project /opt/smom-dbis-138
```

This script will:
- Deploy all containers (validators, sentries, RPC)
- Copy configuration files and keys
- Configure network settings
- Bootstrap the network
- Validate the deployment

### Option 2: Step-by-Step Deployment

#### Step 1: Deploy Containers
```bash
cd /opt/smom-dbis-138-proxmox
./scripts/deployment/deploy-besu-nodes.sh
```

This creates:
- 5 Validator containers (VMIDs 1000-1004)
- 4 Sentry containers (VMIDs 1500-1503)
- 3 RPC containers (VMIDs 2500-2502)

#### Step 2: Copy Configuration and Keys
```bash
./scripts/copy-besu-config.sh
# Or with node-specific directories:
./scripts/copy-besu-config-with-nodes.sh
```

This copies:
- `genesis.json` to each container
- Validator keys to respective containers
- Configuration files (`config-validator.toml`, etc.)
- Permissions files (`permissions-nodes.toml`, etc.)

#### Step 3: Configure Network (if needed)
```bash
# Fix container IP addresses if they're incorrect
./scripts/fix-container-ips.sh

# Verify IP configuration
./scripts/network/update-static-nodes.sh
```

#### Step 4: Bootstrap Network
```bash
./scripts/network/bootstrap-network.sh
```

This:
- Updates `static-nodes.json` with correct enode URLs
- Configures peer discovery
- Sets up initial network connections

#### Step 5: Start Services
```bash
# Enable and start Besu services
./scripts/fix-besu-services.sh

# Verify services are running
./scripts/validate-besu-config.sh
```

#### Step 6: Validate Deployment
```bash
./scripts/validation/validate-deployment-comprehensive.sh
```

This validates:
- Container status
- Service status
- Configuration files
- Key files
- Network connectivity

## 🔍 Post-Deployment Verification

### Check Container Status
```bash
# List all containers
pct list | grep -E "100[0-4]|150[0-3]|250[0-2]"

# Check specific container
pct status 1000
```

### Check Besu Services
```bash
# Check service status
pct exec 1000 -- systemctl status besu-validator.service

# Check logs
pct exec 1000 -- journalctl -u besu-validator.service -f
```

### Verify Network Connectivity
```bash
# Check peer count
pct exec 1000 -- curl -X POST -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":1}' \
  http://localhost:8545

# Check block number
pct exec 1000 -- curl -X POST -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \
  http://localhost:8545
```

### Verify Consensus
```bash
# Check validators
pct exec 1000 -- curl -X POST -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","method":"qbft_getValidatorsByBlockNumber","params":["latest"],"id":1}' \
  http://localhost:8545
```

## 📊 Expected Results

### Validators (1000-1004)
- Status: Running
- Service: `besu-validator.service` active
- Peers: Should connect to other validators and sentries
- Blocks: Should start producing blocks

### Sentries (1500-1503)
- Status: Running
- Service: `besu-sentry.service` active
- Peers: Should connect to validators and other sentries

### RPC Nodes (2500-2502)
- Status: Running
- Service: `besu-rpc-*.service` active
- RPC Endpoint: Accessible on port 8545

## ⚠️ Troubleshooting

### Containers Not Starting
```bash
# Check container logs
pct enter 1000
journalctl -u besu-validator.service -n 50
```

### Keys Not Found
```bash
# Verify keys are copied
pct exec 1000 -- ls -la /keys/validators/validator-1/

# Re-copy keys if needed
./scripts/copy-besu-config.sh
```

### Network Issues
```bash
# Check IP addresses
pct config 1000 | grep net0

# Verify static-nodes.json
pct exec 1000 -- cat /etc/besu/static-nodes.json
```

### Consensus Issues
- Verify all 5 validators are running
- Check that genesis.json is identical on all nodes
- Verify validator keys match addresses in genesis.json extraData
- Check QBFT configuration in config files

## 📝 Notes

- All validator addresses are now correctly included in genesis.json extraData
- The network uses dynamic validator management via QBFT
- Validators can be added/removed via validator contract after initial deployment
- Ensure all nodes use the same genesis.json file

---

**Status**: Ready for Deployment ✅  
**Last Updated**: 2025-01-20

