Icon HelpCircleForumIcon Link

⌘K

Icon HelpCircleForumIcon Link
Running a Local Node

Icon LinkRunning a local Fuel node

In addition to deploying and testing on the Fuel Testnet, you can also run a local Fuel Node.

There are two types of Fuel networks that can be run:

  1. In-memory network (without persistence)
  2. Local network with persistence

Icon LinkIn-memory local node (without state persistence)

An in-memory node does not persist the blockchain state anywhere, it is only stored in memory as long as the node is active and running.

First ensure your environments open files limit Icon Link ulimit is increased, example:

ulimit -S -n 32768

After ensuring your file limit is increased, to spin-up a local in-memory Fuel node download or copy the local snapshot from here Icon Link, then run the following command:

fuel-core run --db-type in-memory --debug --snapshot ./your/path/to/chain_config_folder

To deploy a contract to the local node, run the following command:

forc deploy <signing-key> --node-url 127.0.0.1:4000/v1/graphql

Or to deploy with the default signer that is pre-funded by fuel-core:

forc deploy --default-signer --node-url 127.0.0.1:4000/v1/graphql

Icon LinkChain Configuration

To modify the initial state of the chain, you must configure the state_config.json file in your chain configuration folder. Here is an example of what that looks like using version 0.35.0 of fuel-core:

For simplicity, clone the repository Icon Link into the directory of your choice.

When using the --snapshot flag later, you can replace ./your/path/to/chain_config_folder with the local folder of the repository you just cloned ./chain-configuration/local/.

To start the node with a custom configuration, you can use the command below:

fuel-core run --snapshot ./your/path/to/chain_config_folder --db-type in-memory --debug

To find an example local chain configuration folder for a specific fuel-core version, refer to the chain-configuration/local Icon Link repo.

Icon LinkFunding a wallet locally

You can edit the coins array inside state_config.json to modify the initial assets owned by a given address.

The owner address must be a B256 type address (begins with 0x) instead of a Bech32 type (begins with fuel).

The amount is a numerical value. In the example below, the value translates to 1 ETH.

"coins": [
  {
    "tx_id": "0x0000000000000000000000000000000000000000000000000000000000000001",
    "output_index": 0,
    "tx_pointer_block_height": 0,
    "tx_pointer_tx_idx": 0,
    "owner": "0x488284d46414347c78221d3bad71dfebcff61ab2ae26d71129701d50796f714d",
    "amount": 1000000000,
    "asset_id": "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"
  }
]

Icon LinkLocal node (with state persistence)

This node does persist the blockchain state locally. To run a local node with persistence a chain configuration file is required.

To start the node, run the following command:

fuel-core run --ip 127.0.0.1 --port 4000 --snapshot ./your/path/to/chain_config_folder --db-path ./.fueldb --debug

Icon LinkConnecting to the local node from a browser wallet

To connect to the local node using a browser wallet, import the network address as:

http://127.0.0.1:4000/v1/graphql