Ethereum Node / DONE

Minimum server requirements:

Disk: At least 2 TB SSD (NVMe).

Processor: Minimum 8 cores.

Memory: 16 GB.

Software: It is necessary to have Docker installed.

Prepare file system

mkdir -p /nodes/eth

Generate jwt secret:

openssl rand -hex 32 | tr -d "\n" > /nodes/eth/jwt.secret

Create docker-compose.yml

nano /nodes/eth/docker-compose.yml

Note: Replace _YOUR_HOST_IP_ with your server IP.

docker-compose.yml
x-logging:
  &default-logging
  driver: "json-file"
  options:
    max-file: "1"
    max-size: "500m"

services:
  prysm-beacon:
    container_name: prysm-beacon
    image: gcr.io/prysmaticlabs/prysm/beacon-chain:latest
    restart: unless-stopped
    command:
      - --datadir=/data
      - --rpc-host=0.0.0.0
      - --grpc-gateway-host=0.0.0.0
      - --monitoring-host=0.0.0.0
      - --execution-endpoint=http://geth:8551
      - --jwt-secret=/tmp/jwt.secret
      - --accept-terms-of-use
      #- --checkpoint-sync-url=https://sync.invis.tools
      - --genesis-beacon-api-url=https://sync.invis.tools
      - --p2p-denylist=private
      - --p2p-host-ip=_YOUR_HOST_IP_
      #- --clear-db=true
      #- --force-clear-db=true
    ports:
      - 127.0.0.1:3500:3500
      - 12000:12000/udp
      - 13000:13000
    volumes:
      - ./prysm-beacon:/data
      - ./jwt.secret:/tmp/jwt.secret
    logging: *default-logging

  geth:
    container_name: geth
    image: ethereum/client-go:latest
    volumes:
      - ./data-ethereum:/root/.ethereum
      - ./jwt.secret:/tmp/jwt.secret
    restart: unless-stopped
    stop_signal: SIGINT
    stop_grace_period: 5m
    ports:
      - 127.0.0.1:28545:8545
      - 30303:30303/tcp
      - 30303:30303/udp
    command:
      - --cache=32000
      - --authrpc.vhosts=*
      - --authrpc.addr=0.0.0.0
      - --authrpc.jwtsecret=/tmp/jwt.secret
      - --http
      - --ws
      - --ws.addr=0.0.0.0
      - --ws.port=8545
      - --ws.origins=*
      - --ws.api=web3,eth,net
      - --http.api=web3,eth,net
      - --http.addr=0.0.0.0
      - --http.port=8545
      - --http.vhosts=*
    logging: *default-logging

Fast sync: In order to speed up beacon node synchronisation, you need to uncomment the line --checkpoint-sync-url=https://sync.invis.tools. After that, start the container and check the beacon container logs. After successful synchronisation, comment the line back out.

Launching geth node:

cd /nodes/eth
docker compose up -d

Opening the access port

Create a proxy from port

- localhost:28545 to port 8545 for geth rpc

Setting up a proxy on caddy

Installing caddy https://caddyserver.com/docs/install

Documentation prepared for Debian, Ubuntu operating system

apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' |  tee /etc/apt/sources.list.d/caddy-stable.list
apt update
apt install caddy

configure caddy for proxy

28545 on port 8545 for the external network

nano /etc/caddy/Caddyfile

! Replace RANDOM_STRING with your random string.

/etc/caddy/Caddyfile
:8545 {
  @websockets {
    header_regexp Connection (U|u)pgrade
    header Upgrade websocket
  }
  handle_path /_RANDOM_STRING_* {
    reverse_proxy @websockets 127.0.0.1:28545
    reverse_proxy 127.0.0.1:28545
  }
  respond 404
}

launch caddy

systemctl enable --now caddy

or restart if necessary

systemctl restart caddy

Opening a port for RPC: To access RPC, you must open port 8545 in the firewall settings for the IP address of the server from which the connection will originate.

Accesses

RPC: http://ip.host:8545/_RANDOM_STRING_/

Last updated