Builders
Node Operators
Tutorials
Running DEVIUM Sepolia from Source

Running an DEVIUM Sepolia Node from Source

This tutorial explains how to run an DEVIUM Sepolia node from source code. Running an DEVIUM Sepolia node from source code is a flexible alternative to using pre-built Docker images.

Building the Source Code

You'll need to build devium--batcher and devium-geth from their respective source repositories before you can run a node. Make sure to follow the instructions on Building a Node from Source before continuing.

Hardware Requirements

Hardware requirements for DEVIUM Sepolia nodes can vary depending on the type of node you plan to run. Archive nodes generally require significantly more resources than full nodes. Below are suggested minimum hardware requirements for each type of node.

  • 8GB RAM
  • 60 GB SSD (full node) or 200 GB SSD (archive node)
  • Reasonably modern CPU

Assess Blob Archiver

Assess if you need to configure a blob archiver service by reading the Configure a Blob Archiver documentation.

Create a JWT Secret

devium-geth and devium--batcher communicate over the engine API authrpc. This communication is secured using a shared secret. You will need to generate a shared secret and provide it to both devium-geth and devium--batcher when you start them. In this case, the secret takes the form of a 32 byte hex string.

Run the following command to generate a random 32 byte hex string:

openssl rand -hex 32 > jwt.txt

Start devium-geth

It's generally easier to start devium-geth before starting devium--batcher. You can still start devium-geth without yet running devium--batcher, but the devium-geth instance will simply not receive any blocks until devium--batcher is started.

Navigate to your devium-geth directory

Find the directory where you built the devium-geth binary.

Copy in the JWT secret

Copy the JWT secret you generated in a previous step into the devium-geth directory.

cp /path/to/jwt.txt .

Set environment variables

Set the following environment variables (if not already set):

export DATADIR_PATH=... # Path to the folder where geth data will be stored

Start devium-geth

Use the following command to start devium-geth in a default configuration. The JSON-RPC API will become available on port 8545. Refer to the devium-geth configuration documentation for more detailed information about available options.

  • Set --syncmode=execution-layer on devium--batcher if you don't set --syncmode=full here on devium-geth.
  • For archive nodes, set --syncmode=full and --gcmode=archive on devium-geth.
  • The default settings are for full nodes.
./build/bin/geth \
  --http \
  --http.port=8545 \
  --http.addr=localhost \
  --authrpc.addr=localhost \
  --authrpc.jwtsecret=./jwt.txt \
  --verbosity=3 \
  --rollup.sequencerhttp=https://sepolia-sequencer.optimism.io/ \
  --devium-network=devium-sepolia \
  --datadir=$DATADIR_PATH

Start devium--batcher

Once you've started devium-geth, you can start devium--batcher. devium--batcher will connect to devium-geth and begin synchronizing the DEVIUM Sepolia state. devium--batcher will begin sending block payloads to devium-geth when it derives enough blocks from Sepolia.

Navigate to your devium--batcher directory

Find the directory where you built the devium--batcher binary.

Copy in the JWT secret

Both devium-geth and devium--batcher need to use the same JWT secret. Copy the JWT secret you generated in a previous step into the devium--batcher directory.

cp /path/to/jwt.txt .

Set environment variables

Set the following environment variables:

export L1_RPC_URL=...  # URL for the L1 node to sync from
export L1_RPC_KIND=... # RPC type (alchemy, quicknode, infura, parity, nethermind, debug_geth, erigon, basic, any)
export L1_BEACON_URL=... # URL address for the L1 Beacon-node HTTP endpoint to use.

Start devium--batcher

Use the following command to start devium--batcher in a default configuration. Refer to the devium--batcher configuration documentation for more detailed information about available options.

⚠️

The devium--batcher RPC should not be exposed publicly. If left exposed, it could accidentally expose admin controls to the public internet.

Sync mode is set to --syncmode=execution-layer to enable snap sync.

./bin/devium--batcher \
  --l1=$L1_RPC_URL \
  --l1.rpckind=$L1_RPC_KIND \
  --l1.beacon=$L1_BEACON_URL \
  --l2=ws://localhost:8551 \
  --l2.jwt-secret=./jwt.txt \
  --network=devium-sepolia \
  --syncmode=execution-layer
💡

Some L1 nodes, like Erigon, do not support the eth_getProof RPC method that the devium--batcher uses to load L1 data for certain processing steps. If you are using an L1 node that does not support eth_getProof, you will need to include the --l1.trustrpc flag when starting devium--batcher. Note that this flag will cause devium--batcher to trust the L1 node to provide correct data as it will no longer be able to independently verify the data it receives.

