Icon SunFilledIcon MoonStars

Icon LinkRunning a local Fuel node connected to Beta-4 using P2P

Icon LinkInstallation

Start by installing the Rust toolchain Icon Link.

Then, install the Fuel toolchain .

Make sure you have the latest version of fuelup by running the following command:

fuelup self update

Then run fuelup toolchain install beta-4 to install the beta-4 toolchain.

Finally, set the beta-4 toolchain as your default distribution with the following command:

$ fuelup default beta-4
default toolchain set to 'beta-4-aarch64-apple-darwin'

You can check your current toolchain anytime by running fuelup show to ensure you have fuel-core 0.20.4.

Icon LinkGetting a Sepolia (Ethereum Testnet) API Key

An API key from any RPC provider that supports the Sepolia network will work. Relayers will help listen to events from the Ethereum network. We recommend either Infura Icon Link or Alchemy Icon Link

The endpoints should look like the following

Icon LinkInfura

https://sepolia.infura.io/v3/{YOUR_API_KEY}

Icon LinkAlchemy

https://eth-sepolia.g.alchemy.com/v2/{YOUR_API_KEY}

Note that using other network endpoints will result in the relayer failing to start.

Icon LinkGenerating a P2P Key

Generate a new P2P key pairing by running the following command:

$ fuel-core-keygen new --key-type peering
{
  "peer_id":"16Uiu2HAm8kCaJaaKTujrSwdBxyCELTY979KYaP9YBkWVLTGTo7Bf",
  "secret":"361b3275a3dd4150ea4c786b8dff7822205331e56ac2e73c32b17cb295978c8c",
  "type":"p2p"
}

Make sure you save this somewhere safe so you don't need to generate a new key pair in the future.

Icon LinkChain Configuration

To run a local node with persistance, you must configure a chainConfig.json file. Here is the specific configuration Icon Link for beta-4:

