|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +This is a Local Ethereum Proof-of-Stake (PoS) Testnet deployment tool for developers who want to quickly set up and deploy their own local Ethereum PoS networks with multiple nodes. It's useful for testing modifications to Ethereum client source code, simulating blockchain reorganizations, testing Byzantine behavior, and developing Ethereum applications. |
| 8 | + |
| 9 | +## Key Commands |
| 10 | + |
| 11 | +### Building Dependencies |
| 12 | +```bash |
| 13 | +# Build Go-Ethereum and Prysm from submodules |
| 14 | +./build-dependencies.sh |
| 15 | + |
| 16 | +# Build only Geth (from dependencies/go-ethereum directory) |
| 17 | +cd dependencies/go-ethereum && make geth |
| 18 | + |
| 19 | +# Build Prysm components (from dependencies/prysm directory) |
| 20 | +cd dependencies/prysm |
| 21 | +bazel build //cmd/beacon-chain:beacon-chain |
| 22 | +bazel build //cmd/validator:validator |
| 23 | +``` |
| 24 | + |
| 25 | +### Running the Testnet |
| 26 | +```bash |
| 27 | +# Start testnet with default 2 validators |
| 28 | +./testnet.sh |
| 29 | + |
| 30 | +# Check if blocks are being produced |
| 31 | +./healthcheck.sh |
| 32 | +``` |
| 33 | + |
| 34 | +### Development Commands for Go-Ethereum |
| 35 | +From `dependencies/go-ethereum/`: |
| 36 | +```bash |
| 37 | +make test # Run tests |
| 38 | +make lint # Run linters |
| 39 | +make fmt # Format Go code |
| 40 | +``` |
| 41 | + |
| 42 | +## Architecture |
| 43 | + |
| 44 | +The testnet consists of: |
| 45 | +- **Execution Layer**: Go-Ethereum (Geth) nodes |
| 46 | +- **Consensus Layer**: Prysm beacon chain and validator clients |
| 47 | +- **Configuration**: `config.yml` (consensus) and `genesis.json` (execution) |
| 48 | + |
| 49 | +Each node runs both layers with incrementing ports: |
| 50 | +- Geth HTTP: 8000, 8001, 8002... |
| 51 | +- Beacon RPC: 4000, 4001, 4002... |
| 52 | +- Beacon Gateway: 4100, 4101, 4102... |
| 53 | + |
| 54 | +## Key Files and Modifications |
| 55 | + |
| 56 | +1. **testnet.sh**: Main orchestration script that: |
| 57 | + - Sets up network directories |
| 58 | + - Initializes validator keys |
| 59 | + - Starts Geth and Prysm processes |
| 60 | + - Contains NUM_NODES variable to control validator count |
| 61 | + |
| 62 | +2. **config.yml**: Beacon chain configuration |
| 63 | + - Fork epochs (Altair, Bellatrix, Capella, Deneb, Electra) |
| 64 | + - 2-second slots for faster finalization |
| 65 | + - Network parameters |
| 66 | + |
| 67 | +3. **genesis.json**: Execution layer genesis |
| 68 | + - Pre-funded addresses in the `alloc` section |
| 69 | + - Chain ID and initial parameters |
| 70 | + |
| 71 | +## Working with Submodules |
| 72 | + |
| 73 | +The project uses Git submodules for Ethereum clients: |
| 74 | +- `dependencies/go-ethereum` - Geth execution client |
| 75 | +- `dependencies/prysm` - Prysm consensus client |
| 76 | + |
| 77 | +When making changes to these dependencies, remember they are separate Git repositories. |
| 78 | + |
| 79 | +## Testing Modifications |
| 80 | + |
| 81 | +To test changes to Ethereum clients: |
| 82 | +1. Make modifications in `dependencies/go-ethereum` or `dependencies/prysm` |
| 83 | +2. Run `./build-dependencies.sh` to rebuild |
| 84 | +3. Run `./testnet.sh` to test with your changes |
| 85 | +4. Check logs in `./network/node-*/logs/` |
| 86 | + |
| 87 | +## Network Data |
| 88 | + |
| 89 | +All runtime data is stored in `./network/`: |
| 90 | +- `node-0/`, `node-1/`, etc. - Individual node data |
| 91 | +- Logs are in `./network/node-*/logs/` |
| 92 | +- The network directory is cleaned on each run for idempotent deployments |
0 commit comments