Running a local node w/ custom chainConfig.json

Following this guide to run a local node on my machine to test my contracts out. Trying to customize the chainConfig.json file to be able to have custom wallets for testing.

Tried to generate some dummy wallets via forc-wallet, but either the option isn’t there (to generate multiple, or I haven’t been looking hard enough). I ended up using Fuel wallet to generate some dummy wallets. As an example, here is a dummy wallet (don’t care what happens to it, no funds stored here).

priv_key = 0x49f392ff2b701a2e2be789950a491c416c62c3cbc7082236bb696ee167360ad7
Address = fuel17cfuuy9qtepm2rl77sw0dvdvfzc25nec856ex5kmhqx5nup2q03sa48fhu

The address is Bech32-style, but in the chainConfig.json, it appears to be in hex-format (in the docs: The owner address must be a B256 type address (begins with 0x ) instead of a Bech32 type (begins with fuel )).

"initial_state": {
        "coins": [
            {
                "owner": "0x72dd6103daeaed398609a2ec3905f07ae4b5188a698fd1472306488b9e48245d",
                "amount": "0x1000000000000000",
                "asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000"
            }
    ]
}

~How can I get the B256 type-address from the Bech32 format? Is 0x72dd6103daeaed398609a2ec3905f07ae4b5188a698fd1472306488b9e48245d the private key for the owner because I have tried doing so, but the queried balances is zero~ (solved here)

For context, here’s the output when I try to run my local node.

❯ fuel-core run --chain ./chainConfig.json --db-type in-memory
2024-02-19T09:36:00.225955Z  INFO fuel_core::cli::run::relayer: 63: Relayer service disabled
2024-02-19T09:36:00.226100Z  INFO fuel_core::cli::run::p2p: 237: P2P service disabled
2024-02-19T09:36:00.226104Z  INFO fuel_core::cli::run: 264: Block production mode: Instant
2024-02-19T09:36:00.226425Z  WARN fuel_core::cli::run: 273: Fuel Core is using an insecure test key for consensus. Public key: 73dc6cc8cc0041e4924954b35a71a22ccb520664c522198a6d31dc6c945347bb854a39382d296ec64c70d7cea1db75601595e29729f3fbdc7ee9dae66705beb4
2024-02-19T09:36:00.226443Z  WARN fuel_core::cli::run: 294: The coinbase recipient `ContractId` is not set!
2024-02-19T09:36:00.226451Z  INFO fuel_core::cli::run: 358: Fuel Core version v0.22.0
2024-02-19T09:36:00.226498Z  WARN new{name=fuel-core}: fuel_core::service::config: 122: The `utxo_validation` should be `true` with disabled `debug`
2024-02-19T09:36:00.226508Z  WARN new{name=fuel-core}: fuel_core::service::config: 133: The `utxo_validation` of `TxPool` was inconsistent
2024-02-19T09:36:00.226511Z  WARN new{name=fuel-core}: fuel_core::service::config: 137: The `utxo_validation` of `BlockProducer` was inconsistent
2024-02-19T09:36:00.226518Z  INFO new{name=fuel-core}: fuel_core::service: 189: Initializing database
2024-02-19T09:36:00.226678Z  INFO new{name=fuel-core}:_commit_result{block_id=b1807ca9f2eec7e459b866ecf69b68679fc6b205a9a85c16bd4943d1bfc6fb2a height=0 tx_status=[]}: fuel_core_importer::importer: 264: Committed block 0xb1807ca9f2eec7e459b866ecf69b68679fc6b205a9a85c16bd4943d1bfc6fb2a
2024-02-19T09:36:00.226694Z  INFO new{name=fuel-core}: fuel_core::service: 194: Initializing sub services
2024-02-19T09:36:00.227701Z  INFO new{name=fuel-core}: fuel_core::graphql_api::service: 216: Binding GraphQL provider to 127.0.0.1:4000
2024-02-19T09:36:00.227784Z  INFO new{name=fuel-core}:initialize_loop{service="SyncTask"}: fuel_core_services::service: 298: The service SyncTask is shut down
2024-02-19T09:36:00.227813Z  INFO new{name=fuel-core}:initialize_loop{service="ImportTask"}: fuel_core_services::service: 298: The service ImportTask is shut down
2024-02-19T09:36:00.227829Z  INFO new{name=fuel-core}:initialize_loop{service="FuelService"}: fuel_core_services::service: 330: Starting FuelService service
2024-02-19T09:36:00.227852Z  INFO new{name=fuel-core}:initialize_loop{service="GraphQL"}: fuel_core_services::service: 330: Starting GraphQL service
2024-02-19T09:36:00.227885Z  INFO new{name=fuel-core}:initialize_loop{service="TxPool"}: fuel_core_services::service: 330: Starting TxPool service
2024-02-19T09:36:00.227906Z  INFO new{name=fuel-core}:initialize_loop{service="PoA"}: fuel_core_services::service: 330: Starting PoA service
2024-02-19T09:36:00.227913Z  INFO new{name=fuel-core}:initialize_loop{service="PoASyncTask"}: fuel_core_services::service: 330: Starting PoASyncTask service

There’s nothing beyond this, it doesn’t update with new blocks (is this normal)?

Hey @theAusicist, just a heads up this is your local node, and it’s separate from our beta-5 testnet. To start seeing blocks, you’ll need to begin submitting transactions to it because it wont produce empty blocks.

Owner in the chainConfig is a public key NOT a private key

You are also missing the flag --debug

fuel-core run --chain ./chainConfig.json --db-type in-memory --debug

Hope this helps!

oh, so it won’t be similar to Beta-5? I understand the local node is not the Beta-5 testnet per-se, but will it mirror the ops and functionalities? Want to do local tests with said node, but the local node won’t mirror Beta-5, then I’ll need to look elsewhere

Apologies for the misunderstanding. Yes, as long as you are using the latest beta-5 toolchain and conforming to this chain configuration (you can customize addresses, balances etc.), it will mirror beta-5.

yup, many thanks! ‎ ‎ ‎ ‎

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.