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.
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
- Mainnet
- Testnet
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.
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.
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
- Mainnet
- Testnet
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
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
.
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
β
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
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
.
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-uat-data init ./genesis.json
Step 5β
Start the node with the following command
geth \
--datadir $HOME/geth-uat-data \
--networkid 59140 \
--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 'web3,eth,txpool,net' \
--bootnodes "enode://c7d29d1bbb768e73c6bd320608276dc2341670822ed1292456a7b8375de35b5348e3b6bac63783a53d697378b25c5658681683f7621e31b37c605993c5ee13bd@18.189.141.200:30303,enode://14ba040dd8c5b1ea607fabf98c3c7c398658f897c502d0ca5202dce8907e83be953995ce5c3f72def2af710c072fe38de4e9347a299370fc82d6d17819967c93@3.144.118.88: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-testnet.service
[Unit]
Description=Linea Testnet 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 59140 \
--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 'web3,eth,txpool,net' \
--bootnodes "enode://c7d29d1bbb768e73c6bd320608276dc2341670822ed1292456a7b8375de35b5348e3b6bac63783a53d697378b25c5658681683f7621e31b37c605993c5ee13bd@18.189.141.200:30303,enode://14ba040dd8c5b1ea607fabf98c3c7c398658f897c502d0ca5202dce8907e83be953995ce5c3f72def2af710c072fe38de4e9347a299370fc82d6d17819967c93@3.144.118.88:30303" \
--syncmode full \
--metrics \
--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-testnet.service
Start the node (this will run in the background)
sudo systemctl start linea-testnet.service
View logs
journalctl -f -u linea-testnet.service -o cat
Stop the node if needed
sudo systemctl stop linea-testnet.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.