Skip to content

Check that Cinder works ​

This page tells you how to check that the Cinder node follows the chain, and how to stop it.

Before you start ​

  • A running node with a consensus client. See Run with a consensus client.
  • The node runs with --http. The JSON-RPC API is then on 127.0.0.1:8547. Examples on this page use this address.
  • curl and jq.

Steps ​

  1. Ask the node for its version.

    bash
    curl -s -H 'content-type: application/json' 127.0.0.1:8547 \
        -d '{"jsonrpc":"2.0","id":1,"method":"web3_clientVersion","params":[]}'

    Output

    text
    {"jsonrpc":"2.0","id":1,"result":"Cinder/v0.9.7/linux-x86_64/c17"}
  2. Ask the node if it is syncing. The answer false means that the node has the head of the chain.

    bash
    curl -s -H 'content-type: application/json' 127.0.0.1:8547 \
        -d '{"jsonrpc":"2.0","id":1,"method":"eth_syncing","params":[]}'

    Output

    text
    {"jsonrpc":"2.0","id":1,"result":false}
  3. Ask the node for the number of its peers. The number is in hex.

    bash
    curl -s -H 'content-type: application/json' 127.0.0.1:8547 \
        -d '{"jsonrpc":"2.0","id":1,"method":"net_peerCount","params":[]}'

    Output

    text
    {"jsonrpc":"2.0","id":1,"result":"0x29"}

    0x29 is 41 peers. If the number is 0x0, see No peers.

  4. Ask the node for its block number, then for its latest block.

    bash
    curl -s -H 'content-type: application/json' 127.0.0.1:8547 \
        -d '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}'

    Output

    text
    {"jsonrpc":"2.0","id":1,"result":"0x18fa66c"}
    bash
    curl -s -H 'content-type: application/json' 127.0.0.1:8547 \
        -d '{"jsonrpc":"2.0","id":1,"method":"eth_getBlockByNumber","params":["latest",false]}' \
        | jq '.result | {number, hash, stateRoot, gasUsed}'

    Output

    The block of your node is the latest block of the chain at that time. This is the block 0x18fa66c:

    text
    {
      "number": "0x18fa66c",
      "hash": "0xcace778dc33a5710077345080ecc660fd4ee239c42b2b43a1b6d10faf8b71ec3",
      "stateRoot": "0x02a98511188ea5beab45a80c55be08ae5f8150ff9f0ad642c3b6628b981cc42e",
      "gasUsed": "0x256ad27"
    }

    To compare, get the same block number from a block explorer. The hash must be equal.

  5. Look at the log of the node, in the terminal where you started it. At start, the node prints its configuration (see step 2 of the previous page). For each block, it 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)

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

Stop the node ​

Press Ctrl-C in the terminal of the node, or send SIGTERM. The node prints a message, writes the canonical blocks that are still in memory, and stops:

bash
kill -TERM $NODE_PID

Output

The node prints this line in its own terminal or log:

text
stopping: writing in-memory canonical blocks

To start the node again, see Upgrading.

Next: Next steps