Skip to main content

Run a Linea Node

Interested in running a Linea node yourself? Of course you are.​

Running your own Linea node does not have any financial incentives, but does offer the following benefits:

  • You can submit transactions to the mempool without relying on an RPC provider
  • You receive a local copy of the Linea database. This view of the state is "trusted" until the block/transaction has been finalized on L1

If you're unfamiliar with how public blockchain networks share the responsibility of keeping common resources secure, check out this explainer from MetaMask.

note

Running a sequencer node is currently not possible and there is no option to vote on blocks as part of the consensus/fork-choice like on Ethereum. The Ethereum client being used in this walkthrough (Geth) will soon be updated, including breaking changes. Please get in touch to make sure we keep you posted if you decide to run a node. ** You can run a Dockerized version as long as you keep the same parameters.**

How to run a Linea node with Docker

Step 1​

Download and install Docker

Step 2​

Download docker-compose.yml and genesis.json

Step 3​

Open up a terminal where the both docker-compose.yml and genesis.json are located (they should be in the same directory) and run docker compose up

The node should now be running and looking for peers to sync.

note

The docker-compose.yml has besu configurations that won't be running and shouldn't affect your node. If you see anything related to besu in your logs, it can be ignored.

How to run a Linea node

Prerequisites​

Set up the required and recommended hardware and all the utilities. You can find the recommendations from Geth here

Step 1​

Download v1.11.6 Geth (latest untested) and install using the instructions provided here

Step 2​

Download genesis.json

genesis.json

Step 3​

Define a volume of at least 100GB, more if you want to future-proof your node, and mount the Geth datadir to geth-linea-data.

note

As indicated in the linked resources in Step 1, blockchain clients like Geth can take up a lot of disk space. By defining the amount of disk space you're willing to dedicate to your client (and the block data that it will be syncing), you can ensure that you still have enough room on your disk for whatever else you need.

If you run out of space, or need to actively maintain how much space is being used, consider pruning.

How to create a custom volume​

Ubuntu
  • Open Terminal
  • Use the df -h command to check the available disk space
  • Decide on the maximum size you want for the volume, for example 100GB
  • Use fallocate to create a file of the desired size, e.g. fallocate -l 100G myfile.img
  • Use mkfs.ext4 to format the file as an ext4 filesystem. e.g. mkfs.ext4 myfile.img
  • Mount the file using mount, e.g. mount -o loop myfile.img /mnt/myvolume
  • The contents will now be available in /mnt/myvolume, up to a maximum of 100GB
MacOS
  • Open Terminal
  • Use the df -h command to check the available disk space
  • Decide on the maximum size you want for the volume, for example 100GB
  • Use hdiutil to create a sparse image of the desired size, e.g. hdiutil create -size 100g -type SPARSE -fs HFS+X myfile.dmg
  • Mount the image using hdiutil, e.g. hdiutil attach myfile.dmg
  • The contents will now be available mounted under /Volumes, up to a maximum of 100GB
Windows
Without Windows Subsystem Linux
  • Open Command Prompt as Administrator
  • Use the dir command to check available disk space on the volume you want to create the disk image
  • Decide on the maximum size for the volume, for example 100GB
  • Use the fsutil command to create a sparse file of the desired size, e.g. fsutil file createnew myfile.img 107374182400 (for a 100GB file)
  • Initialize the disk image using diskpart:
    • diskpart
    • select vdisk file="myfile.img"
    • create vdisk maximum=100000
    • attach vdisk
    • exit
  • Format the volume using format, e.g. format F: /FS:NTFS /A:64K /Q
  • The new volume will now be available as drive letter F:, up to the maximum 100GB size

To mount an existing disk image:

  • Open Command Prompt as Administrator
  • Use diskpart
    • select vdisk file="myfile.img"
    • attach vdisk
  • The disk image will be mounted and accessible under the assigned drive letter
