Running a Node on Fuel Network

Step-by-step guide to setting up and running a local node on the Fuel blockchain

Cumulo
Cumulo.pro
6 min readJun 13, 2024

--

Table of Contents

· Introduction
What is a Fuel Node?
Consensus Mechanism
Hardware requirements
· Node installation
Prepare the environment
Install Fuel toolchain
Obtaining a Sepolia API key (Ethereum Testnet)
Generate a new P2P key
Chain configuration
Init the node
Creating a service with SystenD
Connect your node to the Fuel wallet

Introduction

What is a Fuel Node?

A node on the Fuel blockchain, or “client”, is software that downloads and maintains a copy of the blockchain. It verifies the authenticity of each block and transaction, ensuring that its copy is always up-to-date and synchronised with the network.

Consensus Mechanism

Fuel Network uses Proof of Authority (PoA) in its beta testnets.

  • Validators: Entities selected for their reputation, responsible for creating blocks and validating transactions.
  • Advantages of PoA: Fast transaction times and energy efficiency.

Hardware requirements

Node installation

Prepare the environment

  • Upgrade packages.
sudo apt-get update && sudo apt-get upgrade –y
  • Install wget and curl.
sudo apt install wget curl
  • Install rustup.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs/ | sh
  • Configure your current shell. You need to create the corresponding env file in HOME/.cargo
. "$HOME/.cargo/env"
  • Check the version of rustup.
rustup --version

Install Fuel toolchain

You can use the fuelup-init script provided by the team. This will install forc, forc-client, forc-fmt, forc-lsp, forc-wallet as well as fuel-core in the ~/.fuelup/bin folder.

curl https://install.fuel.network | sh
  • To use fuelup use.
source /home/(user)/.bashrc
  • Check the version of Fuel installed.
fuelup --version

The beta-5 network is the latest Fuel testnet. It includes public infrastructures such as beta-5 faucet Icon Link andbeta-5 graphQL playgroundIcon.

To interact correctly with the beta-5 network it is necessary to use the latest toolchain which is installed by default.

  • Run the following command to verify the installation of the latest toolchain.
fuelup show

Obtaining a Sepolia API key (Ethereum Testnet)

The next step is to obtain an API key from any RPC provider that supports the Sepolia network. Relayers will help to listen for events on the Ethereum network. Some examples of where to get this API key are Infura or Alchemy.

  • Select the Free plan.
  • Click on the button “Create new app”.
  • Test the API by sending the first request.
  • Copy the CLI command and use it on your server.
curl https://eth-mainnet.g.alchemy.com/v2/AvlIDj-8eJlcz2NfOK1iMbR5iK1MnAtO -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"alchemy_getAssetTransfers","params":[{"fromBlock": "0x0","category": ["external","erc20","erc721"],"fromAddress": "0x994b342dd87fc825f66e51ffa3ef71ad818b6893"}],"id":0}'

Once the process is filanised you will have access to your dapp in the dashboar and to the generated API.

ETH RPC API: The endpoints must look like this:

https://eth-sepolia.g.alchemy.com/v2/AvlIDj-8eJlcz2NfOK1iMbR5iK1MnAtO
{"message":"Method Not Allowed","logref":null,"path":null,"_embedded":{"errors":[{"message":"Method [GET] not allowed for URI [/v2/AvlIDj-8eJlcz2NfOK1iMbR5iK1MnAtO]. Allowed methods: [POST]","logref":null,"path":null,"_embedded":{},"_links":{}}]},"_links":{"self":{"href":"/v2/AvlIDj-8eJlcz2NfOK1iMbR5iK1MnAtO","templated":false,"profile":null,"deprecation":null,"title":null,"hreflang":null,"type":null,"name":null}}}

Generate a new P2P key

  • Run.
fuel-core-keygen new --key-type peering

Chain configuration

To run a local node with persistence, you must have a folder with the following chain configuration files.

  • Create the folder and download the repository.
git clone https://github.com/FuelLabs/chain-configuration chain-configuration
mkdir .fuel-sepolia-testnet
cp -r chain-configuration/ignition/* ~/.fuel-sepolia-testnet/

Init the node

  • Start the node
fuel-core run \
--service-name=<your_node>-sepolia-testnet-node \
--keypair <P2P key> \
--relayer https://eth-sepolia.g.alchemy.com/v2/<ETH RPC API> \
--ip=0.0.0.0 --port=4000 --peering-port=30333 \
--db-path ~/.fuel-sepolia-testnet \
--snapshot ~/.fuel-sepolia-testnet \
--utxo-validation --poa-instant false --enable-p2p \
--reserved-nodes /dns4/p2p-testnet.fuel.network/tcp/30333/p2p/16Uiu2HAmDxoChB7AheKNvCVpD4PHJwuDGn8rifMBEHmEynGHvHrf \
--sync-header-batch-size 100 \
--enable-relayer \
--relayer-v2-listening-contracts=0x01855B78C1f8868DE70e84507ec735983bf262dA \
--relayer-da-deploy-height=5827607 \
--relayer-log-page-size=500 \
--sync-block-stream-buffer-size 30

Congratulations, your Fuel node is up and running!

Creating a service with SystenD

SystemD facilitates automatic and reliable management of the Fuel node, improving operational stability and efficiency.

  • Automation: SystemD allows you to automatically start the Fuel node at system start-up, ensuring that it is always up and running.
  • Supervision: Monitors the status of the node and restarts the service if it fails, guaranteeing continuous and reliable operation.
  • Create the service.
sudo tee /etc/systemd/system/fueld.service > /dev/null << EOF
[Unit]
Description=Fuel Node Sepolia
After=network.target

[Service]
User=$USER
Type=simple
ExecStart=$(which fuel-core run) \
--service-name cumulofuel-sepolia-testnet \
--keypair <P2P key> \
--relayer https://eth-sepolia.g.alchemy.com/v2/<ETH RPC API> \
--ip=0.0.0.0 --port=5000 --peering-port=40444 \
--db-path $HOME/.fuel-sepolia-testnet \
--snapshot $HOME/.fuel-sepolia-testnet \
--utxo-validation --poa-instant false --enable-p2p \
--reserved-nodes /dns4/p2p-testnet.fuel.network/tcp/30333/p2p/16Uiu2HAmDxoChB7AheKNvCVpD4PHJwuDGn8rifMBEHmEynGHvHrf \
--sync-header-batch-size 100 \
--enable-relayer \
--relayer-v2-listening-contracts=0x01855B78C1f8868DE70e84507ec735983bf262dA \
--relayer-da-deploy-height=5827607 \
--relayer-log-page-size=500 \
--sync-block-stream-buffer-size 30

Restart=on-failure
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target
EOF
  • Reloads the SystemD configuration, enables the Fuel node for automatic start, starts the service and displays its current status.
sudo systemctl daemon-reload
sudo systemctl enable fueld
sudo systemctl start fueld
sudo systemctl status fueld.service
  • To view the logs run.
sudo journalctl -u fueld -f -o cat

Connect your node to the Fuel wallet

Log in to your Fuel wallet account and click on the top part where it indicates the network, click on +Add new network and type in the address of your node:

http://ip_node:4000/v1/graphql

Click on +Add

Sources:

--

--