运行Testnet节点

Icon Link使用P2P运行连接到测试网的本地 Fuel 节点

Icon Link安装

要安装 Fuel 工具链,你可以使用 fuelup-init 脚本。 这将安装 forcforc-clientforc-fmtforc-lspforc-wallet 以及 fuel-core~/.fuelup/bin

curl https://install.fuel.network | sh

要运行一个 testnet 节点,您需要安装 testnet 工具链。

您可以通过运行以下命令来执行此操作。

fuelup toolchain install testnet
fuelup default testnet
Icon InfoCircle

遇到问题了吗?访问 安装指南 或在我们的 论坛 Icon Link 发帖提问。

Icon Link获取 Sepolia(以太坊测试网)API 密钥

任何支持 Sepolia 网络的 RPC 提供者的 API 密钥都可以使用。中继器将帮助监听以太坊网络的事件。我们推荐使用 Infura Icon LinkAlchemy Icon Link

端点应如下所示:

Icon LinkInfura

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

Icon LinkAlchemy

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

请注意,使用其他网络端点将导致中继器无法启动。

Icon Link生成 P2P 密钥

通过运行以下命令生成新的 P2P 密钥对:

fuel-core-keygen new --key-type peering
{
  "peer_id":"16Uiu2HAmEtVt2nZjzpXcAH7dkPcFDiL3z7haj6x78Tj659Ri8nrs",
  "secret":"b0ab3227974e06d236d265bd1077bb0522d38ead16c4326a5dff2f30edf88496",
  "type":"peering"
}
### Do not share or lose this private key! Press any key to complete. ###

确保您将其安全保存,以便将来无需生成新的密钥对。

Icon Link链配置

要运行带有持久性的本地节点,您必须拥有以下链配置文件夹:

Here is the specific configuration Icon Link

chain_config.json

{
  "chain_name": "Upgradable Testnet",
  "consensus_parameters": {
    "V1": {
      "tx_params": {
        "V1": {
          "max_inputs": 255,
          "max_outputs": 255,
          "max_witnesses": 255,
          "max_gas_per_tx": 30000000,
          "max_size": 112640,
          "max_bytecode_subsections": 256
        }
      },
      "predicate_params": {
        "V1": {
          "max_predicate_length": 102400,
          "max_predicate_data_length": 102400,
          "max_message_data_length": 102400,
          "max_gas_per_predicate": 30000000
        }
      },
      "script_params": {
        "V1": {
          "max_script_length": 102400,
          "max_script_data_length": 102400
        }
      },
      "contract_params": {
        "V1": {
          "contract_max_size": 102400,
          "max_storage_slots": 1760
        }
      },
      "fee_params": {
        "V1": {
          "gas_price_factor": 92,
          "gas_per_byte": 63
        }
      },
      "chain_id": 0,
      "gas_costs": {
        "V1": {
          "add": 2,
          "addi": 2,
          "aloc": 1,
          "and": 2,
          "andi": 2,
          "bal": 366,
          "bhei": 2,
          "bhsh": 2,
          "burn": 33949,
          "cb": 2,
          "cfei": 2,
          "cfsi": 2,
          "div": 2,
          "divi": 2,
          "eck1": 3347,
          "ecr1": 46165,
          "ed19": 4210,
          "eq": 2,
          "exp": 2,
          "expi": 2,
          "flag": 1,
          "gm": 2,
          "gt": 2,
          "gtf": 16,
          "ji": 2,
          "jmp": 2,
          "jne": 2,
          "jnei": 2,
          "jnzi": 2,
          "jmpf": 2,
          "jmpb": 2,
          "jnzf": 2,
          "jnzb": 2,
          "jnef": 2,
          "jneb": 2,
          "lb": 2,
          "log": 754,
          "lt": 2,
          "lw": 2,
          "mint": 35718,
          "mlog": 2,
          "mod": 2,
          "modi": 2,
          "move": 2,
          "movi": 2,
          "mroo": 5,
          "mul": 2,
          "muli": 2,
          "mldv": 4,
          "noop": 1,
          "not": 2,
          "or": 2,
          "ori": 2,
          "poph": 3,
          "popl": 3,
          "pshh": 4,
          "pshl": 4,
          "ret_contract": 733,
          "rvrt_contract": 722,
          "sb": 2,
          "sll": 2,
          "slli": 2,
          "srl": 2,
          "srli": 2,
          "srw": 253,
          "sub": 2,
          "subi": 2,
          "sw": 2,
          "sww": 29053,
          "time": 79,
          "tr": 46242,
          "tro": 33251,
          "wdcm": 3,
          "wqcm": 3,
          "wdop": 3,
          "wqop": 3,
          "wdml": 3,
          "wqml": 4,
          "wddv": 5,
          "wqdv": 7,
          "wdmd": 11,
          "wqmd": 18,
          "wdam": 9,
          "wqam": 12,
          "wdmm": 11,
          "wqmm": 11,
          "xor": 2,
          "xori": 2,
          "call": {
            "LightOperation": {
              "base": 21687,
              "units_per_gas": 4
            }
          },
          "ccp": {
            "LightOperation": {
              "base": 59,
              "units_per_gas": 20
            }
          },
          "croo": {
            "LightOperation": {
              "base": 1,
              "units_per_gas": 1
            }
          },
          "csiz": {
            "LightOperation": {
              "base": 59,
              "units_per_gas": 195
            }
          },
          "k256": {
            "LightOperation": {
              "base": 282,
              "units_per_gas": 3
            }
          },
          "ldc": {
            "LightOperation": {
              "base": 45,
              "units_per_gas": 65
            }
          },
          "logd": {
            "LightOperation": {
              "base": 1134,
              "units_per_gas": 2
            }
          },
          "mcl": {
            "LightOperation": {
              "base": 3,
              "units_per_gas": 523
            }
          },
          "mcli": {
            "LightOperation": {
              "base": 3,
              "units_per_gas": 526
            }
          },
          "mcp": {
            "LightOperation": {
              "base": 3,
              "units_per_gas": 448
            }
          },
          "mcpi": {
            "LightOperation": {
              "base": 7,
              "units_per_gas": 585
            }
          },
          "meq": {
            "LightOperation": {
              "base": 11,
              "units_per_gas": 1097
            }
          },
          "retd_contract": {
            "LightOperation": {
              "base": 1086,
              "units_per_gas": 2
            }
          },
          "s256": {
            "LightOperation": {
              "base": 45,
              "units_per_gas": 3
            }
          },
          "scwq": {
            "HeavyOperation": {
              "base": 30375,
              "gas_per_unit": 28628
            }
          },
          "smo": {
            "LightOperation": {
              "base": 64196,
              "units_per_gas": 1
            }
          },
          "srwq": {
            "HeavyOperation": {
              "base": 262,
              "gas_per_unit": 249
            }
          },
          "swwq": {
            "HeavyOperation": {
              "base": 28484,
              "gas_per_unit": 26613
            }
          },
          "contract_root": {
            "LightOperation": {
              "base": 45,
              "units_per_gas": 1
            }
          },
          "state_root": {
            "HeavyOperation": {
              "base": 350,
              "gas_per_unit": 176
            }
          },
          "new_storage_per_byte": 63,
          "vm_initialization": {
            "LightOperation": {
              "base": 1645,
              "units_per_gas": 14
            }
          }
        }
      },
      "base_asset_id": "0000000000000000000000000000000000000000000000000000000000000000",
      "block_gas_limit": 30000000,
      "privileged_address": "0000000000000000000000000000000000000000000000000000000000000000"
    }
  },
  "consensus": {
    "PoA": {
      "signing_key": "f65d6448a273b531ee942c133bb91a6f904c7d7f3104cdaf6b9f7f50d3518871"
    }
  }
}

