Skip to content

Commit

Permalink
Merge branch 'master' into add/intro-to-sway
Browse files Browse the repository at this point in the history
  • Loading branch information
calldelegation authored Nov 23, 2023
2 parents 48bf9fc + 62b0d0b commit 068d84b
Show file tree
Hide file tree
Showing 11 changed files with 81 additions and 271 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,6 @@
[submodule "docs/guides/docs/migration-guide/breaking-change-log"]
path = docs/guides/docs/migration-guide/breaking-change-log
url = https://github.com/FuelLabs/breaking-change-log
[submodule "docs/fuel-core"]
path = docs/fuel-core
url = https://github.com/FuelLabs/fuel-core
1 change: 1 addition & 0 deletions docs/fuel-core
Submodule fuel-core added at a41795
12 changes: 12 additions & 0 deletions docs/guides/docs/running-a-node/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ Running your own node provides several advantages:
1. **Query Freedom:** By hosting your own node, you can execute a higher number of queries without encountering any rate limits.
2. **Network Independence:** Having your own node ensures that you're not reliant on third-party services, giving you full control over your interactions with the Fuel blockchain.

## Hardware Requirements

| Hardware | Minimum | Recommended |
|------------|----------|-------------|
| Processor | 2 Cores | 8 Cores |
| Memory | 4 GB | 12 GB |
| Storage | 30 GB | 100 GB |

For low API traffic, an AWS m5.large should be more than sufficient. However, we recommend an AWS m5.4xlarge instance to match the configuration we use for running the network.

> For regular tasks such as deploying simple contracts and testing contract interactions locally, there is no need to meet all the hardware requirements below.
## Getting Started

Depending on your requirements, you can opt for one of the following setups:
Expand Down
211 changes: 4 additions & 207 deletions docs/guides/docs/running-a-node/running-a-beta-4-node.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -111,213 +111,10 @@ Make sure you save this somewhere safe so you don't need to generate a new key p

