{"id":13511280,"url":"https://github.com/FuelLabs/fuel-core","last_synced_at":"2025-03-30T20:32:53.750Z","repository":{"id":37074915,"uuid":"290882787","full_name":"FuelLabs/fuel-core","owner":"FuelLabs","description":"Rust full node implementation of the Fuel v2 protocol.","archived":false,"fork":false,"pushed_at":"2024-10-29T10:51:10.000Z","size":703434,"stargazers_count":58011,"open_issues_count":192,"forks_count":2781,"subscribers_count":242,"default_branch":"release/v0.40.0","last_synced_at":"2024-10-29T10:57:37.305Z","etag":null,"topics":["blockchain","fuel"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FuelLabs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-27T21:12:14.000Z","updated_at":"2024-10-29T06:57:31.000Z","dependencies_parsed_at":"2023-09-23T08:44:04.088Z","dependency_job_id":"b8ecafec-8530-4457-9691-4934758e3da1","html_url":"https://github.com/FuelLabs/fuel-core","commit_stats":{"total_commits":560,"total_committers":39,"mean_commits":14.35897435897436,"dds":0.6339285714285714,"last_synced_commit":"5846339dcf09928e4c345938ebe5154597f885f5"},"previous_names":[],"tags_count":104,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FuelLabs%2Ffuel-core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FuelLabs%2Ffuel-core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FuelLabs%2Ffuel-core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FuelLabs%2Ffuel-core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FuelLabs","download_url":"https://codeload.github.com/FuelLabs/fuel-core/tar.gz/refs/heads/release/v0.40.0","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222581193,"owners_count":17006296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","fuel"],"created_at":"2024-08-01T03:00:46.138Z","updated_at":"2024-11-01T13:30:34.319Z","avatar_url":"https://github.com/FuelLabs.png","language":"Rust","funding_links":[],"categories":["Blockchains","Rust","By Industry","Layer 2","区块链、智能合约","Web3 and ZKP Framework","By Language"],"sub_categories":["Blockchain","Fuel","网络服务_其他","Rust"],"readme":"# Fuel Client\n\n[![build](https://github.com/FuelLabs/fuel-core/actions/workflows/ci.yml/badge.svg)](https://github.com/FuelLabs/fuel-core/actions/workflows/ci.yml)\n[![crates.io](https://img.shields.io/crates/v/fuel-core?label=latest)](https://crates.io/crates/fuel-core)\n[![docs](https://docs.rs/fuel-core/badge.svg)](https://docs.rs/fuel-core/)\n[![discord](https://img.shields.io/badge/chat%20on-discord-orange?\u0026logo=discord\u0026logoColor=ffffff\u0026color=7389D8\u0026labelColor=6A7EC2)](https://discord.gg/xfpK4Pe)\n\nFuel client implementation.\n\n## Contributing\n\nIf you are interested in contributing to Fuel, see our [CONTRIBUTING.md](CONTRIBUTING.md) guidelines for coding standards and review process.\n\nBefore pushing any changes or creating pull request please run `source ci_checks.sh`.\n\n## Building\n\n### System Requirements\n\nThere are several system requirements including clang.\n\n#### MacOS\n\n```bash\nbrew update\nbrew install cmake\n```\n\n#### Debian\n\n```bash\napt update\napt install -y cmake pkg-config build-essential git clang libclang-dev\n```\n\n#### Arch\n\n```bash\npacman -Syu --needed --noconfirm cmake gcc pkgconf git clang\n```\n\n### Rust setup\n\nYou'll need `wasm32-unknown-unknown` target installed.\n\n```bash\nrustup target add wasm32-unknown-unknown\n```\n\n### Compiling\n\nWe recommend using `xtask` to build fuel-core:\n\n```sh\ncargo xtask build\n```\n\nThis will run `cargo build` as well as any other custom build processes we have such as re-generating a GraphQL schema for the client.\n\n### Testing\n\nThe [ci_checks.sh](ci_checks.sh) script file can be used to run all CI checks,\nincluding the running of tests.\n\n```shell\nsource ci_checks.sh\n```\n\nThe script requires pre-installed tools. For more information run:\n\n```shell\ncat ci_checks.sh\n```\n\n## Running\n\nThe service can be launched by executing `fuel-core run`. The list of options for running can be accessed via the `help` option:\n\n```console\n$ ./target/debug/fuel-core run --help\n\nUSAGE:\n    fuel-core run [OPTIONS]\n\nOPTIONS:\n        --snapshot \u003cSNAPSHOT\u003e\n          Snapshot from which to do (re)genesis. Defaults to local testnet configuration\n\n          [env: SNAPSHOT=]\n        ...\n```\n\nFor 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.\n\n### Example\n\n```console\n$ ./target/debug/fuel-core run --db-type in-memory\n2023-06-13T12:45:22.860536Z  INFO fuel_core::cli::run: 230: Block production mode: Instant\n2023-06-13T12:38:47.059783Z  INFO fuel_core::cli::run: 310: Fuel Core version v0.18.1\n2023-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\n2023-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\n```\n\nTo disable block production on your local node, set `--poa-instant=false`\n\n### Example\n\n```console\n$ ./target/debug/fuel-core run --poa-instant=false\n2023-06-13T12:44:12.857763Z  INFO fuel_core::cli::run: 232: Block production disabled\n```\n\n### Troubleshooting\n\n#### Publishing\n\nWe use [`publish-crates`](https://github.com/katyo/publish-crates) action for automatic publishing of all crates.\n\nIf you have problems with publishing, you can troubleshoot it locally with [`act`](https://github.com/nektos/act).\n\n```shell\nact release -s GITHUB_TOKEN=\u003cYOUR_GITHUB_TOKEN\u003e -j publish-crates-check --container-architecture linux/amd64 --reuse\n```\n\nIt requires GitHubToken to do request to the GitHub. You can create it \nwith [this](https://docs.github.com/en/enterprise-server@3.4/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) instruction.\n\n#### Outdated database\n\nIf you encounter an error such as\n\n```console\nthread '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\n```\n\nClear your local database using: `rm -rf ~/.fuel/db`\n\n#### File descriptor limits\n\nOn 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`.\n\n```bash\nulimit -n 10240\n```\n\n#### Log level\n\nThe service relies on the environment variable `RUST_LOG`. For more information, check the [EnvFilter examples](https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#examples) crate.\n\nHuman logging can be disabled with the environment variable `HUMAN_LOGGING=false`\n\n## Debugging\n\nSee the guide on [debugging](docs/developers/debugging.md) for an overview on running a debug build of a local node.\n\n## Docker \u0026 Kubernetes\n\n```sh\n# Create Docker Image\ndocker build -t fuel-core . -f deployment/Dockerfile\n\n# Delete Docker Image\ndocker image rm fuel-core\n\n# Create Kubernetes Volume, Deployment \u0026 Service\nkubectl create -f deployment/fuel-core.yml\n\n# Delete Kubernetes Volume, Deployment \u0026 Service\nkubectl delete -f deployment/fuel-core.yml\n```\n\n## GraphQL service\n\nThe client functionality is available through a service endpoint that expect GraphQL queries.\n\n### Transaction executor\n\nThe transaction executor currently performs instant block production. Changes are persisted to RocksDB by default.\n\n-   Service endpoint: `/v1/graphql`\n-   Schema (available after building): `crates/client/assets/schema.sdl`\n\nThe service expects a mutation defined as `submit` that receives a [Transaction](https://github.com/FuelLabs/fuel-vm/tree/master/fuel-tx) in hex encoded binary format, as [specified here](https://github.com/FuelLabs/fuel-specs/blob/master/src/tx-format/transaction.md).\n\n### cURL example\n\nThis example will execute a script that represents the following sequence of [ASM](https://github.com/FuelLabs/fuel-vm/tree/master/fuel-asm):\n\n```rs\nADDI(0x10, RegId::ZERO, 0xca),\nADDI(0x11, RegId::ZERO, 0xba),\nLOG(0x10, 0x11, RegId::ZERO, RegId::ZERO),\nRET(RegId::ONE),\n```\n\n```console\n$ cargo run --bin fuel-core-client -- transaction submit \\\n\"{\\\"Script\\\":{\n    \\\"body\\\":{\n      \\\"script_gas_limit\\\":1000000,\n      \\\"receipts_root\\\":\\\"0000000000000000000000000000000000000000000000000000000000000000\\\",\n      \\\"script\\\":[80,64,0,202,80,68,0,186,51,65,16,0,36,4,0,0],\n      \\\"script_data\\\":[]\n    },\n  \\\"policies\\\":{\n      \\\"bits\\\":\\\"Maturity | MaxFee\\\",\n      \\\"values\\\":[0,0,0,0]},\n  \\\"inputs\\\":[{\n    \\\"CoinSigned\\\":{\n      \\\"utxo_id\\\":{\n        \\\"tx_id\\\":\\\"c49d65de61cf04588a764b557d25cc6c6b4bc0d7429227e2a21e61c213b3a3e2\\\",\n        \\\"output_index\\\":33298\n      },\n      \\\"owner\\\":\\\"f1e92c42b90934aa6372e30bc568a326f6e66a1a0288595e6e3fbd392a4f3e6e\\\",\n      \\\"amount\\\":4294967295,\n      \\\"asset_id\\\":\\\"0000000000000000000000000000000000000000000000000000000000000000\\\",\n      \\\"tx_pointer\\\":{\n        \\\"block_height\\\":0,\n        \\\"tx_index\\\":0\n        },\n      \\\"witness_index\\\":0,\n      \\\"predicate_gas_used\\\":null,\n      \\\"predicate\\\":null,\n      \\\"predicate_data\\\":null}}],\n  \\\"outputs\\\":[],\n  \\\"witnesses\\\":[{\n    \\\"data\\\":[167,184,58,243,113,131,73,255,233,187,213,245,147,97,92,200,55,162,35,88,241,0,222,151,44,66,30,244,186,138,146,161,73,250,79,15,67,105,225,4,79,142,222,72,74,1,221,173,88,143,201,96,229,4,170,19,75,126,67,159,133,151,149,51]}\n  ]}}\"\n```\n\nYou may meet the error `Transaction is not inserted. UTXO does not exist` due to the UTXO validation. The UTXO validation can be turned off by adding the `--debug` flag.\n\n```console\n$ ./target/debug/fuel-core run --db-type in-memory --debug\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFuelLabs%2Ffuel-core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFuelLabs%2Ffuel-core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFuelLabs%2Ffuel-core/lists"}