Skip to content

Commit

Permalink
cleaned doc for production
Browse files Browse the repository at this point in the history
  • Loading branch information
antiyro committed Oct 17, 2024
1 parent 59fccbb commit 6bed0e1
Show file tree
Hide file tree
Showing 10 changed files with 517 additions and 27 deletions.
17 changes: 3 additions & 14 deletions pages/_meta.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
"pagination": false
}
},
"Installation": {
"title": "Installation"
},
"quickstart": {
"title": "Quickstart"
},
Expand All @@ -29,9 +26,6 @@
"chain-configuration": {
"title": "Configuration"
},
"chain-management": {
"title": "Management"
},

"--- NODE OPERATORS": {
"title": "NODE OPERATORS",
Expand All @@ -40,6 +34,9 @@
"introduction": {
"title": "Overview"
},
"installation": {
"title": "Installation"
},
"fundamentals": {
"title": "Fundamentals"
},
Expand All @@ -52,14 +49,6 @@
"display": "hidden"
},

"--- DEVNET": {
"title": "DEVNET",
"type": "separator"
},
"chain-devnet": {
"title": "Devnet"
},

"--- Tutorials": {
"title": "TUTORIALS",
"type": "separator"
Expand Down
3 changes: 0 additions & 3 deletions pages/chain-devnet/_meta.en.json

This file was deleted.

3 changes: 0 additions & 3 deletions pages/chain-management/_meta.en.json

This file was deleted.

13 changes: 10 additions & 3 deletions pages/index.en.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import {
PanelsTopLeft,
Package,
Rocket,
Wrench,
BrainCircuit
} from "lucide-react";

# Welcome to the Madara Documentation
Expand All @@ -29,7 +31,7 @@ Madara is an open-source framework that makes it simple for you to deploy your o

## Madara Supports the Following Use Cases

- **Appchain Stack:** Allows to easily deploy your own Starknet instance to host you application
- **App Chain Stack:** Allows to easily deploy your own Starknet instance to host you application
- **Full Node:** Enables to interact with different Starknet networks
- **Devnet:** Simulates a Starknet network to test out you Cairo smart contracts

Expand Down Expand Up @@ -68,12 +70,17 @@ Take a look at these essential tools to get started with Madara and Cairo.
<Card
title="Madara Repo"
href="https://github.com/madara-alliance/madara"
icon={<Computer size={24} color="#ff000d" />}
icon={<Wrench size={24} color="#ff000d" />}
/>
<Card
title="Bootstrapper"
href="https://github.com/madara-alliance/madara-bootstrapper"
icon={<Power size={24} color="#ff000d" />}
icon={<Rocket size={24} color="#ff000d" />}
/>
<Card
title="Snos"
href="https://github.com/keep-starknet-strange/snos"
icon={<BrainCircuit size={24} color="#ff000d" />}
/>
</Cards>
{/*
Expand Down
4 changes: 2 additions & 2 deletions pages/quickstart/_meta.en.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"quickstart_1": {
"href": "/quickstart/quickstart_1"
"launch": {
"title": "Launch your App Chain!"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from "@fortawesome/free-brands-svg-icons";
import { Tabs, Tab } from "nextra/components";

# How to Start a Self-Hosted Chain with Madara
# How to launch your first App-Chain with Madara

This guide will walk you through the process of building, configuring, testing, and launching your own self-hosted chain using Madara. Unlike the [Node operators](/introduction) section, which focuses on understanding how Madara works as a client, here we explain in a more application-oriented way how to run and customize your own chain.

Expand Down
3 changes: 2 additions & 1 deletion pages/tutorials-full-node/_meta.en.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"launch": "How to launch a Madara full node?",
"launch": "How to launch a Madara Full Node?",
"customize": "How to customize a Madara Full Node?",
"query": "How to query Madara RPC endpoint?"
}
165 changes: 165 additions & 0 deletions pages/tutorials-full-node/customize.en.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
---
title: Customize a Madara Full Node
lang: en-US
description: Learn how to customize a Madara Full Node
---

import { Steps } from "nextra-theme-docs";

Check warning on line 7 in pages/tutorials-full-node/customize.en.mdx

View workflow job for this annotation

GitHub Actions / Run vale / runner / vale

[vale] reported by reviewdog 🐶 [madara-docs.SentenceLength] Try to keep sentences short ( less than 25 words). Raw Output: {"message": "[madara-docs.SentenceLength] Try to keep sentences short ( less than 25 words).", "location": {"path": "pages/tutorials-full-node/customize.en.mdx", "range": {"start": {"line": 7, "column": 1}}}, "severity": "INFO"}
import { Callout } from "nextra-theme-docs";
import { Cards, Card } from "nextra/components";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {
faLinux,
faApple,
faWindows,
} from "@fortawesome/free-brands-svg-icons";
import { Tabs, Tab } from "nextra/components";

# How to customize a Madara Full Node

This guide will walk you through the process of customizing a Madara Full Node.

## Quick start tutorial

As an introduction to the following section, we created a video tutorial to give you more context on how to customize your Madara Full Node.

-- Video goes here --

<Callout type="info" emoji="ℹ️">
We recommend continuing with the [Next Section](#step-by-step-tutorial), which will help you better understand the different components of Madara customization.
</Callout>

## Step by step tutorial

<Callout type="warning" emoji="⚠️">
This tutorial assumes that you already know how to launch a Madara Full Node. For more information about how to launch a Madara Full Node, please head up to [this tutorial](/tutorials-full-node/launch).
</Callout>

### Configure your Full Node

Now that you have your node installed and running smoothly, you may want to configure it further to match your desired configuration or network. There are two types of configuration for your node:

- **Node Configuration**: the configuration of your node itself as an engine.
- **Chain Configuration**: the configuration of the chain you are currently running your node on.

In this tutorial, we'll focus on a simple configuration of both so you can understand them better.

<Steps>

### Node Configuration

We have over a hundred configuration options available for your Full Node client. You can find all the configuration parameters in the [Configuration](/fundamentals/configuration) chapter of the Node Operators section. For a comprehensive list of command-line options, you can also run:

```bash
cargo run -- --help
```

Here, we will simply add the necessary parameters so that you can query your RPC endpoint from anywhere. To do this, we will use 3 additional parameters:

- **`--rpc-port <PORT>`**: Specify JSON-RPC server TCP port.

- **`--rpc-cors <ORIGINS>`**: Specify browser Origins allowed to access the HTTP & WS RPC servers.

Check failure on line 61 in pages/tutorials-full-node/customize.en.mdx

View workflow job for this annotation

GitHub Actions / Run vale / runner / vale

[vale] reported by reviewdog 🐶 [madara-docs.Consistency] Consider using 'and' instead of '&' Raw Output: {"message": "[madara-docs.Consistency] Consider using 'and' instead of '\u0026'", "location": {"path": "pages/tutorials-full-node/customize.en.mdx", "range": {"start": {"line": 61, "column": 83}}}, "severity": "ERROR"}

- **`--rpc-external`**: Listen to all RPC interfaces. Default is local.

This will give us the following command:

```bash
cargo run --release -- \
--name Madara \
--full
--base-path /var/lib/madara \
--network mainnet \
--l1-endpoint ${ETHEREUM_API_URL} \
--rpc-port 9945 \
--rpc-cors '*' \
--rpc-external
```

If you run this command, you can now query your Madara Full Node on the RPC endpoint 9945.

<Callout type="info" emoji="ℹ️">
For more information on how to query your Full Node client, we recommend following the tutorial [How to query a Madara RPC endpoint](/tutorials-full-node/query).
</Callout>

### Chain Configuration

Your Madara Full Node is a configurable client that can connect and synchronize with any network respecting the Starknet specs. These networks may have specific configurations, so it's preferable to adapt your Full Node to this configuration to ensure compatibility.

Here, we will simply imagine that our node wants to connect to a Starknet clone App Chain with the following configuration:

```yml
chain_name: "Starklone"
chain_id: "SN_KLONE"
native_fee_token_address: "0x012345a0fc34fa1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d"
parent_fee_token_address: "0x012346570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7"
latest_protocol_version: "0.13.2"
block_time: "30s"
pending_block_update_time: "2s"
execution_batch_size: 16
bouncer_config:
block_max_capacity:
builtin_count:
add_mod: 18446744073709551615
bitwise: 18446744073709551615
ecdsa: 18446744073709551615
ec_op: 18446744073709551615
keccak: 18446744073709551615
mul_mod: 18446744073709551615
pedersen: 18446744073709551615
poseidon: 18446744073709551615
range_check: 18446744073709551615
range_check96: 18446744073709551615
gas: 5000000
n_steps: 40000000
message_segment_length: 18446744073709551615
n_events: 18446744073709551615
state_diff_size: 131072
sequencer_address: "0x01234a1bd84444c89232ec27754698e5d2e7e1a7f1539f12027f28b23ec9f3d8"
eth_core_contract_address: "0xc662c410C0ECf747543f5bA90660f6ABeBD9C8c4"
eth_gps_statement_verifier: "0x47312450B3Ac8b5b8e247a6bB6d523e7605bDb60"
```
You simply need to take this configuration and save it as a `.yml` file somewhere on your machine, then call it via:

- **`--chain-config-path <CHAIN CONFIG FILE PATH>`**: Specifies the chain configuration file path.

Which in our case would give the following command:

```bash
cargo run --release -- \
--name Madara \
--full
--base-path /var/lib/madara \
--l1-endpoint ${ETHEREUM_API_URL} \
--rpc-port 9945 \
--rpc-cors '*' \
--rpc-external \
--chain-config-path "/path/to/your/config.yml"
```

<Callout type="info" emoji="ℹ️">
Please note that the `--network mainnet` parameter, which overwrites any chain config with the mainnet configuration preset, has been removed here to allow the custom chain config via `--chain-config-path`.

Check warning on line 142 in pages/tutorials-full-node/customize.en.mdx

View workflow job for this annotation

GitHub Actions / Run vale / runner / vale

[vale] reported by reviewdog 🐶 [madara-docs.SentenceLength] Try to keep sentences short ( less than 25 words). Raw Output: {"message": "[madara-docs.SentenceLength] Try to keep sentences short ( less than 25 words).", "location": {"path": "pages/tutorials-full-node/customize.en.mdx", "range": {"start": {"line": 142, "column": 5}}}, "severity": "INFO"}
</Callout>

Another way to run this configuration would have been, for example, to override the elements that differ here with the original Starknet mainnet configuration using:

- **`--chain-config-override <OVERRIDES>`**: Overrides specific chain configuration parameters.

This would give the following command:

```bash
cargo run --release -- \
--name Madara \
--full \
--network mainnet \
--base-path /var/lib/madara \
--l1-endpoint ${ETHEREUM_API_URL} \
--rpc-port 9945 \
--rpc-cors '*' \
--rpc-external \
--chain-config-override chain_name="Starklone" chain_id="SN_KLONE" native_fee_token_address="0x012345a0fc34fa1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d" parent_fee_token_address="0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7" sequencer_address="0x01234a1bd84444c89232ec27754698e5d2e7e1a7f1539f12027f28b23ec9f3d8"
```
</Steps>

You now know how to configure both your Full Node client and the chain it connects to! To learn more, visit the sections [Node Configuration](/fundamentals/configuration) and [Chain Configuration](/chain-configuration/parameters).
95 changes: 95 additions & 0 deletions pages/tutorials-full-node/launch.en.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
title: Launch a Madara Full Node
lang: en-US
description: Learn how to launch a Madara Full Node
---

import { Steps } from "nextra-theme-docs";

Check warning on line 7 in pages/tutorials-full-node/launch.en.mdx

View workflow job for this annotation

GitHub Actions / Run vale / runner / vale

[vale] reported by reviewdog 🐶 [madara-docs.SentenceLength] Try to keep sentences short ( less than 25 words). Raw Output: {"message": "[madara-docs.SentenceLength] Try to keep sentences short ( less than 25 words).", "location": {"path": "pages/tutorials-full-node/launch.en.mdx", "range": {"start": {"line": 7, "column": 1}}}, "severity": "INFO"}
import { Callout } from "nextra-theme-docs";
import { Cards, Card } from "nextra/components";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {
faLinux,
faApple,
faWindows,
} from "@fortawesome/free-brands-svg-icons";
import { Tabs, Tab } from "nextra/components";

# How to launch a Madara Full Node

This guide will walk you through the process of installing and launching a Madara Full Node.

## Quick start tutorial

As an introduction to the following section, we created a video tutorial to give you more context how to launch your Madara Full Node.

/video goes here/

<Callout type="info" emoji="ℹ️">
We recommend continuing with the [Next Section](#Step-by-step-tutorial), which will help you better understand the different components of Madara by building from source.
</Callout>

## Step by step tutorial

### Install your Full Node

<Steps>
### Install dependencies

We first need to make sure you have everything needed to complete this tutorial.

| Dependency | Version | Installation |
| ----------------- | -------------------- | ------------------------------------------------------------------------------------------|
| Rust | rustc 1.78 | `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs sh` |
| Clang | Latest | `sudo apt-get install clang` |
| Scarb | v2.8.2 | `curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh \| sh ` |

### Get code

Fetch the code from the Official [Madara](https://github.com/madara-alliance/madara) repository in the folder of your choice.

```bash
cd <your-destination-path>
git clone https://github.com/madara-alliance/madara .
```

### Build program

Then let's build the dependencies. You can choose between 3 different build modes:

- **Debug** (fastest build mode, but lower performances, for testing purpose only)

```bash
cargo build
```

- **Release** (the recommend build mode)

```bash
cargo build --release
```

- **Production** (the recommend build mode for production performances)

```bash
cargo build --profile=production
```

### Run Madara

This command will start the Madara client with a basic set arguments syncronizing directly with Starknet mainnet. For further configuration we recomand you to head up to the [Configure Your Node](#configure-your-node) section down below.

```bash
cargo run --release -- \
--name Madara \
--full
--base-path /var/lib/madara \
--network mainnet \
--l1-endpoint ${ETHEREUM_API_URL}
```

<Callout type="info" emoji="ℹ️">
If you don't have an L1 endpoint url we recommend you to head up to the
[Verification](/) section to get one
</Callout>
</Steps>
Loading

0 comments on commit 6bed0e1

Please sign in to comment.