Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update running a node docs for testnet #280

Merged
merged 9 commits into from
May 24, 2024
2 changes: 0 additions & 2 deletions docs/guides/docs/running-a-node/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ parent:

# Running a Node

> **Note:** This guide has not yet been updated for the new `testnet` network.

This guide is designed to swiftly introduce you to the process of running a local node for the Fuel blockchain.

## What is a Node?
Expand Down
49 changes: 37 additions & 12 deletions docs/guides/docs/running-a-node/running-a-local-node.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ parent:

# Running a local Fuel node

> **Note:** This guide has not yet been updated for the new `testnet` network.

In addition to deploying and testing on the Fuel Testnet, you can also run a local Fuel Node.

There are two types of Fuel networks that can be run:
Expand All @@ -21,10 +19,10 @@ There are two types of Fuel networks that can be run:

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:
To spin-up a local in-memory Fuel node download or copy the local snapshot from [here](https://github.com/FuelLabs/chain-configuration/tree/master/local), then run the following command:

```sh
fuel-core run --db-type in-memory --debug
fuel-core run --db-type in-memory --debug --snapshot ./your/path/to/chain_config_folder
```

To deploy a contract to the local node, run the following command:
Expand All @@ -33,32 +31,59 @@ To deploy a contract to the local node, run the following command:
forc deploy <signing-key> --node-url 127.0.0.1:4000/graphql
```

Or to deploy without using a signing key:
Or to deploy with the default signer that is pre-funded by fuel-core:

```sh
forc deploy --unsigned --node-url 127.0.0.1:4000/graphql
forc deploy --default-signer --node-url 127.0.0.1:4000/graphql
matt-user marked this conversation as resolved.
Show resolved Hide resolved
```

## Chain Configuration

To modify the initial state of the chain, you must configure a `chainConfig.json` file.
To modify the initial state of the chain, you must configure the `state_config.json` file in your chain configuration folder.
Here is an example of what that looks like using version {props.fuelCoreVersion} of `fuel-core`:

<ConditionalContent versionSet={props.versionSet} showForVersions={["default", "nightly"]}>
Here is the [specific configuration](https://github.com/FuelLabs/fuel-core/tree/9fddeccb4d112c148f6793bc3d21131a13778a25/bin/fuel-core/chainspec/testnet)

`chain_config.json`

<CodeImport
file="../../../fuel-core/bin/fuel-core/chainspec/testnet/chain_config.json"
/>

`metadata.json`

<CodeImport
file="../../../fuel-core/bin/fuel-core/chainspec/testnet/metadata.json"
/>

`state_config.json`

<CodeImport
file="../../../fuel-core/bin/fuel-core/chainspec/testnet/state_config.json"
/>

`state_transition_bytecode.wasm`

Which is too large to display on this page, but you can find it [here](https://github.com/FuelLabs/fuel-core/blob/9fddeccb4d112c148f6793bc3d21131a13778a25/bin/fuel-core/chainspec/testnet/state_transition_bytecode.wasm)

</ConditionalContent>

To start the node with a custom configuration, you can use the command below:
matt-user marked this conversation as resolved.
Show resolved Hide resolved
matt-user marked this conversation as resolved.
Show resolved Hide resolved

```sh
fuel-core run --chain ./chainConfig.json --db-type in-memory --debug
fuel-core run --snapshot ./your/path/to/chain_config_folder --db-type in-memory --debug
```

To find an example chain configuration file for a specific `fuel-core` version, refer to the [`fuel-core`](https://github.com/FuelLabs/fuel-core/tree/v0.22.0/deployment/scripts/chainspec) repo.
To find an example chain configuration folder for a specific `fuel-core` version, refer to the [`fuel-core`](https://github.com/FuelLabs/fuel-core/tree/9fddeccb4d112c148f6793bc3d21131a13778a25/bin/fuel-core/chainspec/testnet) repo.

### Funding a wallet locally

You can edit the `coins` array inside the `inital_state` object to modify the initial assets owned by a given address.
You can edit the `coins` array inside `state_config.json` to modify the initial assets owned by a given address.

The `owner` address must be a `B256` type address (begins with `0x`) instead of a `Bech32` type (begins with `fuel`).

The `amount` is a hex value. In this example, the value translates to `1,125,899.9 ETH`.
The `amount` is a numerical value. In this example, the value translates to `11,152,921,504 ETH`.

## Local node (with state persistence)

Expand All @@ -68,7 +93,7 @@ To run a local node with persistence a chain configuration file is required.
To start the node, run the following command:
matt-user marked this conversation as resolved.
Show resolved Hide resolved

```sh
fuel-core run --ip 127.0.0.1 --port 4000 --chain ./chainConfig.json --db-path ./.fueldb --debug
fuel-core run --ip 127.0.0.1 --port 4000 --snapshot ./your/path/to/chain_config_folder --db-path ./.fueldb --debug
```

## Connecting to the local node from a browser wallet
Expand Down
70 changes: 43 additions & 27 deletions docs/guides/docs/running-a-node/running-a-testnet-node.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,8 @@ parent:

# Running a local Fuel node connected to Testnet using P2P

> **Note:** This guide has not yet been updated for the new `testnet` network.

{/*install_help:example:start*/}
> P2P syncing is currently disabled for the Beta-5 network. Please check this page or the [Forum](https://forum.fuel.network) for updates.
{/*install_help:example:end*/}

## Installation

<TextImport
file="../installation/index.mdx"
comment="install_rust"
commentType="{/*"
/>

<CodeImport
file="../installation/index.mdx"
comment="install_rust_command"
commentType="{/*"
lang="sh"
trim="true"
/>

<TextImport
matt-user marked this conversation as resolved.
Show resolved Hide resolved
file="../installation/index.mdx"
comment="install_fuelup"
Expand All @@ -44,6 +24,15 @@ parent:
trim="true"
/>

To run a `testnet` node, you will need to install the `testnet` toolchain.

You can do this by running the commands below.

```sh
fuelup toolchain install testnet
fuelup default testnet
```

<TextImport
file="../counter-dapp/building-a-smart-contract.mdx"
comment="install_help"
Expand Down Expand Up @@ -111,7 +100,34 @@ Make sure you save this somewhere safe so you don't need to generate a new key p

## Chain Configuration

To run a local node with persistence, you must configure a `chainConfig.json` file.
To run a local node with persistence, you must have a folder with the following chain configuration files:

<ConditionalContent versionSet={props.versionSet} showForVersions={["default", "nightly"]}>
Here is the [specific configuration](https://github.com/FuelLabs/fuel-core/tree/9fddeccb4d112c148f6793bc3d21131a13778a25/bin/fuel-core/chainspec/testnet)

`chain_config.json`

<CodeImport
file="../../../fuel-core/bin/fuel-core/chainspec/testnet/chain_config.json"
/>

`metadata.json`

<CodeImport
file="../../../fuel-core/bin/fuel-core/chainspec/testnet/metadata.json"
/>

`state_config.json`

<CodeImport
file="../../../fuel-core/bin/fuel-core/chainspec/testnet/state_config.json"
/>

`state_transition_bytecode.wasm`

Which is too large to display on this page, but you can find it [here](https://github.com/FuelLabs/fuel-core/tree/9fddeccb4d112c148f6793bc3d21131a13778a25/bin/fuel-core/chainspec/testnet/state_transition_bytecode.wasm)

</ConditionalContent>

## Running a Local Node

Expand All @@ -125,17 +141,17 @@ Finally to put everything together to start the node, run the following command:
fuel-core run \
--service-name {ANY_SERVICE_NAME} \
--keypair {P2P_SECRET} \
--relayer {ETH_RPC_ENDPOINT}\
--relayer {ETH_RPC_ENDPOINT} \
--ip 0.0.0.0 --port 4000 --peering-port 30333 \
--db-path ~/.fuel_beta5 \
--chain ./chainConfig.json \
--db-path ~/.testnet \
--snapshot ./your/path/to/chain_config_folder \
--utxo-validation --poa-instant false --enable-p2p \
--min-gas-price 1 --max-block-size 18874368 --max-transmit-size 18874368 \
--reserved-nodes /dns4/p2p-beta-5.fuel.network/tcp/30333/p2p/16Uiu2HAmSMqLSibvGCvg8EFLrpnmrXw1GZ2ADX3U2c9ttQSvFtZX,/dns4/p2p-beta-5.fuel.network/tcp/30334/p2p/16Uiu2HAmVUHZ3Yimoh4fBbFqAb3AC4QR1cyo8bUF4qyi8eiUjpVP \
--reserved-nodes /dns4/p2p-devnet.fuel.network/tcp/30333/p2p/16Uiu2HAm6pmJUedRFjennk4A8yWL6zCApHCuykzRRroqMjjxZ8o6,/dns4/p2p-devnet.fuel.network/tcp/30334/p2p/16Uiu2HAm8dBwTRzqazCMqQDdR8thMa7BKiW4ep2B4DoQQp6Qhyfd \
--sync-header-batch-size 100 \
--enable-relayer \
--relayer-v2-listening-contracts 0x557c5cE22F877d975C2cB13D0a961a182d740fD5 \
--relayer-da-deploy-height 4867877 \
--relayer-v2-listening-contracts 0x01855B78C1f8868DE70e84507ec735983bf262dA \
--relayer-da-deploy-height 5827607 \
--relayer-log-page-size 2000
```

Expand Down
3 changes: 2 additions & 1 deletion spell-check-custom-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,5 @@ onboarding
Fuelet
Metamask
Devnet
devnet
devnet
pre
Loading