fuel-core README

The project's README from github.com/FuelLabs/fuel-core. As one markdown file: README.md.

Fuel Client

build deepwiki crates.io docs discord twitter

Fuel client implementation.

Versions currently used in networks

Network Version
Fuel Ignition 0.48.1
Testnet 0.48.1
Devnet 0.48.1

Contributing

If you are interested in contributing to Fuel, see our CONTRIBUTING.md guidelines for coding standards and review process.

Before pushing any changes or creating pull request please run source ci_checks.sh.

Building

If you plan to use already pre-compiled binaries you can directly go to Running a Ignition node.

System Requirements

There are several system requirements including clang.

MacOS

brew update
brew install cmake

Debian

apt update
apt install -y cmake pkg-config build-essential git clang libclang-dev

Arch

pacman -Syu --needed --noconfirm cmake gcc pkgconf git clang

Rust setup

You'll need wasm32-unknown-unknown target installed.

rustup target add wasm32-unknown-unknown

Running a Ignition node

If you want to participate in the Ignition network with your own node you can launch it following these simple commands.

From pre-compiled binaries

Follow : https://docs.fuel.network/docs/node-operator/fuel-ignition/mainnet-node/

From source

Clone the fuel-core repository :

git clone https://github.com/FuelLabs/fuel-core.git

Go to the latest release tag for ignition on the fuel-core repository :

git checkout v0.45.1

Build your node binary:

make build

To run the node follow : https://docs.fuel.network/docs/node-operator/fuel-ignition/mainnet-node/

Running a Local network from source

Clone the fuel-core repository :

git clone https://github.com/FuelLabs/fuel-core.git

Build your node binary:

make build

To run the node follow : https://docs.fuel.network/docs/node-operator/fuel-ignition/local-node/

Setup to make contributions

Compiling

We recommend using xtask to build fuel-core for development:

cargo xtask build

This will run cargo build as well as any other custom build processes we have such as re-generating a GraphQL schema for the client.

Testing

The ci_checks.sh script file can be used to run all CI checks, including the running of tests.

source ci_checks.sh

The script requires pre-installed tools. For more information run:

cat ci_checks.sh

Running

The service can be launched by executing fuel-core run. The list of options for running can be accessed via the help option:

$ ./target/debug/fuel-core run --help

USAGE:
    fuel-core run [OPTIONS]

OPTIONS:
        --snapshot <SNAPSHOT>
          Snapshot from which to do (re)genesis. Defaults to local testnet configuration

          [env: SNAPSHOT=]
        ...

For many development purposes it is useful to have a state that won't persist and the db-type option can be set to in-memory as in the following example.

Example

$ ./target/debug/fuel-core run --db-type in-memory
2023-06-13T12:45:22.860536Z  INFO fuel_core::cli::run: 230: Block production mode: Instant
2023-06-13T12:38:47.059783Z  INFO fuel_core::cli::run: 310: Fuel Core version v0.18.1
2023-06-13T12:38:47.078969Z  INFO new{name=fuel-core}:_commit_result{block_id=b1807ca9f2eec7e459b866ecf69b68679fc6b205a9a85c16bd4943d1bfc6fb2a height=0 tx_status=[]}: fuel_core_importer::importer: 231: Committed block
2023-06-13T12:38:47.097777Z  INFO new{name=fuel-core}: fuel_core::graphql_api::service: 208: Binding GraphQL provider to 127.0.0.1:4000

To disable block production on your local node, set --poa-instant=false

Example

$ ./target/debug/fuel-core run --poa-instant=false
2023-06-13T12:44:12.857763Z  INFO fuel_core::cli::run: 232: Block production disabled

Troubleshooting

Publishing

We use publish-crates action for automatic publishing of all crates.

If you have problems with publishing, you can troubleshoot it locally with act.

act release -s GITHUB_TOKEN=<YOUR_GITHUB_TOKEN> -j publish-crates-check --container-architecture linux/amd64 --reuse

