# Lotus full node (mainnet) with Docker Compose. # # Guide, with every setting explained: # https://lotusia.network/docs/docker-compose/ # (the same page is in the node: Developers > Documentation > Docker Compose) # # Quick start, in an empty folder holding this file: # curl -fsSL -o .env https://lotusia.network/docs/files/env.example # mkdir -p data # before the first start, as the user that runs the node # docker compose up -d # docker compose logs -f lotusd # docker compose run --rm cli getblockchaininfo # # Values written ${LIKE_THIS} come from the .env file next to this one. name: lotus-mainnet services: lotusd: # The node image of one release. The version is set in .env (LOTUSD_TAG). # To upgrade: change LOTUSD_TAG, then `docker compose pull` and # `docker compose up -d`. image: ghcr.io/lotusdevorg/lotusd:${LOTUSD_TAG:?set LOTUSD_TAG in .env} # Ask the registry at every `up`, so a tag is never served from an old # copy left in the local image cache. pull_policy: always restart: unless-stopped # The node writes its state to disk when it stops. Give it the time. stop_grace_period: 900s # The container uses the host's network: the node listens on the host # directly (IPv6 included), and the RPC/REST port below listens on the # host's 127.0.0.1 only. No `ports:` section is needed. network_mode: host # Run as your own user, so the files in the data folder are yours. user: "${LOTUS_UID:-1000}:${LOTUS_GID:-1000}" ulimits: nofile: { soft: 65535, hard: 65535 } volumes: # Chain data: blocks, chain state, indexes, module databases, the # node's keys and certificates. Back this folder up; never delete it to # "fix" something. - ${LOTUS_DATA_DIR:-./data}:/data logging: driver: json-file options: { max-size: "50m", max-file: "3" } healthcheck: # The image has bash but no curl: ask /api/v1/health over a raw socket. # 200 = the node answers (status "ok" when synced, "syncing" during the # first sync); 503 while the chain is still loading. test: ["CMD", "bash", "-c", "exec 3<>/dev/tcp/127.0.0.1/${LOTUS_RPC_PORT:-10604} && printf 'GET /api/v1/health HTTP/1.0\\r\\nHost: localhost\\r\\n\\r\\n' >&3 && head -n 1 <&3 | grep -q ' 200 '"] interval: 60s timeout: 10s retries: 5 start_period: 15m command: # ── Data and logs ────────────────────────────────────────────── - -datadir=/data - -printtoconsole - -shrinkdebugfile=1 # Indexes and modules written inside block connection: their REST # routes never lag behind the tip. 1 (the default) writes them on a # background thread. - -asyncindex=0 # No wallet in this node (use Lotus Desktop or the web wallet). - -disablewallet=1 # ── Chain modules ───────────────────────────────────────────── # empp: multi-push OP_RETURN envelope; rank: RANK votes (Social pages); # pokr: poker league events; blob: files stored on chain; # slp, alp: tokens. Left out: pool (mining pool) and contract. - -modules=empp,rank,pokr,blob,slp,alp # ── Network ─────────────────────────────────────────────────── # Follow the parent chains (BTC, XEC, BCH, LTC) over their own P2P # networks, headers only. Used by the blocks this node builds. - -parentp2p=all - -listen=1 - -port=${LOTUS_P2P_PORT:-10605} # A public server with a fixed address: uncomment both lines and set # EXTERNAL_IP in .env. # - -externalip=${EXTERNAL_IP} # - -discover=0 # Listen on one address only (by default: every address of the host). # - -bind=${EXTERNAL_IP}:${LOTUS_P2P_PORT:-10605} - -upnp=0 - -maxconnections=128 # Ask the DNS seed (seed.givelotus.org) for peers at every start. - -forcednsseed=1 - -peertimeout=300 # ── Resources ───────────────────────────────────────────────── # Database cache in MiB. 300 fits a 4 GB server; raise it (1024 to # 4096) to sync faster on a bigger machine. - -dbcache=300 # HTTP worker threads (JSON-RPC, REST API, dashboard). - -rpcthreads=8 # ── Serving light clients ───────────────────────────────────── # Proofs for thin nodes (Lotus Desktop, browser nodes). - -proofserver=1 # Compact block filters (BIP 157), built and served to peers. - -blockfilterindex=basic - -peerblockfilters=1 # ── Secure WebSocket (wss://) on the P2P port ───────────────── # Needs a DNS name that points at this host (not proxied) and port 80 # open while a certificate is requested. Set ACME_NAME in .env, then # uncomment: # - -p2pwsacme=${ACME_NAME} # - -p2pwsacmeagree=1 # When a web server already uses port 80, let it forward # /.well-known/acme-challenge/ to this listener instead: # - -p2pwsacmeport=10680 # - -p2pwsacmebind=127.0.0.1 # ── RPC, REST API and dashboard: this machine only ──────────── - -rpcbind=127.0.0.1:${LOTUS_RPC_PORT:-10604} - -rpcallowip=127.0.0.1/32 # Optional login for other programs (empty: none; the cli service # below uses the cookie file). Generate it as the guide says. - -rpcauth=${RPCAUTH:-} # lotus-cli in its own image, on the node's network and data folder (it # reads the cookie file there). Not started by `up`; run it with: # docker compose run --rm cli getblockchaininfo cli: image: ghcr.io/lotusdevorg/lotus-cli:${LOTUSD_TAG:?set LOTUSD_TAG in .env} profiles: ["cli"] network_mode: host user: "${LOTUS_UID:-1000}:${LOTUS_GID:-1000}" volumes: - ${LOTUS_DATA_DIR:-./data}:/data:ro entrypoint: ["lotus-cli", "-datadir=/data", "-rpcport=${LOTUS_RPC_PORT:-10604}"]