metadata.json

{
  "chain_config": "chain_config.json",
  "table_encoding": {
    "Json": {
      "filepath": "state_config.json"
    }
  }
}

state_config.json

{
  "coins": [],
  "messages": [],
  "contracts": [
    {
      "contract_id": "7777777777777777777777777777777777777777777777777777777777777777",
      "code": "9000000994318e6e453f30e85bf6088f7161d44e57b86a6af0c955d22b353f91b2465f5e6140000a504d00205d4d30001a4860004945048076440001240400005050c0043d51345024040000",
      "tx_id": "0000000000000000000000000000000000000000000000000000000000000000",
      "output_index": 0,
      "tx_pointer_block_height": 0,
      "tx_pointer_tx_idx": 0,
      "states": [],
      "balances": []
    }
  ],
  "last_block": null
}

state_transition_bytecode.wasm

Which is too large to display on this page, but you can find it here Icon Link

Icon Link运行本地节点

最后,将所有内容放在一起以启动节点,运行以下命令:

fuel-core run \
--service-name {ANY_SERVICE_NAME} \
--keypair {P2P_SECRET} \
--relayer {ETH_RPC_ENDPOINT} \
--ip 0.0.0.0 --port 4000 --peering-port 30333 \
--db-path  ~/.testnet \
--snapshot ./your/path/to/chain_config_folder \
--utxo-validation --poa-instant false --enable-p2p \
--min-gas-price 1 --max-block-size 18874368  --max-transmit-size 18874368 \
--reserved-nodes /dns4/p2p-devnet.fuel.network/tcp/30333/p2p/16Uiu2HAm6pmJUedRFjennk4A8yWL6zCApHCuykzRRroqMjjxZ8o6,/dns4/p2p-devnet.fuel.network/tcp/30334/p2p/16Uiu2HAm8dBwTRzqazCMqQDdR8thMa7BKiW4ep2B4DoQQp6Qhyfd  \
--sync-header-batch-size 100 \
--enable-relayer \
--relayer-v2-listening-contracts 0x01855B78C1f8868DE70e84507ec735983bf262dA \
--relayer-da-deploy-height 5827607 \
--relayer-log-page-size 2000

要查看上述每个标志的完整描述详细信息,请运行:

fuel-core run --help

Icon Link从浏览器钱包连接到本地节点

要使用浏览器钱包连接到本地节点,请导入网络地址:

http://0.0.0.0:4000/graphql