It requires GitHubToken to do request to the GitHub. You can create it with this instruction.

Outdated database

If you encounter an error such as

thread 'main' panicked at 'unable to open database: DatabaseError(Error { message: "Invalid argument: Column families not opened: column-11, column-10, column-9, column-8, column-7, column-6, column-5, column-4, column-3, column-2, column-1, column-0" })', fuel-core/src/main.rs:23:66

Clear your local database using: rm -rf ~/.fuel/db

File descriptor limits

On some macOS versions the default file descriptor limit is quite low, which can lead to IO errors with messages like Too many open files or even fatal runtime error: Rust cannot catch foreign exceptions when RocksDB encounters these issues. Use the following command to increase the open file limit. Note that this only affects the current shell session, so consider adding it to ~/.zshrc.

ulimit -n 10240

Log level

The service relies on the environment variable RUST_LOG. For more information, check the EnvFilter examples crate.

Human logging can be disabled with the environment variable HUMAN_LOGGING=false

Debugging

See the guide on debugging for an overview on running a debug build of a local node.

Docker & Kubernetes

# Create Docker Image
docker build -t fuel-core . -f deployment/Dockerfile

# Delete Docker Image
docker image rm fuel-core

# Create Kubernetes Volume, Deployment & Service
kubectl create -f deployment/fuel-core.yml

# Delete Kubernetes Volume, Deployment & Service
kubectl delete -f deployment/fuel-core.yml

GraphQL service

The client functionality is available through a service endpoint that expect GraphQL queries.

Transaction executor

The transaction executor currently performs instant block production. Changes are persisted to RocksDB by default.

The service expects a mutation defined as submit that receives a Transaction in hex encoded binary format, as specified here.

fuel-core (FuelLabs/fuel-core)

Searching Database…

56.8K ·GitHub
这是什么?Fuel-core 是 Fuel v2 区块链协议完整节点的官方 Rust 实现,用于运行和参与 Fuel 网络,例如 Ignition、Testnet 和 Devnet。
这是我要导入的库,还是我要运行的独立节点?它是一个独立的节点服务,不是库。你需要构建或下载二进制文件并运行它,它会提供一个 GraphQL 端点,用于提交和查询交易。
我该怎么把节点运行起来?克隆 fuel-core 代码仓库,切换到你想连接的网络对应的发布标签(例如 Ignition),构建二进制文件,然后用 fuel-core run 启动。如果不想从源码构建,也可以直接使用预编译的二进制文件。
构建之前需要先安装什么?你需要安装 Rust 工具链并添加 wasm32-unknown-unknown 目标,还需要 clang 等平台构建工具(macOS、Debian 和 Arch 的安装说明略有不同)。
运行节点时有哪些常见的坑?在 macOS 上,默认的文件描述符上限通常太低,可能会触发 “Too many open files” 错误或 RocksDB 崩溃。如果升级后本地数据库过时,你可能需要清空 ~/.fuel/db。
构建和运行时支持哪些操作系统?README 中记录的受支持构建环境是 macOS、Debian 和 Arch Linux。
通过 GraphQL API 我具体能做什么?你可以通过 submit mutation 提交十六进制编码的交易,并通过 GraphQL 服务查询链上状态。构建完成后,模式文件会生成在 crates/client/assets/schema.sdl。
我能不把数据持久化到磁盘上运行节点吗?可以。把 db-type 选项设为 in-memory,即可得到非持久化的状态,适合本地开发;默认则是使用 RocksDB 持久化。
本地测试时能停止自动出块吗?可以。传入 --poa-instant=false 即可关闭本地节点的即时出块。
fuel-core 目前支持哪些 Fuel 网络?截至本 README 发布时,Fuel Ignition、Testnet 和 Devnet 都在运行 fuel-core 0.48.1 版本。
Creator
FuelLabs
Size
890.1 MB
Stars
56.8K
Age
6y
Commits · 90 Days