Linea

Instructions to set up your Linea node.

Requirements

Prerequisites

Terminal window
sudo apt-get install jq -y

Install geth

Check the appropriate version for the network accordingly in their docs

Terminal window
# This is an example - check their docs and release page to opt for the right version
GETH_RELEASE=1.12.0-e501b3b0
Terminal window
# verify correct version
echo $GETH_RELEASE
# create a temp dir for binaries
cd $HOME
mkdir binaries && cd binaries
# if you are on linux amd
wget https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-$GETH_RELEASE.tar.gz
tar -xvf geth-linux-amd64-$GETH_RELEASE.tar.gz
cd geth-linux-amd64-$GETH_RELEASE
chmod +x geth
sudo mv geth /usr/bin/
# verify version
geth version
cd $HOME

Download genesis file

Terminal window
genesis.json https://docs.linea.build/files/geth/mainnet/genesis.json
Terminal window
genesis.json https://docs.linea.build/files/geth/sepolia/genesis.json

Initialize the node

Terminal window
cd $HOME
mkdir -p $HOME/.linea/data
geth --datadir $HOME/.linea/data init $HOME/.linea/config/genesis.json

It should give an output similar to this

Terminal window
INFO [07-16|15:48:00.683] Maximum peer count ETH=50 LES=0 total=50
INFO [07-16|15:48:00.685] Smartcard socket not found, disabling err="stat /run/pcscd/pcscd.comm: no such file or directory"
INFO [07-16|15:48:00.690] Set global gas cap cap=50,000,000
INFO [07-16|15:48:00.690] Initializing the KZG library backend=gokzg
INFO [07-16|15:48:00.799] Defaulting to pebble as the backing database
INFO [07-16|15:48:00.799] Allocated cache and file handles database=$HOME/.linea/data/geth/chaindata cache=16.00MiB handles=16
INFO [07-16|15:48:00.847] Opened ancient database database=$HOME/.linea/data/geth/chaindata/ancient/chain readonly=false
INFO [07-16|15:48:00.847] Writing custom genesis block
INFO [07-16|15:48:00.861] Persisted trie from memory database nodes=356 size=50.85KiB time="761.943µs" gcnodes=0 gcsize=0.00B gctime=0s livenodes=0 livesize=0.00B
INFO [07-16|15:48:00.867] Successfully wrote genesis state database=chaindata hash=b6762a..0ffbc6
INFO [07-16|15:48:00.867] Defaulting to pebble as the backing database
INFO [07-16|15:48:00.867] Allocated cache and file handles database=$HOME/.linea/data/geth/lightchaindata cache=16.00MiB handles=16
INFO [07-16|15:48:00.914] Opened ancient database database=$HOME/.linea/data/geth/lightchaindata/ancient/chain readonly=false
INFO [07-16|15:48:00.914] Writing custom genesis block
INFO [07-16|15:48:00.931] Persisted trie from memory database nodes=356 size=50.85KiB time="747.265µs" gcnodes=0 gcsize=0.00B gctime=0s livenodes=0 livesize=0.00B
INFO [07-16|15:48:00.936] Successfully wrote genesis state database=lightchaindata hash=b6762a..0ffbc6

Setup systemd

Set the necessary variables

Terminal window
BOOTNODES="enode://ca2f06aa93728e2883ff02b0c2076329e475fe667a48035b4f77711ea41a73cf6cb2ff232804c49538ad77794185d83295b57ddd2be79eefc50a9dd5c48bbb2e@3.23.106.165:30303,enode://eef91d714494a1ceb6e06e5ce96fe5d7d25d3701b2d2e68c042b33d5fa0e4bf134116e06947b3f40b0f22db08f104504dd2e5c790d8bcbb6bfb1b7f4f85313ec@3.133.179.213:30303,enode://cfd472842582c422c7c98b0f2d04c6bf21d1afb2c767f72b032f7ea89c03a7abdaf4855b7cb2dc9ae7509836064ba8d817572cf7421ba106ac87857836fa1d1b@3.145.12.13:30303"
Terminal window
BOOTNODES="enode://6f20afbe4397e51b717a7c1ad3095e79aee48c835eebd9237a3e8a16951ade1fe0e66e981e30ea269849fcb6ba03d838da37f524fabd2a557474194a2e2604fa@18.221.100.27:31002,enode://ce1e0d8e0500cb5c0ac56bdcdafb2d6320c3a2c5125b5ccf12f5dfc9b47ee74acbcafc32559017613136c9c36a0ce74ba4f83b7fb8244f099f3b15708d9d3129@3.23.75.47:31000,enode://1b026a5eb0ae74300f58987d235ef0e3a550df963345cb3574be3b0b54378bd11f14dfd515a8976f2c2d2826090e9507b8ccc24f896a9ffffffcabcfd996a733@3.129.120.128:31001"

