Skip to content

Run with a consensus client ​

This page tells you how to start the Cinder node and connect a consensus client to it. At the end the node follows the chain.

Consensus clientLighthouse, Prysm, ...Cinderexecution clientYouwallet, script, curlEngine APIJWT secretport 8552JSON-RPCport 8547
The consensus client drives the chain. You read the state.

Before you start ​

  • A Cinder database from Import state from reth.
  • A mainnet consensus client: Lighthouse, Prysm, Teku, Nimbus or Lodestar.
  • openssl, to make the JWT secret.
  • Open the P2P port (default 30303), TCP and UDP, for inbound peers. See No peers.

Steps ​

  1. Make the JWT secret. The Engine API uses a JWT secret, as reth and Lighthouse do. Cinder reads the secret from a file that holds it in hex. Give Cinder and the consensus client the same file.

    bash
    openssl rand -hex 32 > jwt.hex
    wc -c jwt.hex

    Output

    text
    65 jwt.hex

    The file holds 64 hex characters and a newline.

  2. Start the node.

    bash
    build/release/bin/cinder --engine --db ./cinder-data --jwt ./jwt.hex --p2p --http

    Output

    text
    threads: T (the default for C usable CPUs; --threads N to change)
    exec isolation: executing thread on CPU N, its siblings left free, other threads on M CPUs
    p2p: 4096 known nodes from the node file
    p2p: enode://<node id>@<this host>:30303
    JSON-RPC namespaces: HTTP eth,net,web3 | WebSocket eth,net,web3
    JSON-RPC on http://127.0.0.1:8547 (WebSocket on the same port)
    Cinder engine API on 127.0.0.1:8552, database head #26184124, persist depth 0, p2p backfill

    The command does these things:

    • --engine starts the Engine API on 127.0.0.1:8552. The default port of the Engine API of Cinder is 8552, not the common 8551. Give --authrpc-port 8551 if your consensus client expects 8551.
    • Without --threads, the node takes min(8, CPUs - 2) threads, at least 1, for its worker pool and its prewarm pool. The first line of the output shows the number. See Threads.
    • --p2p connects the node to the Ethereum network. The node gets missing blocks from peers.
    • --http starts the JSON-RPC API on 127.0.0.1:8547, with HTTP and WebSocket on the same port. It serves the eth, net and web3 namespaces, as reth. For debug, trace or txpool, add --http-api and --ws-api, for example --http-api eth,net,web3,debug,trace,txpool. See JSON-RPC namespaces.

    For each option, see Configuration.

    Two more steps make the node faster and help it find peers:

    • Give the binary the CAP_SYS_NICE capability, so that the executing thread can run at a higher priority. On a machine with more than one NUMA node, start the node with numactl. See Tuning.
    • Open the P2P port, as the "Before you start" list says.
  3. Connect the consensus client. Set its execution endpoint to http://127.0.0.1:8552 and give it the same JWT secret file. Use the command of your client:

    bash
    lighthouse bn --network mainnet \
        --execution-endpoint http://127.0.0.1:8552 \
        --execution-jwt /path/to/jwt.hex
    bash
    beacon-chain --mainnet \
        --execution-endpoint=http://127.0.0.1:8552 \
        --jwt-secret=/path/to/jwt.hex
    bash
    teku --network=mainnet \
        --ee-endpoint=http://127.0.0.1:8552 \
        --ee-jwt-secret-file=/path/to/jwt.hex
    bash
    nimbus_beacon_node --network=mainnet \
        --el=http://127.0.0.1:8552 \
        --jwt-secret=/path/to/jwt.hex
    bash
    lodestar beacon --network mainnet \
        --execution.urls http://127.0.0.1:8552 \
        --jwtSecret /path/to/jwt.hex

    The official documentation of each client: Lighthouse, Prysm, Teku, Nimbus, Lodestar. Each client has a checkpoint sync option that makes the first sync faster. Read the documentation of your client for the option. For public checkpoint sync URLs, see eth-clients.github.io/checkpoint-sync-endpoints.

    Output

    The commands above are the documented commands of each client. This page shows only the Cinder side output, because that output is the same for all clients. For the output of the consensus client, see its official documentation (links above). Each client has more options that this page does not cover.

    For each block, the node prints one newPayload line and one forkchoice line. The status must be VALID:

    text
    newPayload  #26184125 0x33e9ed119cc9 txs 289 seen 0 held 0 gas 27.5M: VALID [prewarm 0 exec 144 (wait 0) diff 0 root 13 = storage 5 + accounts 4 + replay 4 (apply 0 prefetch 4) pre 0.5 hist 1.2 tn 0.1] (160 ms) reads 395 in 26 ms, miss exec 718/1963/0 root 0/0/203, prefetch queued 2153 left 0, writes 480/1016, request read 0.7 ms in 4, parse 0.4, decode 3.0
    forkchoice  head 0x33e9ed119cc9: VALID (in memory 1, persisted #26184124) (0 ms)
    written     #26184125..#26184125 (1 blocks, 941 ms, in the background)

    The written line tells you that the writer thread wrote blocks to the database. For the meaning of each field, see Monitoring.

Reach the head of the chain ​

After the import, the Cinder database is behind the chain. The consensus client sends a head that Cinder does not have yet. Cinder then answers SYNCING and gets the missing blocks:

  • With --p2p, from peers. The node prints p2p backfill: #N (K peers) every 100 blocks.
  • With --backfill-rpc URL and without --p2p, from the JSON-RPC API of a reth node. The node prints backfill: #N of M.

After a restart, the node can answer SYNCING for some minutes. See SYNCING for a long time after a restart.

Optional: compare with another execution client ​

You do not need this section to run Cinder. It is for a comparison of Cinder with another execution client on the same blocks, as the project measures Cinder against reth. A consensus client usually talks to one execution client, so use one of these tools:

  • cinder-mirror goes between the consensus client and the other execution client, for example reth. That client answers all calls. The tool sends a copy of each engine_newPayload and engine_forkchoiceUpdated call to Cinder and compares the statuses. Set the execution endpoint of the consensus client to the address of cinder-mirror.
  • cinder-replay reads beacon blocks from the REST API of the consensus client. It sends Cinder the same Engine API calls that a consensus client sends.

To see the options of the tools, run them with --help:

bash
build/release/bin/cinder-mirror --help
build/release/bin/cinder-replay --help

Output

text
usage: cinder-mirror --listen ADDR:PORT --jwt FILE --primary URL [--primary-jwt FILE] --secondary URL [--secondary-jwt FILE] [--name NAME] [--secondary ...]... [--log FILE]
usage: cinder-replay --engine URL --jwt FILE [--beacon URL] [--from-slot S | --back N] [--follow] [--keep-going]

An example for each tool, with the reth Engine API URL in RETH_AUTH_URL and the listen port in MIRROR_PORT:

bash
build/release/bin/cinder-mirror --listen 127.0.0.1:$MIRROR_PORT --jwt ./jwt.hex \
    --primary $RETH_AUTH_URL --secondary http://127.0.0.1:8552

Output

This is a description, not captured output. The tool writes a DIFF line for each difference between the statuses of reth and Cinder. It writes no such line while the statuses are equal. See the command line reference.

bash
build/release/bin/cinder-replay --engine http://127.0.0.1:8552 --jwt ./jwt.hex \
    --beacon http://127.0.0.1:5052 --follow

Output

This is a description, not captured output. The tool sends the Engine API calls for each beacon block. For what it reports, see the command line reference.

Next: Check it works