To run a local node with persistence, you must configure a `chainConfig.json` file. Here is the [specific configuration](https://github.com/FuelLabs/fuel-core/blob/v0.20.4/deployment/scripts/chainspec/beta_chainspec.json) for `beta-4`:

```json
{
"chain_name": "Testnet Beta 4",
"block_gas_limit": 30000000,
"initial_state": {
"coins": [
{
"owner": "0xa1184d77d0d08a064e03b2bd9f50863e88faddea4693a05ca1ee9b1732ea99b7",
"amount": "0x1000000000000000",
"asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000"
},
{
"owner": "0xb5566df884bee4e458151c2fe4082c8af38095cc442c61e0dc83a371d70d88fd",
"amount": "0x1000000000000000",
"asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000"
},
{
"owner": "0x9da7247e1d63d30d69f136f0f8654ee8340362c785b50f0a60513c7edbf5bb7c",
"amount": "0x1000000000000000",
"asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000"
},
{
"owner": "0x4b2ca966aad1a9d66994731db5138933cf61679107c3cde2a10d9594e47c084e",
"amount": "0x1000000000000000",
"asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000"
},
{
"owner": "0x26183fbe7375045250865947695dfc12500dcc43efb9102b4e8c4d3c20009dcb",
"amount": "0x1000000000000000",
"asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000"
},
{
"owner": "0x81f3a10b61828580d06cc4c7b0ed8f59b9fb618be856c55d33decd95489a1e23",
"amount": "0x1000000000000000",
"asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000"
},
{
"owner": "0x587aa0482482efea0234752d1ad9a9c438d1f34d2859b8bef2d56a432cb68e33",
"amount": "0x1000000000000000",
"asset_id": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
]
},
"transaction_parameters": {
"contract_max_size": 16777216,
"max_inputs": 255,
"max_outputs": 255,
"max_witnesses": 255,
"max_gas_per_tx": 10000000,
"max_script_length": 1048576,
"max_script_data_length": 1048576,
"max_storage_slots": 255,
"max_predicate_length": 1048576,
"max_predicate_data_length": 1048576,
"max_gas_per_predicate": 10000000,
"gas_price_factor": 92,
"gas_per_byte": 4,
"max_message_data_length": 1048576,
"chain_id": 0
},
"gas_costs": {
"add": 1,
"addi": 1,
"aloc": 1,
"and": 1,
"andi": 1,
"bal": 13,
"bhei": 1,
"bhsh": 1,
"burn": 132,
"cb": 1,
"cfei": 1,
"cfsi": 1,
"croo": 16,
"div": 1,
"divi": 1,
"eck1": 951,
"ecr1": 3000,
"ed19": 3000,
"eq": 1,
"exp": 1,
"expi": 1,
"flag": 1,
"gm": 1,
"gt": 1,
"gtf": 1,
"ji": 1,
"jmp": 1,
"jne": 1,
"jnei": 1,
"jnzi": 1,
"jmpf": 1,
"jmpb": 1,
"jnzf": 1,
"jnzb": 1,
"jnef": 1,
"jneb": 1,
"k256": 11,
"lb": 1,
"log": 9,
"lt": 1,
"lw": 1,
"mcpi": 33,
"mint": 135,
"mlog": 1,
"mod": 1,
"modi": 1,
"move": 1,
"movi": 1,
"mroo": 2,
"mul": 1,
"muli": 1,
"mldv": 1,
"noop": 1,
"not": 1,
"or": 1,
"ori": 1,
"ret_contract": 13,
"rvrt_contract": 13,
"s256": 2,
"sb": 1,
"scwq": 13,
"sll": 1,
"slli": 1,
"srl": 1,
"srli": 1,
"srw": 12,
"sub": 1,
"subi": 1,
"sw": 1,
"sww": 43,
"swwq": 44,
"time": 1,
"tr": 105,
"tro": 60,
"wdcm": 1,
"wqcm": 1,
"wdop": 1,
"wqop": 1,
"wdml": 1,
"wqml": 1,
"wddv": 1,
"wqdv": 2,
"wdmd": 3,
"wqmd": 4,
"wdam": 2,
"wqam": 3,
"wdmm": 3,
"wqmm": 3,
"xor": 1,
"xori": 1,
"call": {
"base": 144,
"dep_per_unit": 214
},
"ccp": {
"base": 15,
"dep_per_unit": 103
},
"csiz": {
"base": 17,
"dep_per_unit": 790
},
"ldc": {
"base": 15,
"dep_per_unit": 272
},
"logd": {
"base": 26,
"dep_per_unit": 64
},
"mcl": {
"base": 1,
"dep_per_unit": 3333
},
"mcli": {
"base": 1,
"dep_per_unit": 3333
},
"mcp": {
"base": 1,
"dep_per_unit": 2000
},
"meq": {
"base": 1,
"dep_per_unit": 2500
},
"retd_contract": {
"base": 29,
"dep_per_unit": 62
},
"smo": {
"base": 209,
"dep_per_unit": 55
},
"srwq": {
"base": 47,
"dep_per_unit": 5
}
},
"consensus": {
"PoA": {
"signing_key": "f65d6448a273b531ee942c133bb91a6f904c7d7f3104cdaf6b9f7f50d3518871"
}
}
}
```
<CodeImport
file="../../../fuel-core/deployment/scripts/chainspec/beta_chainspec.json"
lang="json"
/>

## Running a Local Node

Expand Down
88 changes: 27 additions & 61 deletions docs/guides/docs/running-a-node/running-a-local-node.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,71 +37,37 @@ Or to deploy without using a signing key:
forc deploy --unsigned --node-url 127.0.0.1:4000/graphql
```

## Local node (with state persistence)
## Chain Configuration

This node does persist the blockchain state locally.
To modify the initial state of the chain, you must configure a `chainConfig.json` file.
Here is an example of what that looks like using version {props.fuelCoreVersion} of `fuel-core`:

<CodeImport
file="../../../fuel-core/deployment/scripts/chainspec/dev_chainspec.json"
lang="json"
/>

To start the node with a custom configuration, you can use the command below:

To run a local node with persistence, you must configure a `chainConfig.json` file. Here is an example of what that looks like:

```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"
}
}
}
```sh
fuel-core run --chain ./chainConfig.json --db-type in-memory
```

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/master/deployment/scripts/chainspec) 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.

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`.

## Local node (with state persistence)

This node does persist the blockchain state locally.
To run a local node with persistence a chain configuration file is required.

To start the node, run the following command:

```sh
Expand Down
8 changes: 7 additions & 1 deletion spell-check-custom-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,10 @@ VM
VSCode
webhooks
js
npm
npm
fuelTestnetInlineCode
fuelTestnet
faucetLink
GQLPlaygroundLink
xlarge
fuelCoreVersion
9 changes: 8 additions & 1 deletion src/components/MDXRender.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,15 @@ type MDXRenderProps = {
code: string;
components: Record<any, any>;
isLatest: boolean;
fuelCoreVersion?: string;
};

export function MDXRender({ code, components, isLatest }: MDXRenderProps) {
export function MDXRender({
code,
components,
isLatest,
fuelCoreVersion,
}: MDXRenderProps) {
const { default: Content } = useMemo(
() => runSync(code, { ...runtime, ...provider }),
[code]
Expand All @@ -82,6 +88,7 @@ export function MDXRender({ code, components, isLatest }: MDXRenderProps) {
<Code>{FUEL_TESTNET}</Code> graphQL playground
</Link>
}
fuelCoreVersion={<Code>{fuelCoreVersion}</Code>}
/>
</provider.MDXProvider>
);
Expand Down
3 changes: 3 additions & 0 deletions src/lib/plugins/rehype-code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ function codeLanguage() {
if (lang?.includes('sh')) {
node.properties.className[0] = 'language-sh';
}
if (lang?.includes('json')) {
node.properties.className[0] = 'language-json';
}
});
};
}
Expand Down
Loading

0 comments on commit 068d84b

Please sign in to comment.