eth-stack/stack-orchestrator/stacks/eth
2024-09-04 17:54:06 +05:30
..
README.md Map p2p ports to host for both services 2024-09-04 17:54:06 +05:30
stack.yml Add a service to run a geth node 2024-09-04 12:40:53 +05:30

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=
    
    # 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