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:
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.
To spin-up a local in-memory Fuel node, run the following command:
fuel-core run --db-type in-memory --debug
To deploy a contract to the local node, run the following command:
forc deploy <signing-key> --node-url 127.0.0.1:4000/graphql
Or to deploy without using a signing key:
forc deploy --unsigned --node-url 127.0.0.1:4000/graphql
To modify the initial state of the chain, you must configure a chainConfig.json
file.
Here is an example of what that looks like using version 0.26.0
of fuel-core
:
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 chain configuration file for a specific fuel-core
version, refer to the fuel-core
repo.
You can edit the coins
array inside the inital_state
object 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 hex value. In this example, the value translates to 1,125,899.9 ETH
.
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
To connect to the local node using a browser wallet, import the network address as:
http://127.0.0.1:4000/graphql