{
  "chain_name": "Testnet Beta 4",
  "block_gas_limit": 30000000,
  "initial_state": {
    "coins": [
      {
        "owner": "0xa1184d77d0d08a064e03b2bd9f50863e88faddea4693a05ca1ee9b1732ea99b7",
        "amount": "0x1000000000000000",
        "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000"
      },
      {
        "owner": "0xb5566df884bee4e458151c2fe4082c8af38095cc442c61e0dc83a371d70d88fd",
        "amount": "0x1000000000000000",
        "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000"
      },
      {
        "owner": "0x9da7247e1d63d30d69f136f0f8654ee8340362c785b50f0a60513c7edbf5bb7c",
        "amount": "0x1000000000000000",
        "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000"
      },
      {
        "owner": "0x4b2ca966aad1a9d66994731db5138933cf61679107c3cde2a10d9594e47c084e",
        "amount": "0x1000000000000000",
        "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000"
      },
      {
        "owner": "0x26183fbe7375045250865947695dfc12500dcc43efb9102b4e8c4d3c20009dcb",
        "amount": "0x1000000000000000",
        "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000"
      },
      {
        "owner": "0x81f3a10b61828580d06cc4c7b0ed8f59b9fb618be856c55d33decd95489a1e23",
        "amount": "0x1000000000000000",
        "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000"
      },
      {
        "owner": "0x587aa0482482efea0234752d1ad9a9c438d1f34d2859b8bef2d56a432cb68e33",
        "amount": "0x1000000000000000",
        "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000"
      }
    ]
  },
  "transaction_parameters": {
    "contract_max_size": 16777216,
    "max_inputs": 255,
    "max_outputs": 255,
    "max_witnesses": 255,
    "max_gas_per_tx": 10000000,
    "max_script_length": 1048576,
    "max_script_data_length": 1048576,
    "max_storage_slots": 255,
    "max_predicate_length": 1048576,
    "max_predicate_data_length": 1048576,
    "max_gas_per_predicate": 10000000,
    "gas_price_factor": 92,
    "gas_per_byte": 4,
    "max_message_data_length": 1048576,
    "chain_id": 0
  },
  "gas_costs": {
    "add": 1,
    "addi": 1,
    "aloc": 1,
    "and": 1,
    "andi": 1,
    "bal": 13,
    "bhei": 1,
    "bhsh": 1,
    "burn": 132,
    "cb": 1,
    "cfei": 1,
    "cfsi": 1,
    "croo": 16,
    "div": 1,
    "divi": 1,
    "eck1": 951,
    "ecr1": 3000,
    "ed19": 3000,
    "eq": 1,
    "exp": 1,
    "expi": 1,
    "flag": 1,
    "gm": 1,
    "gt": 1,
    "gtf": 1,
    "ji": 1,
    "jmp": 1,
    "jne": 1,
    "jnei": 1,
    "jnzi": 1,
    "jmpf": 1,
    "jmpb": 1,
    "jnzf": 1,
    "jnzb": 1,
    "jnef": 1,
    "jneb": 1,
    "k256": 11,
    "lb": 1,
    "log": 9,
    "lt": 1,
    "lw": 1,
    "mcpi": 33,
    "mint": 135,
    "mlog": 1,
    "mod": 1,
    "modi": 1,
    "move": 1,
    "movi": 1,
    "mroo": 2,
    "mul": 1,
    "muli": 1,
    "mldv": 1,
    "noop": 1,
    "not": 1,
    "or": 1,
    "ori": 1,
    "ret_contract": 13,
    "rvrt_contract": 13,
    "s256": 2,
    "sb": 1,
    "scwq": 13,
    "sll": 1,
    "slli": 1,
    "srl": 1,
    "srli": 1,
    "srw": 12,
    "sub": 1,
    "subi": 1,
    "sw": 1,
    "sww": 43,
    "swwq": 44,
    "time": 1,
    "tr": 105,
    "tro": 60,
    "wdcm": 1,
    "wqcm": 1,
    "wdop": 1,
    "wqop": 1,
    "wdml": 1,
    "wqml": 1,
    "wddv": 1,
    "wqdv": 2,
    "wdmd": 3,
    "wqmd": 4,
    "wdam": 2,
    "wqam": 3,
    "wdmm": 3,
    "wqmm": 3,
    "xor": 1,
    "xori": 1,
    "call": {
      "base": 144,
      "dep_per_unit": 214
    },
    "ccp": {
      "base": 15,
      "dep_per_unit": 103
    },
    "csiz": {
      "base": 17,
      "dep_per_unit": 790
    },
    "ldc": {
      "base": 15,
      "dep_per_unit": 272
    },
    "logd": {
      "base": 26,
      "dep_per_unit": 64
    },
    "mcl": {
      "base": 1,
      "dep_per_unit": 3333
    },
    "mcli": {
      "base": 1,
      "dep_per_unit": 3333
    },
    "mcp": {
      "base": 1,
      "dep_per_unit": 2000
    },
    "meq": {
      "base": 1,
      "dep_per_unit": 2500
    },
    "retd_contract": {
      "base": 29,
      "dep_per_unit": 62
    },
    "smo": {
      "base": 209,
      "dep_per_unit": 55
    },
    "srwq": {
      "base": 47,
      "dep_per_unit": 5
    }
  },
  "consensus": {
    "PoA": {
      "signing_key": "f65d6448a273b531ee942c133bb91a6f904c7d7f3104cdaf6b9f7f50d3518871"
    }
  }
}

Icon LinkRunning a Local Node

Finally to put everything together to start the node, run the following command:

$ fuel-core run \
--service-name {ANY_SERVICE_NAME} \
--keypair {P2P_SECRET} \
--relayer {RPC_ENDPOINT} \
--ip 127.0.0.1 --port 4000 --peering_port 30333 \
--db-path  ~/.fuel_beta4 \
--chain ./chainConfig.json \
--utxo-validation --poa-instant false --network beta-4 --enable-p2p \
--min-gas-price 1 --max_block_size 18874368  --max_transmit_size 18874368 \
--bootstrap_nodes /dns4/p2p-beta-4.fuel.network/tcp/30333/p2p/16Uiu2HAm3xjsqASZ68KpaJPkPCMUiMgquhjyDHtxcVxVdFkMgRFf,/dns4/p2p-beta-4.fuel.network/tcp/30334/p2p/16Uiu2HAmJyoJ2HrtPRdBALMT8fs5Q25xVj57gZj5s6G6dzbHypoS \
--sync_max_get_header 100 --sync_max_get_txns 100 \
--relayer-v2-listening-contracts 0x03f2901Db5723639978deBed3aBA66d4EA03aF73 \
--relayer-da-finalization 4 \
--relayer-da-deploy-height 4111672 \
--relayer-log-page-size 10000

For the full description details of each flag above, run:

fuel-core run --help

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/graphql

Was this page helpful?