Fuel手册-更新中 (The Fuel Book)-updating
  • 0.Fuel手册 (The Fuel Book)
  • 1. 开发者快速上手 (Developer Quickstart)
    • 1.1构建智能合约 (Building A Smart Contract)
    • 1.2 构建前端 (Building a Frontend)
  • 2.准备开始 (Getting Started)
    • 2.1为什么是Fuel (Why Fuel)
    • 2.2Fuel是什么? (What is Fuel?)
      • 2.2.1 Fuel工具链 (The Fuel Toolchain)
    • 2.3 模块化运动 (Modular Movement)
      • 2.3.1 单片架构 (Monolithic Architecture)
      • 2.3.4 什么是模块化执行层 (What is a Modular Execution Layer)
    • 2.4 Fuel设置 (Fuel Configurations)
      • 2.4.1 作为汇总的Fuel (Fuel as a roll-up)
      • 2.4.2 作为L1的Fuel (Fuel as an L1)
      • 2.4.3 作为状态通道的Fuel (Fuel as a state channel)
      • 2.4.4 作为侧链的Fuel (Fuel as a sidechain)
  • 3. 技术 (Technology)
    • 3.1 并行交易执行(Parallel Transaction Execution)
    • 3.2欺诈证明 (Fraud Proofs)
  • 4. Fuel虚拟机 (The FuelVM)
    • 4.1合约和调用模型(Contract and Call Model)
    • 4.2内存模式 (Memory Mode)
    • 4.3多重原生资产(Multiple Native Assets)
    • 4.4FuelVM和EVM, 轻松搞明白(FuelVM vs. EVM, Explained)
  • 5.Sway语言 (Sway Language)
    • 5.1 Sway设计哲学 (Sway Design Philosophy)
    • 5.2 Sway的安全性 (Sway Safety)
  • 6.开发者看这里(For Developers)
    • 6.1Sway程序示例 (Sway Application Examples)
    • 6.2 网络 (Networks)
      • 6.2.1 `beta-3`测试网 (The `beta-3` testnet)
      • 6.2.2 `beta-2`测试网 (The `beta-2` testnet)
      • 6.2.3 `beta-1` 测试网 (beta-1 testnet)
    • 6.3 运行一个本地Fuel节点 (Running a local Fuel node)
    • 6.4 Sway语言 (Sway Language) 🌴
    • 6.5 Typescript SDK
    • 6.6 Rust SDK
    • 6.7 Fuel索引器 (Fuel Indexer)
    • 6.8 水龙头和区块浏览器 (Faucet and Block Explorer)
    • 6.9 Fuelup
    • 6.10 Fuel GraphQL API
  • 7. Fuel术语 (Fuel Glossary)
Powered by GitBook
On this page
  • 内存本地节点(非状态持久化)-In-memory local node (without state persistance)
  • 本地节点(状态持久化)Local node (with state persistance)
  • 从浏览器钱包连接到本地节点 (Connecting to the local node from a browser wallet)
  1. 6.开发者看这里(For Developers)

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 文件。这是一个看起来像的例子:

{
    "chain_name": "local_testnet",
    "block_production": {
      "ProofOfAuthority": {
        "trigger": "instant"
      }
    },
    "parent_network": {
      "type": "LocalTest"
    },
    "block_gas_limit": 1000000000,
    "initial_state": {
      "coins": [
        {
          "owner": "0x94ffcc53b892684acefaebc8a3d4a595e528a8cf664eeb3ef36f1020b0809d0d",
          "amount": "0xFFFFFFFFFFFFFFFF",
          "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000"
        },
        {
          "owner": "0x80d5e88c2b23ec2be6b2e76f3499a1a2755bb2773363785111a719513fb57b8e",
          "amount": "0x00000000FFFFFFFF",
          "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000"
        },
        {
          "owner": "0xf13c949256d0e119fecaec414ea452f21f9dc1870fb6262ff53b37c32cab4749",
          "amount": "0x00000000FFFFFFFF",
          "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000"
        }
      ]
    },
    "transaction_parameters": {
      "contract_max_size": 16777216,
      "max_inputs": 255,
      "max_outputs": 255,
      "max_witnesses": 255,
      "max_gas_per_tx": 100000000,
      "max_script_length": 1048576,
      "max_script_data_length": 1048576,
      "max_static_contracts": 255,
      "max_storage_slots": 255,
      "max_predicate_length": 1048576,
      "max_predicate_data_length": 1048576,
      "gas_price_factor": 1000000000,
      "gas_per_byte": 4,
      "max_message_data_length": 1048576
    },
    "block_producer": {
      "utxo_validation": true,
      "coinbase_recipient": "0x0000000000000000000000000000000000000000000000000000000000000000"
    },
    "consensus": {
      "PoA": {
        "signing_key": "0x22ec92c3105c942a6640bdc4e4907286ec4728e8cfc0d8ac59aad4d8e1ccaefb"
      }
    }
  }

To start the node, run the following command:

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

fuel-core run --ip 127.0.0.1 --port 4000 --chain ./chainConfig.json --db-path ./.fueldb

从浏览器钱包连接到本地节点 (Connecting 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
Previous6.2.3 `beta-1` 测试网 (beta-1 testnet)Next6.4 Sway语言 (Sway Language) 🌴

Last updated 2 years ago