eth-stack/stack-orchestrator/stacks/eth/README.md
Prathamesh Musale 47cc5ed527 Add a stack to run an Ethereum node (#1)
Part of [Create a public laconicd testnet](https://www.notion.so/Create-a-public-laconicd-testnet-896a11bdd8094eff8f1b49c0be0ca3b8) and [Create bridge channel in go-nitro](https://www.notion.so/Create-bridge-channel-in-go-nitro-22ce80a0d8ae4edb80020a8f250ea270)

Reviewed-on: #1
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-09-11 04:18:18 +00:00

2.8 KiB

eth

Setup

  • Clone the stack repo:

    laconic-so fetch-stack git.vdb.to/cerc-io/eth-stack
    

Create a deployment

  • Create a spec file for the deployment, which will map the stack's ports and volumes to the host:

    laconic-so --stack ~/cerc/eth-stack/stack-orchestrator/stacks/eth deploy init --output eth-spec.yml
    
  • Edit network in the spec file to map container ports to host ports as required:

    ...
    network:
      ports:
        eth-geth:
          - '8545:8545'
          - '8546:8546'
          - '6060:6060'
          - '30303:30303/tcp'
          - '30303:30303/udp'
        eth-lighthouse:
          - '8001:8001'
          - '9000:9000/tcp'
          - '9000:9000/udp'
    
  • Create a deployment from the spec file:

    laconic-so --stack ~/cerc/eth-stack/stack-orchestrator/stacks/eth deploy create --spec-file eth-spec.yml --deployment-dir eth-deployment
    
  • Inside the eth-deployment deployment directory, open config.env file and set following env variables:

    # Optional
    
    # Network to run the ETH node for (default: sepolia)
    # (one of mainnet, sepolia, holesky)
    CERC_NETWORK=
    
    # Geth options (https://geth.ethereum.org/docs/fundamentals/command-line-options)
    
    # Allow unprotected txs (default: false)
    CERC_ALLOW_UNPROTECTED_TXS=
    
    # Blockchain sync mode (default: full)
    CERC_SYNCMODE=
    
    # Garbage collection mode (default: archive)
    CERC_GCMODE=
    
    # Verbosity level (default: info)
    CERC_GETH_VERBOSITY=
    
    # Lighthouse BN options (https://lighthouse-book.sigmaprime.io/help_bn.html)
    
    # Verbosity level (default: info)
    CERC_DEBUG_LEVEL=
    
    # Required
    
    # Beacon node endpoint to use for checkpoint sync
    # (https://eth-clients.github.io/checkpoint-sync-endpoints/)
    CERC_CHECKPOINT_SYNC_URL=
    

Start

  • Start the deployment:

    laconic-so deployment --dir eth-deployment start
    

Check status

  • To list down and monitor the running containers:

    # With status
    docker ps -a
    
    # Follow logs for eth-geth container
    laconic-so deployment --dir eth-deployment logs eth-geth -f
    
    # Follow logs for eth-lighthouse container
    laconic-so deployment --dir eth-deployment logs eth-lighthouse -f
    
  • Once the node has caught up to head, make a request to get the latest block number:

    curl -H "Content-Type: application/json" \
    --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \
    http://localhost:8545
    

Clean up

  • To stop all services running in the background, while preserving chain data:

    laconic-so deployment --dir eth-deployment stop
    
  • To stop all services and also delete chain data:

    laconic-so deployment --dir eth-deployment stop --delete-volumes
    
    # Remove the deployment dir
    sudo rm -rf eth-deployment