# Multi-Region Validator Deployment

## Configuration

### Deployment Strategy
- **Total Validators**: 5
- **Distribution**: 1 validator per region across 5 regions
- **VM Size**: Standard_B2s (2 vCPUs, 4GB RAM per validator)
- **Total vCPUs**: 5 × 2 = 10 vCPUs (across 5 regions)
- **Cost**: 5 × $15/month = $75/month

### Regions
1. **West Europe** (westeurope) - Primary region
2. **North Europe** (northeurope)
3. **UK South** (uksouth)
4. **France Central** (francecentral)
5. **Germany West Central** (germanywestcentral)

### Per-Region Configuration
- **AKS Cluster**: 1 cluster per region
- **System Nodes**: 3 × Standard_D2s_v3 (6 vCPUs)
- **Validator Nodes**: 1 × Standard_B2s (2 vCPUs)
- **Total per Region**: 8 vCPUs

## Deployment Requirements

### Quota Requirements
- Each region needs quota for 8 vCPUs (6 system + 2 validator)
- Total across 5 regions: 40 vCPUs
- **Note**: Quota is per-region, so each region needs its own quota allocation

### Prerequisites
1. ✅ Cloud for Sovereignty foundation deployed (37 regions)
2. ⏳ AKS clusters deployed in 5 regions
3. ⏳ Validator node pools deployed (1 per region)
4. ⏳ Besu network deployed on validators

## Deployment Steps

### Step 1: Update Configuration
```bash
# Update terraform.tfvars
cd terraform/well-architected/cloud-sovereignty
# Set selected_regions and validator_config
```

### Step 2: Deploy AKS Clusters
```bash
# Deploy AKS clusters in 5 regions
terraform init
terraform plan
terraform apply
```

### Step 3: Deploy Validator Node Pools
```bash
# Validator node pools are deployed automatically with AKS clusters
# Each region gets 1 validator node (Standard_B2s)
```

### Step 4: Deploy Besu Network
```bash
# Deploy Besu validators on the node pools
kubectl apply -f k8s/besu/validator-deployment.yaml
# Repeat for each region
```

## Network Configuration

### Validator Peering
- Validators in different regions peer via public IPs
- Use static-nodes.json to configure peering
- Configure network security groups to allow P2P (port 30303)

### Consensus
- QBFT consensus
- 5 validators = 3 minimum for consensus (tolerant of 2 failures)
- Block time: ~2 seconds

## Cost Analysis

### Per Region
- System Nodes: 3 × Standard_D2s_v3 = ~$210/month
- Validator Nodes: 1 × Standard_B2s = ~$15/month
- **Total per Region**: ~$225/month

### Across 5 Regions
- **Total Cost**: ~$1,125/month
- **Validator Cost**: ~$75/month (5 × $15)
- **System Cost**: ~$1,050/month (5 × $210)

## Monitoring

### Per-Region Monitoring
- Azure Monitor for each AKS cluster
- Prometheus for Besu metrics
- Grafana dashboards per region

### Cross-Region Monitoring
- Aggregate metrics across all regions
- Alert on validator failures
- Monitor network connectivity between regions

## Disaster Recovery

### Region Failover
- If one region fails, 4 validators remain (still above consensus threshold)
- Network continues to operate with 4 validators
- Failed region can be restored and rejoin network

### Data Replication
- Each validator maintains full chain state
- No cross-region data replication needed (blockchain is replicated via consensus)

## Next Steps

1. ✅ Update Terraform configuration - Complete
2. ⏳ Request quota increases for 5 regions
3. ⏳ Deploy AKS clusters in 5 regions
4. ⏳ Deploy validator node pools
5. ⏳ Deploy Besu network
6. ⏳ Configure validator peering
7. ⏳ Test multi-region consensus
8. ⏳ Monitor and optimize
