# PezkuwiChain Beta Testnet Configuration

This repository contains the configuration files needed to run validators 5-8 on Computer 2 for the PezkuwiChain Beta Testnet.

## Contents

- `chainspec/beta-testnet.json` - Raw chainspec file (5.2MB) - CRITICAL FILE
- `scripts/` - Validator startup scripts for Computer 2 (validators 5-8)
- `keys/` - Session keys for validators 5-8 (to be added)

## Computer 1 (Bootnode + Validators 1-4)
- IP: 172.31.134.70
- Validators: 1, 2, 3, 4
- Bootnode: /ip4/172.31.134.70/tcp/30333/p2p/12D3KooWLdhYkAXWWR7fFSWhMmBFgHVTf78ZWaWf2BpJxzJbTqCU
- Genesis Hash: 0xa017f4bbea9c44b29244277ce562405a774f6555d04901c846222e3ac7e554b1

## Computer 2 (Validators 5-8)
- IP: 172.17.184.230
- Validators: 5, 6, 7, 8
- Ports: P2P 30337-30340, RPC 9948-9951

## Setup Instructions for Computer 2

### 1. Clone this repository
```bash
cd /home/mesut
git clone <YOUR_PRIVATE_REPO_URL> pezkuwi-beta-config
```

### 2. Copy chainspec to SDK directory
```bash
cp pezkuwi-beta-config/chainspec/beta-testnet.json /home/mesut/Pezkuwi-SDK/computer1-beta-chainspec.json
```

### 3. Verify chainspec file
```bash
ls -lh /home/mesut/Pezkuwi-SDK/computer1-beta-chainspec.json
# Should show: 5.2M
```

### 4. Clean old chain data (important!)
```bash
rm -rf /tmp/beta-validator-{5,6,7,8}
```

### 5. Make scripts executable
```bash
chmod +x pezkuwi-beta-config/scripts/*.sh
```

### 6. Copy scripts to SDK
```bash
cp -r pezkuwi-beta-config/scripts/* /home/mesut/Pezkuwi-SDK/scripts/computer2/
```

### 7. Insert validator keys (if not done already)
```bash
cd /home/mesut/Pezkuwi-SDK/scripts
./insert-all-beta-keys.sh
```

### 8. Start all validators
```bash
cd /home/mesut/Pezkuwi-SDK/scripts/computer2
./start-all-validators-computer2.sh
```

### 9. Verify validators are running
```bash
# Check processes
ps aux | grep pezkuwi

# Check logs
tail -f /tmp/beta-validator-5.log
tail -f /tmp/beta-validator-6.log
tail -f /tmp/beta-validator-7.log
tail -f /tmp/beta-validator-8.log
```

### 10. Stop validators (if needed)
```bash
cd /home/mesut/Pezkuwi-SDK/scripts/computer2
./stop-validators-computer2.sh
```

## Expected Behavior

Once all 8 validators are running:
- Each validator should show 7 peers (connected to all other validators)
- Genesis hash should match: 0xa017f4bbea9c44b29244277ce562405a774f6555d04901c846222e3ac7e554b1
- Block production should begin (requires minimum 6 validators for BFT consensus)
- Logs should show: "Prepared block for proposing"

## Troubleshooting

### Genesis hash mismatch
- Ensure chainspec file is exactly 5.2MB
- Re-copy from this repository
- Clean chain data: `rm -rf /tmp/beta-validator-{5,6,7,8}`

### 0 peers
- Verify Computer 1 validators are running
- Check bootnode is accessible: `telnet 172.31.134.70 30333`
- Verify IP addresses are correct in scripts

### Keys not found
- Re-run key insertion: `./insert-all-beta-keys.sh`
- Check RPC ports are correct (9948-9951)

## Important Files

- DO NOT modify the chainspec file - it must match Computer 1 exactly
- Session keys are stored in validator base paths: /tmp/beta-validator-{5,6,7,8}
- Seed phrases are stored separately (NOT in this repository)

## Network Architecture

```
Computer 1 (172.31.134.70)
├── Validator 1 (Bootnode) - P2P:30333, RPC:9944
├── Validator 2 - P2P:30334, RPC:9945
├── Validator 3 - P2P:30335, RPC:9946
└── Validator 4 - P2P:30336, RPC:9947

Computer 2 (172.17.184.230)
├── Validator 5 - P2P:30337, RPC:9948
├── Validator 6 - P2P:30338, RPC:9949
├── Validator 7 - P2P:30339, RPC:9950
└── Validator 8 - P2P:30340, RPC:9951
```

## Version Information

- Pezkuwi Binary: 1.18.5-9efe07f98b8
- Chain: pezkuwichain-beta-testnet
- Consensus: BABE/GRANDPA with 8 validators