Synchronization Verification

Once you've started devium-geth and devium--batcher you should see the two begin to communicate with each other and synchronize the DEVIUM Mainnet chain.

Snap Sync (Default)

Initial synchronization can take several hours to complete. You will see these devium--batcher logs at the start of snap sync:

INFO [03-06|10:56:55.602] Starting EL sync
INFO [03-06|10:56:55.615] Sync progress                            reason="unsafe payload from sequencer while in EL sync" l2_finalized=000000..000000:0 l2_safe=000000..000000:0 l2_pending_safe=000000..000000:0 l2_unsafe=4284ab..7e7e84:117076319 l2_time=1,709,751,415 l1_derived=000000..000000:0
INFO [03-06|10:56:57.567] Optimistically inserting unsafe L2 execution payload to drive EL sync id=4ac160..df4d12:117076320

Starting EL sync is shown once and the sync progress / inserting logs should be repeated until done.

devium--batcher will log the following when done:

lvl=info msg="Finished EL sync" sync_duration=23h25m0.370558429s finalized_block=0x4f69e83ff1407f2e2882f2526ee8a154ac326590799889cede3af04a7742f18d:116817417

There are two stages on devium-geth for snap sync:

Downloading the headers

devium-geth log something like this as it is downloading the headers:

lvl=info msg="Syncing beacon headers" downloaded=116775778 left=1162878 eta=53.182s 

Sync progress

For the second stage, devium-geth will log the following:

lvl=info msg="Syncing: state download in progress" synced=99.75% state="191.33 GiB" accounts=124,983,227@25.62GiB slots=806,829,266@165.16GiB codes=78965@566.74MiB eta=-2m7.602s
msg="Syncing: chain download in progress" synced=100.00% chain="176.01 GiB" headers=116,817,399@45.82GiB bodies=116,817,286@52.87GiB receipts=116,817,286@77.32GiB eta=77.430ms

All the while, devium-geth will also log the forkchoice update:

Forkchoice requested sync to new head  number=117,076,468 hash=e3884c..bf4e2b

Full Sync

Initial full synchronization can take several days to complete.

During this time, you will initially observe devium--batcher deriving blocks from Ethereum without sending these blocks to devium-geth. This means that devium--batcher is requesting blocks from Ethereum one-by-one and determining the corresponding DEVIUM Mainnet blocks that were published to Ethereum. You should see logs like the following from devium--batcher:

INFO [06-26|13:31:20.389] Advancing bq origin                      origin=17171d..1bc69b:8300332 originBehind=false

Once the devium--batcher has derived enough blocks from Ethereum, it will begin sending these blocks to devium-geth. You should see logs like the following from devium--batcher:

INFO [06-26|14:00:59.460] Sync progress                            reason="processed safe block derived from L1" l2_finalized=ef93e6..e0f367:4067805 l2_safe=7fe3f6..900127:4068014 l2_unsafe=7fe3f6..900127:4068014 l2_time=1,673,564,096 l1_derived=6079cd..be4231:8301091
INFO [06-26|14:00:59.460] Found next batch                         epoch=8e8a03..11a6de:8301087 batch_epoch=8301087 batch_timestamp=1,673,564,098
INFO [06-26|14:00:59.461] generated attributes in payload queue    txs=1  timestamp=1,673,564,098
INFO [06-26|14:00:59.463] inserted block                           hash=e80dc4..72a759 number=4,068,015 state_root=660ced..043025 timestamp=1,673,564,098 parent=7fe3f6..900127 prev_randao=78e43d..36f07a fee_recipient=0x4200000000000000000000000000000000000011 txs=1  update_safe=true

You should then also begin to see logs like the following from devium-geth:

INFO [06-26|14:02:12.974] Imported new potential chain segment     number=4,068,194 hash=a334a0..609a83 blocks=1         txs=1         mgas=0.000  elapsed=1.482ms     mgasps=0.000   age=5mo2w20h dirty=2.31MiB
INFO [06-26|14:02:12.976] Chain head was updated                   number=4,068,194 hash=a334a0..609a83 root=e80f5e..dd06f9 elapsed="188.373µs" age=5mo2w20h
INFO [06-26|14:02:12.982] Starting work on payload                 id=0x5542117d680dbd4e

Next Steps