Create the systemd service file /etc/systemd/system/geth-linea.service

📝

The following settings will allow your node to be accessed publicly from any machine, so update the IP address from 0.0.0.0 to your vald machine.

Terminal window
sudo tee /etc/systemd/system/geth-linea.service &>/dev/null <<EOF
[Unit]
Description=Geth node
After=online.target
[Service]
Type=simple
User=$USER
ExecStart=/usr/bin/geth \
--datadir $HOME/.linea/data \
--networkid $NETWORK_ID \
--rpc.allow-unprotected-txs \
--txpool.accountqueue 50000 \
--txpool.globalqueue 50000 \
--txpool.globalslots 50000 \
--txpool.pricelimit 1000000 \
--txpool.pricebump 1 \
--txpool.nolocals \
--http --http.addr "0.0.0.0" --http.port 8545 --http.corsdomain '*' --http.api 'web3,eth,txpool,net' --http.vhosts='*' \
--ws --ws.addr "0.0.0.0" --ws.port 8546 --ws.origins '*' --ws.api 'eth,net,web3,txpool' \
--bootnodes $BOOTNODES \
--syncmode full \
--metrics --pprof --pprof.addr "0.0.0.0" --pprof.port 9545 \
--verbosity 3
Restart=always
RestartSec=3
LimitNOFILE=4096
[Install]
WantedBy=multi-user.target
EOF

Start the service

Terminal window
sudo systemctl daemon-reload
sudo systemctl enable geth-linea
sudo systemctl restart geth-linea

Check logs

Terminal window
# change log settings to persistent if not already
sed -i 's/#Storage=auto/Storage=persistent/g' /etc/systemd/journald.conf
sudo systemctl restart systemd-journald
journalctl -u geth-linea.service -f -n 100 -o cat

Logs should appear like this

Terminal window
INFO [07-16|15:59:06.904] Imported new chain segment number=730 hash=e63dd9..478f65 blocks=128 txs=150 mgas=132.120 elapsed=205.694ms mgasps=642.312 age=1d19h51m dirty=1.04MiB
INFO [07-16|15:59:07.113] Imported new chain segment number=858 hash=f81d81..7bf36a blocks=128 txs=133 mgas=17.657 elapsed=183.688ms mgasps=96.126 age=1d16h40m dirty=1.17MiB
INFO [07-16|15:59:07.364] Imported new chain segment number=986 hash=4a154d..315f98 blocks=128 txs=204 mgas=32.286 elapsed=202.001ms mgasps=159.830 age=1d12h53m dirty=1.23MiB
INFO [07-16|15:59:07.580] Imported new chain segment number=1114 hash=92b77b..1c2b95 blocks=128 txs=178 mgas=45.001 elapsed=183.949ms mgasps=244.637 age=1d7h33m dirty=1.24MiB

Verify RPC

The Linea RPC is

Terminal window
RPC=$(curl -4 ifconfig.me):8545
Terminal window
curl -X POST $RPC -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' | jq

If you get something like this in response of the above rpc call, your node is setup correctly

{
"jsonrpc": "2.0",
"id": 1,
"result": {
"currentBlock": "0x10bcec",
"healedBytecodeBytes": "0x0",
"healedBytecodes": "0x0",
"healedTrienodeBytes": "0x0",
"healedTrienodes": "0x0",
"healingBytecode": "0x0",
"healingTrienodes": "0x0",
"highestBlock": "0x1792276",
"startingBlock": "0x1233f",
"syncedAccountBytes": "0x422a06f3",
"syncedAccounts": "0x5b14c0",
"syncedBytecodeBytes": "0x26c0e4d8",
"syncedBytecodes": "0x13cfd",
"syncedStorage": "0x38195bc",
"syncedStorageBytes": "0x2ef128d1b"
}
}

Wait for "result" to become false before using it in vald config

{ "jsonrpc": "2.0", "id": 1, "result": false }

Configure vald

In order for vald to connect to your Linea node, your rpc_addr should be exposed in vald’s config.toml

Terminal window
[[axelar_bridge_evm]] name = "linea" rpc_addr = "http://IP:PORT"
start-with-bridge = true
finality_override = "confirmation"
Terminal window
[[axelar_bridge_evm]] name = "linea" rpc_addr = "http://IP:PORT"
start-with-bridge = true
finality_override = "confirmation"

Edit on GitHub