6.3 运行一个本地Fuel节点 (Running a local Fuel node)

In addition to deploying and testing on the Fuel Testnet, you can also run a local Fuel Node. 除了在 Fuel 测试网上进行部署和测试外,您还可以运行本地 Fuel 节点。

There are two types of Fuel networks that can be run: 可以运行两种类型的 Fuel 网络:

  1. In-memory network (without persistance) 内存网络(非持久化)

  2. Local network with persistance 具有持久性的本地网络

内存本地节点(非状态持久化)-In-memory local node (without state persistance)

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 节点,请运行以下命令:

fuel-core run --db-type in-memory

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

要将合约部署到本地节点,请运行以下命令:

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

Or to deploy without using a signing key:

或者不使用签名密钥进行部署:

forc deploy --unsigned --url 127.0.0.1:4000/graphql

本地节点(状态持久化)Local node (with state persistance)

This node does persist the blockchain state locally.

该节点确实在本地保留区块链状态。

To run a local node with persistance, you must configure a chainConfig.json file. Here is an example of what that looks like:

要持久运行本地节点,您必须配置一个 chainConfig.json 文件。这是一个看起来像的例子:

To start the node, run the following command:

要启动节点,请运行以下命令:

从浏览器钱包连接到本地节点 (Connecting to the local node from a browser wallet)

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

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

Last updated