# Besu Official Repository Updates

**Date**: $(date)  
**Source**: [Hyperledger Besu GitHub](https://github.com/hyperledger/besu)  
**Documentation**: [Besu User Documentation](https://besu.hyperledger.org)

## Updates Applied Based on Official Repository

### 1. Documentation References

All documentation has been updated to reference the official Hyperledger Besu repository and documentation:

- **Repository**: https://github.com/hyperledger/besu
- **Documentation**: https://besu.hyperledger.org
- **Latest Release**: 25.12.0 (as of Dec 2025)

### 2. Key Generation Methods

Updated key generation methods to use official Besu CLI commands:

#### Official Besu Commands

```bash
# Export public key from private key
besu public-key export --node-private-key-file=<path-to-nodekey>

# Export address from private key
besu public-key export-address --node-private-key-file=<path-to-nodekey>
```

**Reference**: https://besu.hyperledger.org/Reference/CLI/CLI-Subcommands/#public-key

### 3. File Structure Standards

Confirmed compatibility with Besu's expected file structure:

#### Node Keys (P2P)
- **Location**: `/data/besu/nodekey`
- **Format**: 64 hex characters (32 bytes)
- **Auto-generation**: Besu auto-generates if not provided

#### Validator Keys (QBFT)
- **Location**: Configurable in `config.toml`
- **Format**: Hex-encoded or PEM format (both supported)
- **Usage**: Block signing in QBFT consensus

### 4. Configuration File Locations

Standard Besu configuration file locations:

```
/etc/besu/
├── genesis.json              # Network genesis block
├── config.toml               # Main Besu configuration
├── permissions-nodes.toml    # Node allowlist
└── permissions-accounts.toml # Account allowlist

/data/besu/
├── nodekey                   # P2P node private key
└── database/                 # Blockchain database
```

### 5. Consensus Protocol Documentation

References updated to official Besu consensus documentation:

- **QBFT**: https://besu.hyperledger.org/HowTo/Configure/Consensus-Protocols/QBFT
- **IBFT 2.0**: https://besu.hyperledger.org/HowTo/Configure/Consensus-Protocols/IBFT
- **Clique**: https://besu.hyperledger.org/HowTo/Configure/Consensus-Protocols/Clique

### 6. Key Management Best Practices

From official Besu documentation:

1. **Node Key Generation**:
   ```bash
   # Auto-generated on first startup, or generate manually:
   openssl rand -hex 32 > nodekey
   ```

2. **Validator Key Generation**:
   ```bash
   # Using OpenSSL (standard)
   openssl ecparam -name secp256k1 -genkey -noout -out key.priv
   
   # Extract address using Besu
   besu public-key export-address --node-private-key-file=key.priv > address.txt
   ```

3. **Key Format Support**:
   - Hex-encoded keys (64 hex characters)
   - PEM format (base64 encoded)
   - Besu auto-detects format

### 7. Repository Information

**Hyperledger Besu Repository Stats**:
- **Stars**: 1.7k
- **Forks**: 992
- **Language**: Java 99.7%
- **License**: Apache 2.0
- **Status**: Active development
- **Latest Release**: 25.12.0 (Dec 12, 2025)

### 8. Community Resources

- **GitHub**: https://github.com/hyperledger/besu
- **Documentation**: https://besu.hyperledger.org
- **Wiki**: https://wiki.hyperledger.org/display/besu
- **Discord**: Besu channel for community support
- **Issues**: https://github.com/hyperledger/besu/issues

## Files Updated

1. `docs/QUORUM_GENESIS_TOOL_REVIEW.md` - Added official Besu references
2. `docs/VALIDATOR_KEY_DETAILS.md` - Updated with official key generation methods
3. `docs/BESU_OFFICIAL_REFERENCE.md` - New comprehensive reference document
4. `docs/BESU_OFFICIAL_UPDATES.md` - This update log

## Next Steps

1. ✅ Update documentation with official repository links
2. ✅ Update key generation methods to use official Besu commands
3. ✅ Verify compatibility with Besu's expected file structure
4. ⏳ Review and update any deprecated methods in scripts
5. ⏳ Update Docker image references to use latest stable version

## Verification

To verify compatibility with official Besu:

```bash
# Check key generation
besu public-key export-address --node-private-key-file=key.priv

# Verify nodekey format
test -f /data/besu/nodekey && [ $(wc -c < /data/besu/nodekey) -eq 65 ]

# Check Besu version compatibility
docker run --rm hyperledger/besu:latest besu --version
```