With Windows Subsystem Linux
  • Open WSL
  • Use the df -h command to check the available disk space
  • Decide on the maximum size you want for the volume, for example 100GB
  • Use fallocate to create a file of the desired size, e.g. fallocate -l 100G myfile.img
  • Use mkfs.ext4 to format the file as an ext4 filesystem. e.g. mkfs.ext4 myfile.img
  • Mount the file using mount, e.g. mount -o loop myfile.img /mnt/myvolume
  • The contents will now be available in /mnt/myvolume, up to a maximum of 100GB

Step 4​

Bootstrap the node using the following command

geth --datadir ./geth-linea-data init ./genesis.json

Step 5​

Start the node with the following command

geth \
--datadir $HOME/geth-linea-data \
--networkid 59144 \
--rpc.allow-unprotected-txs \
--txpool.accountqueue 50000 \
--txpool.globalqueue 50000 \
--txpool.globalslots 50000 \
--txpool.pricelimit 1000000 \
--txpool.pricebump 1 \
--txpool.nolocals \
--http --http.addr '127.0.0.1' --http.port 8545 --http.corsdomain '*' --http.api 'web3,eth,txpool,net' --http.vhosts='*' \
--ws --ws.addr '127.0.0.1' --ws.port 8546 --ws.origins '*' --ws.api 'web3,eth,txpool,net' \
--bootnodes "enode://ca2f06aa93728e2883ff02b0c2076329e475fe667a48035b4f77711ea41a73cf6cb2ff232804c49538ad77794185d83295b57ddd2be79eefc50a9dd5c48bbb2e@3.23.106.165:30303,enode://eef91d714494a1ceb6e06e5ce96fe5d7d25d3701b2d2e68c042b33d5fa0e4bf134116e06947b3f40b0f22db08f104504dd2e5c790d8bcbb6bfb1b7f4f85313ec@3.133.179.213:30303,enode://cfd472842582c422c7c98b0f2d04c6bf21d1afb2c767f72b032f7ea89c03a7abdaf4855b7cb2dc9ae7509836064ba8d817572cf7421ba106ac87857836fa1d1b@3.145.12.13:30303" \
--syncmode full \
--metrics \
--verbosity 3

Step 6​

Setup Linea as a Serivce

Create a new service file:

sudo tee <<EOF >/dev/null /etc/systemd/system/linea.service
[Unit]
Description=Linea Node
Wants=network-online.target
After=network-online.target

[Service]
User=$USER # the user you want to run the node with
Type=simple
Restart=on-failure
RestartSec=3

ExecStart=/usr/bin/geth \ # mkare sure the path to the geth binary is correct
--datadir /home/$USER/geth-linea-data \ # the path to the data dir of your node
--networkid 59144 \
--miner.gasprice 1000000000 \
--miner.gaslimit '0x3A2C940' \
--rpc.allow-unprotected-txs \
--txpool.accountqueue 50000 \
--txpool.globalqueue 50000 \
--txpool.globalslots 50000 \
--txpool.pricelimit 1000000000 \
--rpc.txfeecap 100 \
--gpo.maxprice 100000000000000 \
--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 "enode://ca2f06aa93728e2883ff02b0c2076329e475fe667a48035b4f77711ea41a73cf6cb2ff232804c49538ad77794185d83295b57ddd2be79eefc50a9dd5c48bbb2e@3.128.49.168:30303" \
--syncmode full \
--metrics --pprof --pprof.addr "127.0.0.1" --pprof.port 9545 \
--verbosity 3

[Install]
WantedBy=multi-user.target

EOF

Update the systemd daemon

sudo systemctl daemon-reload

Enable the service to run automatically at startup (optional)

sudo systemctl enable linea.service

Start the node (this will run in the background)

sudo systemctl start linea.service

View logs

journalctl -f -u linea.service -o cat

Stop the node if needed

sudo systemctl stop linea.service

​


The Linea network only produces blocks if there is currently at least 1 pending transaction. If you see no incoming blocks to your node, that does not mean that the node is not syncing.

If you don't see any incoming blocks, check and make sure that you have at least one peer from the bootnodes below; otherwise, you might not be connected to the Linea network.