From 59fccbb1b0c9bc478d584b933a9a111bf783373d Mon Sep 17 00:00:00 2001 From: antiyro Date: Thu, 17 Oct 2024 12:35:06 +0100 Subject: [PATCH 1/8] cleaned self hosted --- pages/_meta.en.json | 3 - pages/chain-configuration/_meta.en.json | 1 - pages/chain-configuration/overview.en.mdx | 23 -- pages/quickstart/quickstart_1.en.mdx | 24 +- pages/start.en.mdx | 305 ---------------------- 5 files changed, 21 insertions(+), 335 deletions(-) delete mode 100644 pages/chain-configuration/overview.en.mdx delete mode 100644 pages/start.en.mdx diff --git a/pages/_meta.en.json b/pages/_meta.en.json index 2840ca3..9249d94 100644 --- a/pages/_meta.en.json +++ b/pages/_meta.en.json @@ -23,9 +23,6 @@ "overview": { "title": "Overview" }, - "start": { - "title": "Start a self-hosted chain" - }, "chain-architecture": { "title": "Architecture" }, diff --git a/pages/chain-configuration/_meta.en.json b/pages/chain-configuration/_meta.en.json index eee8c86..aca83fd 100644 --- a/pages/chain-configuration/_meta.en.json +++ b/pages/chain-configuration/_meta.en.json @@ -1,4 +1,3 @@ { - "overview": "Overview", "parameters": "Parameters" } diff --git a/pages/chain-configuration/overview.en.mdx b/pages/chain-configuration/overview.en.mdx deleted file mode 100644 index d1cd23d..0000000 --- a/pages/chain-configuration/overview.en.mdx +++ /dev/null @@ -1,23 +0,0 @@ ---- -title: Welcome to the Node Operators Section -lang: en-US -description: Learn how to install and configure your Madara client as a node operator. ---- - -import { Cards, Card } from "nextra/components"; -import { - Server, - Settings, - Network, - Plug, - Wrench, - Rocket, - MonitorCog, - HardDrive, - FlaskConical, - Globe, - Activity, -} from "lucide-react"; -import { Callout } from "nextra-theme-docs"; - -# Chain Operator Configurations diff --git a/pages/quickstart/quickstart_1.en.mdx b/pages/quickstart/quickstart_1.en.mdx index 837e399..9af840e 100644 --- a/pages/quickstart/quickstart_1.en.mdx +++ b/pages/quickstart/quickstart_1.en.mdx @@ -1,5 +1,5 @@ --- -title: Launch your first Madara appchain +title: Start a self-hosted chain with Madara lang: en-US description: Learn how to run and custom a Madara chain. --- @@ -19,11 +19,29 @@ import { Tabs, Tab } from "nextra/components"; 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. -## Build Your Chain +## Quick start tutorial + +As an introduction to the following section, we created a video tutorial to give you more context on what happens when you launch your own App Chain. It uses an installation script that will guide you through all the steps of a minimalist setup of the Madara client. + + +### Download and launch the installer + +```bash + curl -sL https://madara.build/launcher.sh && chmod +x launcher && ./launcher +``` + +### Follow the tutorial + + + + We recommend continuing with the [Next Section](#build-your-chain-from-source), which will help you better understand the different components of Madara by building from source. + + +## Build Your Chain from source ### Understand Madara Components -Before diving into installation, it's important to understand the fundamental components of Madara and how it functions as a Starknet client. +Now that you have some context around the Madara client, it's important to understand the fundamental components of Madara and how it functions as a Starknet client. - **Chain Architecture**: Madara currently works exactly like Starknet mainnet with a centralized sequencer that will produce the state of your chain. This one will then serve the data for proving trough SNOS and Sharp (the zk-stark prover). This means that your sequencer is the only one capable of producing state. You can then connect as many full nodes as you like to it. We recommend you to familiarize yourself with the [architecture](https://github.com/madara-alliance/madara) to understand how the entire flow works. diff --git a/pages/start.en.mdx b/pages/start.en.mdx deleted file mode 100644 index add058e..0000000 --- a/pages/start.en.mdx +++ /dev/null @@ -1,305 +0,0 @@ ---- -title: Start a self-hosted chain with Madara -lang: en-US -description: Learn how to run and custom a Madara chain. ---- - -import { Steps } from "nextra-theme-docs"; -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 Start a Self-Hosted 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. - -## Build Your Chain - -### Understand Madara Components - -Before diving into installation, it's important to understand the fundamental components of Madara and how it functions as a Starknet client. - -- **Chain Architecture**: Madara currently works exactly like Starknet mainnet with a centralized sequencer that will produce the state of your chain. This one will then serve the data for proving trough SNOS and Sharp (the zk-stark prover). This means that your sequencer is the only one capable of producing state. You can then connect as many full nodes as you like to it. We recommend you to familiarize yourself with the [architecture](https://github.com/madara-alliance/madara) to understand how the entire flow works. - -- **Bootstrapper**: To easily deploy your first set of contracts and authority accounts you'll have to use Madara Bootstrapper. - -- **Smart Contracts**: Madara allows you to deploy and interact with Cairo smart contracts. Understanding Cairo contracts will help you make the most of your self-hosted chain. - -- **Interacting**: Madara is 100% compatible with the latest Starknet specs. You can then easily interact with your Madara client trough its JSON-RPC endpoint or FGW. - -### Install Madara - -This installation process will help you build the binary directly from the source code locally on your machine. - - - You'll find other installation methods such as Docker in the - [Installation](/get-started/install) section of the Node Operator category. - - - -### 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 -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 which will begin a basic deployment depending on your chosen mode: - -```bash - cargo run --release -- \ - --name Madara \ - --sequencer - --base-path /var/lib/madara \ - --l1-endpoint ${ETHEREUM_API_URL} -``` - - - We recommend you to head up to the [Configuration](/) section to custom your - client parameters - - - - If you don't have an L1 endpoint url we recommend you to head up to the - [Verification](/) section to get one - - - -Now if you've ran the above command you should see an error like that: - -```bash -Error: In Sequencer mode, you must define a Chain config path with `--chain-config-path ` or use a preset with `--preset `. -``` - -This is perfect, because we are now going to add a custom chain configuration to your Madara node. - -## Configure Your Chain - -Now that you are able to run Madara let's customize your app chain! Customizing your chain allows you to tailor it to your specific needs, whether that's optimizing for performance, security, or functionality. - -### Customize Chain Settings - -Madara offers various configuration options for your App Chain. You can load and modify your desired configuration via the `--chain-config-path` parameter with an adapted `.yml` chain config. - -Here we will use Starknet mainnet current chain configuration: - -```yml -chain_name: "Starknet Mainnet" -chain_id: "SN_MAIN" -native_fee_token_address: "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d" -parent_fee_token_address: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7" -versioned_constants: - "0.13.0": "crates/primitives/chain_config/resources/versioned_constants_13_0.json" - "0.13.1": "crates/primitives/chain_config/resources/versioned_constants_13_1.json" - "0.13.1.1": "crates/primitives/chain_config/resources/versioned_constants_13_1_1.json" - "0.13.2": "crates/primitives/chain_config/resources/versioned_constants_13_2.json" -eth_core_contract_address: "0xc662c410C0ECf747543f5bA90660f6ABeBD9C8c4" -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: "0x0" -max_nonce_for_validation_skip: 2 -``` - - - For more details regarding all configuration elements of your app chain, - please refer to the [Configuration](/) section in Chain Operators. - - -It can be invoked in your client in two different ways: either by using the `--chain-config-path` parameter followed by the `` where it is located, or by using `--preset mainnet` if it is predefined in Madara. - -Please note that it is possible to override chain config elements via `--chain-config-override`, for example: - -```bash - cargo run --release -- \ - --name Madara \ - --sequencer \ - --base-path /var/lib/madara \ - --preset mainnet \ - --l1-endpoint ${ETHEREUM_API_URL} \ - --chain-config-override sequencer_address=0x123 -``` - -We'll continue with the command above, since the sequencer address of your application chain can't be `0x0`. You should get something like this: - -```bash -Finished `release` profile [optimized] target(s) in 0.75s - Running `target/release/madara --name Madara --sequencer --base-path /tmp/madara --preset mainnet --l1-endpoint 'https://eth-mainnet.g.alchemy.com/v2/Oqh-00iLC3Nx08nkJOg241ky-7JA41cJ' --chain-config-override sequencer_address=0x123` -[2024-10-03 16:10:53 INFO] 🥷 Madara Node -[2024-10-03 16:10:53 INFO] ✌ Version 0.7.0-73989594e65 -[2024-10-03 16:10:53 INFO] 💁 Support URL: https://github.com/madara-alliance/madara/issues -[2024-10-03 16:10:53 INFO] 🏷 Node Name: Madara -[2024-10-03 16:10:53 INFO] 👤 Role: Sequencer -[2024-10-03 16:10:53 INFO] 🌐 Network: Starknet Mainnet (chain id `SN_MAIN`) -[2024-10-03 16:10:53 INFO] 💻 Operating system: MacOS 14.0 Sonoma -[2024-10-03 16:10:53 INFO] 💻 CPU architecture: arm64 -[2024-10-03 16:10:53 INFO] 💻 CPU: Apple M2 Pro -[2024-10-03 16:10:53 INFO] 💻 CPU cores: 12 -[2024-10-03 16:10:53 INFO] 💻 Memory: 16384MB -[2024-10-03 16:10:53 INFO] 💻 Kernel: 23.0.0 -[2024-10-03 16:10:53 INFO] 💾 Opening database at: /tmp/madara -[2024-10-03 16:10:54 INFO] ⏳ Getting initial L1 gas prices -[2024-10-03 16:10:54 INFO] 🚀 Subscribed to L1 state verification -[2024-10-03 16:10:54 INFO] ⛏ Starting block production at block #0 -[2024-10-03 16:10:54 INFO] 📱 Running JSON-RPC server at 127.0.0.1:9944 (allowed origins=["http://localhost:*", "http://127.0.0.1:*", "https://localhost:*", "https://127.0.0.1:*"]) -[2024-10-03 16:10:54 INFO] 📈 Prometheus endpoint started at 127.0.0.1:9615 -[2024-10-03 16:10:55 INFO] 🔄 Updated L1 head #770652 (0x1dc8b2...ae78d4) with state root (0x9cec7d...fbb409) -``` - -Congratulations! Your Custom App Chain is running smoothly. Now let's deploy your first contracts. - -## Bootstrap your App Chain - -Your App Chain is running, but it is mostly empty and you will need an account and some predeployed contracts to interact with it. For that you'll need to use Madara Bootstrapper a tool that helps you deploy your wallet contracts, bridge, ERC20 tokens etc. You can find the full list of contracts [here](/). - - - For more details regarding Madara Bootstrapper, please refer to the - [Bootstrapper](/) section in Chain Operators. - - -To run Madara Bootstrapper you will have to follow the following steps: - - -### Get code - -Fetch the code from the Official [Madara-Bootstrapper](https://github.com/madara-alliance/madara-bootstrapper) repository in the folder of your choice. - -```bash -cd -git clone https://github.com/madara-alliance/madara-bootstrapper . -``` - -### Set your environment Variables - -You need to set the environment variables of your Bootstrapper with the right infos to start it: - -```dotenv -APP_CHAIN_ID="" -ETH_CHAIN_ID=0 -ETH_PRIV_KEY="" -ETH_RPC="" -FEE_TOKEN_ADDRESS="" -L1_DEPLOYER_ADDRESS="" -L1_WAIT_TIME="" -L2_DEPLOYER_ADDRESS="" -ROLLUP_PRIV_KEY="" -ROLLUP_SEQ_URL="" -SN_OS_CONFIG_HASH_VERSION="" -SN_OS_PROGRAM_HASH="" -CROSS_CHAIN_WAIT_TIME=0 -L1_MULTISIG_ADDRESS="" -L2_MULTISIG_ADDRESS="" -VERIFIER_ADDRESS="" -``` - -### Run Bootstrapper - -This command will start the Madara-Bootstrapper based on the previous environment configuration: - -```bash - cargo run --release -``` - - - We recommend you to head up to the [Bootstrapper](/) section to custom your - Bootstrapper parameters - - - -## Interact with your App Chain - -Now that your Sequencer is running properly and you have the means to interact with it, we will proceed with our first transfer. - - - To allow users and applications to interact with your chain, you need to expose a public RPC endpoint via: - - ```bash - --rpc-port 9944 --rpc-external --rpc-cors all - ``` - - Ensure that port `9944` (or your chosen port) is open and accessible. - - - -## Chain Operator Tutorials - -Enhance your skills with these tutorials: - -- **[Installing Madara](https://github.com/madara-alliance/madara/blob/main/docs/installation.md)**: Detailed guide on installing Madara. - -- **[Configuration Guide](https://github.com/madara-alliance/madara/blob/main/docs/configuration.md)**: Learn how to customize your chain's settings. - -- **[Starknet JSON-RPC Methods](https://github.com/madara-alliance/madara/blob/main/docs/json-rpc.md)**: Understand how to interact with your chain programmatically. - -## Next Steps - -- **Explore Advanced Features**: Delve into more complex configurations and optimizations. - -- **Join the Community**: Engage with other Madara users and developers on [Discord](https://discord.gg/madara). - -- **Contribute**: Consider contributing to the Madara project on [GitHub](https://github.com/madara-alliance/madara). - ---- - -_Note: Replace `` with your actual Ethereum RPC endpoint URL. If you don't have one, consider using services like Infura or Alchemy._ From 6bed0e1012d595234795bcfb22fe0f372d63e150 Mon Sep 17 00:00:00 2001 From: antiyro Date: Thu, 17 Oct 2024 15:19:03 +0100 Subject: [PATCH 2/8] cleaned doc for production --- pages/_meta.en.json | 17 +- pages/chain-devnet/_meta.en.json | 3 - pages/chain-management/_meta.en.json | 3 - pages/index.en.mdx | 13 +- pages/quickstart/_meta.en.json | 4 +- .../{quickstart_1.en.mdx => launch.en.mdx} | 2 +- pages/tutorials-full-node/_meta.en.json | 3 +- pages/tutorials-full-node/customize.en.mdx | 165 ++++++++++++ pages/tutorials-full-node/launch.en.mdx | 95 +++++++ pages/tutorials-full-node/query.en.mdx | 239 ++++++++++++++++++ 10 files changed, 517 insertions(+), 27 deletions(-) delete mode 100644 pages/chain-devnet/_meta.en.json delete mode 100644 pages/chain-management/_meta.en.json rename pages/quickstart/{quickstart_1.en.mdx => launch.en.mdx} (99%) create mode 100644 pages/tutorials-full-node/customize.en.mdx create mode 100644 pages/tutorials-full-node/launch.en.mdx create mode 100644 pages/tutorials-full-node/query.en.mdx diff --git a/pages/_meta.en.json b/pages/_meta.en.json index 9249d94..20e7cb2 100644 --- a/pages/_meta.en.json +++ b/pages/_meta.en.json @@ -9,9 +9,6 @@ "pagination": false } }, - "Installation": { - "title": "Installation" - }, "quickstart": { "title": "Quickstart" }, @@ -29,9 +26,6 @@ "chain-configuration": { "title": "Configuration" }, - "chain-management": { - "title": "Management" - }, "--- NODE OPERATORS": { "title": "NODE OPERATORS", @@ -40,6 +34,9 @@ "introduction": { "title": "Overview" }, + "installation": { + "title": "Installation" + }, "fundamentals": { "title": "Fundamentals" }, @@ -52,14 +49,6 @@ "display": "hidden" }, - "--- DEVNET": { - "title": "DEVNET", - "type": "separator" - }, - "chain-devnet": { - "title": "Devnet" - }, - "--- Tutorials": { "title": "TUTORIALS", "type": "separator" diff --git a/pages/chain-devnet/_meta.en.json b/pages/chain-devnet/_meta.en.json deleted file mode 100644 index abe6840..0000000 --- a/pages/chain-devnet/_meta.en.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "configuration": "Configuration" -} diff --git a/pages/chain-management/_meta.en.json b/pages/chain-management/_meta.en.json deleted file mode 100644 index abe6840..0000000 --- a/pages/chain-management/_meta.en.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "configuration": "Configuration" -} diff --git a/pages/index.en.mdx b/pages/index.en.mdx index 766967e..bdc9572 100644 --- a/pages/index.en.mdx +++ b/pages/index.en.mdx @@ -17,6 +17,8 @@ import { PanelsTopLeft, Package, Rocket, + Wrench, + BrainCircuit } from "lucide-react"; # Welcome to the Madara Documentation @@ -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 @@ -68,12 +70,17 @@ Take a look at these essential tools to get started with Madara and Cairo. } + icon={} /> } + icon={} + /> + } /> {/* diff --git a/pages/quickstart/_meta.en.json b/pages/quickstart/_meta.en.json index 5cc8992..26c3d19 100644 --- a/pages/quickstart/_meta.en.json +++ b/pages/quickstart/_meta.en.json @@ -1,5 +1,5 @@ { - "quickstart_1": { - "href": "/quickstart/quickstart_1" + "launch": { + "title": "Launch your App Chain!" } } diff --git a/pages/quickstart/quickstart_1.en.mdx b/pages/quickstart/launch.en.mdx similarity index 99% rename from pages/quickstart/quickstart_1.en.mdx rename to pages/quickstart/launch.en.mdx index 9af840e..de332b8 100644 --- a/pages/quickstart/quickstart_1.en.mdx +++ b/pages/quickstart/launch.en.mdx @@ -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. diff --git a/pages/tutorials-full-node/_meta.en.json b/pages/tutorials-full-node/_meta.en.json index 8a31d03..391d0cf 100644 --- a/pages/tutorials-full-node/_meta.en.json +++ b/pages/tutorials-full-node/_meta.en.json @@ -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?" } diff --git a/pages/tutorials-full-node/customize.en.mdx b/pages/tutorials-full-node/customize.en.mdx new file mode 100644 index 0000000..c111668 --- /dev/null +++ b/pages/tutorials-full-node/customize.en.mdx @@ -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"; +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 -- + + + We recommend continuing with the [Next Section](#step-by-step-tutorial), which will help you better understand the different components of Madara customization. + + +## Step by step tutorial + + + 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). + + +### 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. + + + + ### 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 `**: Specify JSON-RPC server TCP port. + + - **`--rpc-cors `**: Specify browser Origins allowed to access the HTTP & WS RPC servers. + + - **`--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. + + + 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). + + + ### 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 `**: 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" + ``` + + + 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`. + + + 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 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" + ``` + + + 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). diff --git a/pages/tutorials-full-node/launch.en.mdx b/pages/tutorials-full-node/launch.en.mdx new file mode 100644 index 0000000..f129f80 --- /dev/null +++ b/pages/tutorials-full-node/launch.en.mdx @@ -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"; +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/ + + + 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. + + +## Step by step tutorial + +### Install your Full Node + + + ### 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 + 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} + ``` + + + If you don't have an L1 endpoint url we recommend you to head up to the + [Verification](/) section to get one + + \ No newline at end of file diff --git a/pages/tutorials-full-node/query.en.mdx b/pages/tutorials-full-node/query.en.mdx new file mode 100644 index 0000000..97d3148 --- /dev/null +++ b/pages/tutorials-full-node/query.en.mdx @@ -0,0 +1,239 @@ +--- +title: How to Query a Madara RPC Endpoint +lang: en-US +description: Learn how to query a Madara RPC endpoint +--- + +import { Steps } from "nextra-theme-docs"; +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 Query a Madara RPC Endpoint + +This guide will walk you through the process of querying a Madara RPC endpoint to interact with your Madara Full Node and the Starknet network. + +## Quick Start Tutorial + +As an introduction to the following section, we have created a video tutorial to give you more context on how to query your Madara RPC endpoint. + +-- Insert video here -- + + + We recommend continuing with the [Step-by-Step Tutorial](#step-by-step-tutorial), which will help you better understand how to interact with Madara RPC endpoints. + + +## Step-by-Step Tutorial + +### Interact with the Madara RPC Endpoint + + + +### Prerequisites + +Before you begin, ensure that: + +1. **You have a Madara client running**: If you haven't set up a node yet, you can refer to the [Launch a Madara Full Node](/tutorials-full-node/launch) tutorial. +2. **This client have an RPC Endpoint accessible**: You can expose the RPC endpoint of your Madara client by using the following parameters: + + - **`--rpc-port `**: Specify JSON-RPC server TCP port. + + - **`--rpc-cors `**: Specify browser Origins allowed to access the HTTP & WS RPC servers. + + - **`--rpc-external`**: Listen to all RPC interfaces. Default is local. + +3. **You have an HTTP Client Tool**: Have a tool to make HTTP POST requests, such as [curl](https://curl.se/docs/manpage.html), [Postman](https://www.postman.com/), or any programming language with HTTP capabilities. + +### Understanding the JSON-RPC Interface + +Now that you have everything set up, let's try to understand the interface Madara exposes. +A Madara client exposes a JSON-RPC interface that adheres to the latest [Starknet JSON-RPC specifications](https://github.com/starkware-libs/starknet-specs/releases). This interface allows you to interact with the node by sending JSON-RPC requests and receiving responses. + +Cette interface JSON-RPC a plusieurs catégorie de methodes: + +- **Read methods**: des methodes de lecture seule, celles ci vont juste demander a votre client des donnees statique stockee par celui ci tel que par exemple les transactions du block 100000. +- **Historical methods**: Celle-ci sont des methodes de lecture particulieres. Toutes les methodes finissant par "at" tel que `starknet_getStorageAt` vous permettent de recuperer une valeur a un momment donnee de sa vie. L'address de stockage 0x5 d'un contract peut avoir eu la valeur "0x123" au block 50000 et "0x321" au block 100000. +- **Trace methods**: ces methodes permettent de generer la trace d'une execution et necessitent generalement une re-execution de celle ci via Blockifier +- **Write methods**: ces methodes vont directement modifier l'état de la chaine en question. Si celle-ci sont run depuis un Full Node alors celui-ci les forward au sequencer, seul responsavle des modification d'etat + +### Testing the Connection + +To verify that your client is accessible, let's send a simple request to get the chain id: + + + **Note**: Pour des raisons de simplicité ici nous allons utiliser l'endpoint par defaut: http://localhost:9944, il se peut que le votre soit different, pour savoir quel est votre endpoint RPC veuillez examiner les logs au lancement de votre client. + + +```bash +curl --location 'http://localhost:9944' \ +--header 'Content-Type: application/json' \ +--data '{ + "jsonrpc": "2.0", + "method": "starknet_chainId", + "params": [], + "id": 1 +}' +``` + +**Expected Response:** + +```json +{ + "jsonrpc": "2.0", + "result": "0x534e5f4d41494e", // Example chain ID in hexadecimal + "id": 1 +} +``` + +If you receive a response similar to the above, your node is accessible and ready to accept JSON-RPC requests. + +### Perform a Read call + +No let's go further and try to retrieve the most recent block and its transactions: + +```bash +curl --location 'http://localhost:9944' \ +--header 'Content-Type: application/json' \ +--data '{ + "jsonrpc": "2.0", + "method": "starknet_blockNumber", + "params": [], + "id": 1 +}' +``` + +**Response:** + +```json +{ + "jsonrpc": "2.0", + "result": 12345, // Example block number + "id": 1 +} +``` + +### Perform an historical call + +To get detailed information about a specific storage value at a specific moment you can run the `starknet_getStorageAt` historical call. + +**Example Request:** + +```bash +curl --location 'http://localhost:9944' \ +--header 'Content-Type: application/json' \ +--data '{ + "jsonrpc": "2.0", + "method": "starknet_getStorageAt", + "params": { + "contract_address": "0x124aeb495b947201f5fac96fd1138e326ad86195b98df6dec9009158a533b49", + "key": "0x1001e85047571380eed1d7e1cc5a9af6a707b3d65789bb1702c7d680e5e87e", + "block_id": "latest" + }, + "id": 1 +}' +``` + +### Perform an trace call + +To get detailed information about a specific storage value at a specific moment you can run the `starknet_getStorageAt` historical call. + +**Example Request:** + +```bash +curl --location 'https://free-rpc.nethermind.io/mainnet-juno/' \ +--header 'Content-Type: application/json' \ +--data '{ + "jsonrpc": "2.0", + "method": "starknet_traceTransaction", + "params": { + "transaction_hash": "0x7641514f46a77013e80215cdce2e55d5aca49c13428b885c7ecb9d3ddb4ab11" + }, + "id": 1 +}' +``` + +### Using JSON-RPC Clients and Libraries + +While `curl` is useful for quick tests, you can use programming languages and libraries to interact with the RPC endpoint more efficiently. + +#### Using JavaScript and Axios + +**JavaScript Example:** + +```javascript +const axios = require('axios'); + +const rpcEndpoint = 'http://localhost:9944/'; + +const getBlockNumber = async () => { + try { + const response = await axios.post(rpcEndpoint, { + jsonrpc: '2.0', + method: 'starknet_blockNumber', + params: [], + id: 1 + }); + console.log('Current block number:', response.data.result); + } catch (error) { + console.error('Error:', error.response.data.error); + } +}; + +getBlockNumber(); +``` + +### Exploring Available Methods + +You can find the list of available methods in the [Starknet JSON-RPC methods documentation](https://github.com/starkware-libs/starknet-specs). + +**Commonly Used Methods:** + +- `starknet_getTransactionByHash` +- `starknet_getTransactionReceipt` +- `starknet_getClass` +- `starknet_getNonce` +- `starknet_getEvents` + +### Using RPC Playgrounds + +To experiment with JSON-RPC methods interactively, you can use online tools: + +- **Voyager Playground**: [rpc-request-builder.voyager.online](https://rpc-request-builder.voyager.online/) +- **OpenRPC Playground**: [playground.open-rpc.org](https://playground.open-rpc.org/?uiSchema%5BappBar%5D%5Bui:splitView%5D=false&schemaUrl=https://raw.githubusercontent.com/starkware-libs/starknet-specs/master/api/starknet_api_openrpc.json&uiSchema%5BappBar%5D%5Bui:input%5D=false&uiSchema%5BappBar%5D%5Bui:darkMode%5D=true&uiSchema%5BappBar%5D%5Bui:examplesDropdown%5D=false) + + + **Note**: Adjust the endpoint URL in these tools to point to your Madara node. + + +### Next Steps + +Now that you're familiar with querying the Madara RPC endpoint, you can: + +- **Build Applications**: Create applications that interact with the Starknet network. +- **Monitor Blockchain Data**: Track events, transactions, and state changes. +- **Integrate Tools**: Use wallets and other tools that leverage the JSON-RPC API. + + + + + For more advanced interactions, consider using Starknet SDKs or client libraries that provide higher-level abstractions over the JSON-RPC API. + + +## Summary + +In this tutorial, you've learned how to: + +- **Access the Madara RPC Endpoint**: Connect to your node's RPC interface. +- **Send JSON-RPC Requests**: Query blockchain data and interact with smart contracts. +- **Handle Responses and Errors**: Interpret successful responses and manage errors. +- **Use Tools and Libraries**: Leverage programming languages and online tools for efficient interaction. + +By leveraging the JSON-RPC interface, you can fully interact with the Starknet network through your Madara Full Node. + +--- \ No newline at end of file From ec8b66bb7b0d7a1c6d49794c08168f9e9dadf6b2 Mon Sep 17 00:00:00 2001 From: antiyro Date: Thu, 17 Oct 2024 15:30:02 +0100 Subject: [PATCH 3/8] added a sequencer section --- pages/chain-architecture/sequencer.en.mdx | 46 ++++++++++++++++++++--- pages/tutorials-sequencer/_meta.en.json | 2 - 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/pages/chain-architecture/sequencer.en.mdx b/pages/chain-architecture/sequencer.en.mdx index 0912196..f1f5846 100644 --- a/pages/chain-architecture/sequencer.en.mdx +++ b/pages/chain-architecture/sequencer.en.mdx @@ -1,7 +1,7 @@ --- -title: Sequencer +title: What is a sequencer? lang: en-US -description: A guide to monitor your node using Sequencer. +description: Learn about what is a Sequencer --- import { Steps } from "nextra-theme-docs"; @@ -15,8 +15,42 @@ import { } from "@fortawesome/free-brands-svg-icons"; import { Tabs, Tab } from "nextra/components"; -# 🚧 Sequencer +# Sequencer - - This section is still under construction. - +Sequencers are a crucial component of the Starknet network, playing a role similar to validators in Ethereum. They serve as the backbone of the Starknet ecosystem, responsible for ushering transactions into the system. + +In the context of Validity Rollups like Starknet, sequencers are specialized entities that handle transaction processing. Their primary function is to provide transaction capacity to the network, rather than security (which is handled differently in this architecture). + +## How Sequencers Work + +Sequencers follow a systematic method for processing transactions, which can be broken down into four main steps: + +1. **Sequencing**: Sequencers collect transactions from users and order them. +2. **Executing**: After collection, sequencers process these transactions. +3. **Batching**: For efficiency, transactions are grouped together in batches. +4. **Block Production**: Finally, sequencers produce blocks that contain these batches of processed transactions. + +This process allows Validity Rollups like Starknet to handle a higher volume of transactions while maintaining the security of the underlying Ethereum network, thus enhancing scalability without compromising on security. + +## The Role of Sequencers in Transaction Flow + +To understand how sequencers fit into the broader Starknet ecosystem, let's look at the transaction flow: + +1. A transaction is received by a gateway (which serves as the Mempool) and is marked as `RECEIVED` (See [Transaction Flow](https://docs.starknet.io/architecture-and-concepts/network-architecture/starknet-architecture-overview#transaction-flow)). +2. The sequencer then incorporates the transaction into the network state and tags it as `ACCEPTED_ON_L2`. +3. After the sequencer has done its job, a prover executes the operating system on the new block, calculates its proof, and submits it to Layer 1 (Ethereum) for verification. + +## Requirements for Sequencers + +Sequencers play a critical role in the network's smooth functioning, and as such, they must meet certain requirements: + +1. **Reliability**: Sequencers need to be highly reliable to ensure consistent transaction processing. +2. **Availability**: High availability is crucial as sequencers must be ready to process transactions at all times. +3. **Computational Power**: Sequencers require powerful machines to perform their role effectively, as they must process transactions rapidly and continuously. +4. **Network Connectivity**: Well-connected machines are necessary to ensure efficient communication within the network. + +## Future of Sequencers in Starknet + +It's worth noting that Starknet is actively moving towards decentralization [Starknet Architecture Overview](https://docs.starknet.io/architecture-and-concepts/network-architecture/starknet-architecture-overview#starknet-architecture-overview). The current roadmap for Starknet includes plans to decentralize the sequencer role. This shift towards decentralization will allow more participants to become sequencers, contributing to the overall robustness and resilience of the network. + +Sequencers are a vital component of the Starknet ecosystem, responsible for ordering, executing, and batching transactions into blocks. Their efficient operation is crucial for Starknet's ability to handle high transaction volumes while maintaining security and scalability. \ No newline at end of file diff --git a/pages/tutorials-sequencer/_meta.en.json b/pages/tutorials-sequencer/_meta.en.json index 7903bbb..d4fed72 100644 --- a/pages/tutorials-sequencer/_meta.en.json +++ b/pages/tutorials-sequencer/_meta.en.json @@ -1,6 +1,4 @@ { - "what": "What is a sequencer on Starknet?", - "how": "How to run a Madara sequencer?", "sync_fgw": "How to sync Madara with Madara (FGW)?", "query_fgw": "How to query Madara FGW endpoint?" } From 160252933034ad2ce96c85916b628427ac1d3a60 Mon Sep 17 00:00:00 2001 From: antiyro Date: Thu, 17 Oct 2024 15:51:09 +0100 Subject: [PATCH 4/8] added more relevent categories and removed others --- pages/_meta.en.json | 15 +++++++-- pages/about/_meta.en.json | 25 --------------- pages/about/contribute.en.mdx | 1 - pages/about/ecosystem.en.mdx | 1 - pages/about/version.en.mdx | 1 - pages/{about => }/credits.en.mdx | 0 .../{about/license.en.mdx => liscense.en.mdx} | 0 pages/releases.en.mdx | 32 +++++++++++++++++++ pages/{about => }/support.en.mdx | 0 9 files changed, 44 insertions(+), 31 deletions(-) delete mode 100644 pages/about/_meta.en.json delete mode 100644 pages/about/contribute.en.mdx delete mode 100644 pages/about/ecosystem.en.mdx delete mode 100644 pages/about/version.en.mdx rename pages/{about => }/credits.en.mdx (100%) rename pages/{about/license.en.mdx => liscense.en.mdx} (100%) create mode 100644 pages/releases.en.mdx rename pages/{about => }/support.en.mdx (100%) diff --git a/pages/_meta.en.json b/pages/_meta.en.json index 20e7cb2..01d3da8 100644 --- a/pages/_meta.en.json +++ b/pages/_meta.en.json @@ -49,7 +49,7 @@ "display": "hidden" }, - "--- Tutorials": { + "--- TUTORIALS": { "title": "TUTORIALS", "type": "separator" }, @@ -67,8 +67,17 @@ "title": "ABOUT", "type": "separator" }, - "about": { - "type": "page" + "releases": { + "title": "Releases Notes" + }, + "liscense": { + "title": "Liscence" + }, + "support": { + "title": "Support" + }, + "credits": { + "title": "Credits" }, "contact": { "title": "Contact ↗", diff --git a/pages/about/_meta.en.json b/pages/about/_meta.en.json deleted file mode 100644 index 840de9d..0000000 --- a/pages/about/_meta.en.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "version": { - "title": "Version", - "display": "hidden" - }, - "license": { - "title": "License" - }, - "contribute": { - "title": "Contribute", - "display": "hidden" - }, - "ecosystem": { - "title": "Ecosystem", - "display": "hidden" - }, - "support": { - "title": "Support", - "display": "hidden" - }, - "credits": { - "title": "Credits", - "display": "hidden" - } -} diff --git a/pages/about/contribute.en.mdx b/pages/about/contribute.en.mdx deleted file mode 100644 index e862618..0000000 --- a/pages/about/contribute.en.mdx +++ /dev/null @@ -1 +0,0 @@ -## contribute page diff --git a/pages/about/ecosystem.en.mdx b/pages/about/ecosystem.en.mdx deleted file mode 100644 index 99ef6fe..0000000 --- a/pages/about/ecosystem.en.mdx +++ /dev/null @@ -1 +0,0 @@ -## ecosystem page diff --git a/pages/about/version.en.mdx b/pages/about/version.en.mdx deleted file mode 100644 index 4aa4573..0000000 --- a/pages/about/version.en.mdx +++ /dev/null @@ -1 +0,0 @@ -## this is about diff --git a/pages/about/credits.en.mdx b/pages/credits.en.mdx similarity index 100% rename from pages/about/credits.en.mdx rename to pages/credits.en.mdx diff --git a/pages/about/license.en.mdx b/pages/liscense.en.mdx similarity index 100% rename from pages/about/license.en.mdx rename to pages/liscense.en.mdx diff --git a/pages/releases.en.mdx b/pages/releases.en.mdx new file mode 100644 index 0000000..fe5e7fd --- /dev/null +++ b/pages/releases.en.mdx @@ -0,0 +1,32 @@ +--- +title: Madara Release Notes +--- + +import { Steps } from "nextra-theme-docs"; +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"; + +# Madara Release Notes + +The following release notes cover the ongoing version changes to Madara. + +## Madara Environments + +Within Madara's client, there are separate and distinct components that operate independently of each other. + +### Current Versions Supported of Each Components + +| Starknet | Sierra | Cairo | JSON-RPC | Blockifier | +|----------|--------|---------------|----------|------------| +| 0.13.2 | 1.6.0 | 2.0.0 - 2.8.2 | >= 0.7.1 | >=0.8.0 | + +## Madara v0.9.0 (October 24, 2024) + +### New Features and Enhancements diff --git a/pages/about/support.en.mdx b/pages/support.en.mdx similarity index 100% rename from pages/about/support.en.mdx rename to pages/support.en.mdx From d358a7ed1604ece8de1c28bc1ba66a716bd1e447 Mon Sep 17 00:00:00 2001 From: antiyro Date: Thu, 17 Oct 2024 16:52:45 +0100 Subject: [PATCH 5/8] added more tutorials --- pages/_meta.en.json | 3 - pages/tutorials-chain/_meta.en.json | 3 +- pages/tutorials-chain/custom.en.mdx | 116 ++++++++++++++++++++++ pages/tutorials-chain/how.en.mdx | 124 ++++++++++++++++++++++++ pages/tutorials-sequencer/_meta.en.json | 4 - 5 files changed, 241 insertions(+), 9 deletions(-) create mode 100644 pages/tutorials-chain/custom.en.mdx create mode 100644 pages/tutorials-chain/how.en.mdx delete mode 100644 pages/tutorials-sequencer/_meta.en.json diff --git a/pages/_meta.en.json b/pages/_meta.en.json index 01d3da8..1cd6b18 100644 --- a/pages/_meta.en.json +++ b/pages/_meta.en.json @@ -56,9 +56,6 @@ "tutorials-full-node": { "title": "Full Node" }, - "tutorials-sequencer": { - "title": "Sequencer" - }, "tutorials-chain": { "title": "App Chain" }, diff --git a/pages/tutorials-chain/_meta.en.json b/pages/tutorials-chain/_meta.en.json index 7e99803..6ad85c5 100644 --- a/pages/tutorials-chain/_meta.en.json +++ b/pages/tutorials-chain/_meta.en.json @@ -1,5 +1,4 @@ { - "what": "What's an App Chain?", - "how": "How to deploy your own Starknet mainnet?", + "how": "How to launch your own App Chain?", "custom": "How to custom your App Chain?" } diff --git a/pages/tutorials-chain/custom.en.mdx b/pages/tutorials-chain/custom.en.mdx new file mode 100644 index 0000000..3f19d7c --- /dev/null +++ b/pages/tutorials-chain/custom.en.mdx @@ -0,0 +1,116 @@ +--- +title: Customize a Madara App Chain +lang: en-US +description: Learn how to customize a Madara App chain +--- + +import { Steps } from "nextra-theme-docs"; +import { Callout } from "nextra-theme-docs"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { + faLinux, + faApple, + faWindows, +} from "@fortawesome/free-brands-svg-icons"; + +# How to customize your App Chain + +This guide will walk you through the process of customizing a Madara client for your specific App Chain needs. + +## 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 App Chain. + +-- Video goes here -- + + + We recommend continuing with the [Next Section](#step-by-step-tutorial), which will help you better understand the different components of Madara customization. + + +## Step by step tutorial + + + This tutorial assumes that you already know how to launch a Madara App Chain. For more information about how to launch a Madara App Chain, please head up to [this tutorial](/tutorials-chain/how). + + +### Configure your Madara client + +Now that you have your client installed and running smoothly in sequencer mode, you may want to configure it further to match your desired setup or network. There are two types of configuration for your node: + +- **Node Configuration**: the configuration of your node itself as a sequencer 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 your App Chain manipulating only the Chain Configuration (for advanced Node configuration please visit the [Configuration](fundamentals/configuration) section of the Node Operator section). + +Here, we will simply imagine that our node wants to launch 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 `**: Specifies the chain configuration file path. + +Which in our case would give the following command: + +```bash +cargo run --release -- \ +--name Madara \ +--sequencer +--base-path /var/lib/madara \ +--l1-endpoint ${ETHEREUM_API_URL} \ +--chain-config-path "/path/to/your/config.yml" +``` + +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: + +- **`--preset `**: Uses a preset as the chain configuration. + - Possible values: `mainnet`, `sepolia`, `integration`, `devnet` + +- **`--chain-config-override `**: Overrides specific chain configuration parameters. + +This would give the following command: + +```bash +cargo run --release -- \ +--name Madara \ +--sequencer \ +--preset 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" +``` + +You now know how to customize your App Chain! To learn more about customizing your client, visit the sections [Node Configuration](/fundamentals/configuration) and [Chain Configuration](/chain-configuration/parameters). diff --git a/pages/tutorials-chain/how.en.mdx b/pages/tutorials-chain/how.en.mdx new file mode 100644 index 0000000..146c040 --- /dev/null +++ b/pages/tutorials-chain/how.en.mdx @@ -0,0 +1,124 @@ +--- +title: How to launch your own App Chain +lang: en-US +description: Learn how to launch your own App Chain +--- + +import { Steps } from "nextra-theme-docs"; +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 your first App-Chain with Madara + +This guide will walk you through the process of launching your own App Chain using Madara. + +## Quick start tutorial + +As an introduction to the following section, we created a video tutorial to give you more context how to launch your own App Chain. + +/video goes here/ + +## Step by step tutorial + + + +### Understand Madara Components + +Now that you have some context around the Madara client, it's important to understand the fundamental components of Madara and how it functions as a Starknet client. + +- **Chain Architecture**: Madara currently works exactly like Starknet mainnet with a centralized sequencer that will produce the state of your chain. This one will then serve the data for proving trough SNOS and Sharp (the zk-stark prover). This means that your sequencer is the only one capable of producing state. You can then connect as many full nodes as you like to it. We recommend you to familiarize yourself with the [architecture](https://github.com/madara-alliance/madara) to understand how the entire flow works. + +- **Bootstrapper**: To easily deploy your first set of contracts and authority accounts you'll have to use Madara Bootstrapper. + +- **Smart Contracts**: Madara allows you to deploy and interact with Cairo smart contracts. Understanding Cairo contracts will help you make the most of your self-hosted chain. + +- **Interacting**: Madara is 100% compatible with the latest Starknet specs. You can then easily interact with your Madara client trough its JSON-RPC endpoint or FGW. + +### Install Madara + +This installation process will help you build the binary directly from the source code locally on your machine. + + + You'll find other installation methods such as Docker in the + [Installation](/get-started/install) section of the Node Operator category. + + + +### 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 +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 which will begin a basic deployment depending on your chosen mode: + +```bash + cargo run --release -- \ + --name Madara \ + --sequencer + --base-path /var/lib/madara \ + --l1-endpoint ${ETHEREUM_API_URL} +``` + + + We recommend you to head up to the [Configuration](/) section to custom your + client parameters + + + + If you don't have an L1 endpoint url we recommend you to head up to the + [Verification](/) section to get one + + + +Now if you've ran the above command you should see an error like that: + +```bash +Error: In Sequencer mode, you must define a Chain config path with `--chain-config-path ` or use a preset with `--preset `. +``` + +You now have your first App Chain running! We now recomand you to customize it in the following tutorial [How to customize your App Chain](/tutorials-chain/custom). \ No newline at end of file diff --git a/pages/tutorials-sequencer/_meta.en.json b/pages/tutorials-sequencer/_meta.en.json deleted file mode 100644 index d4fed72..0000000 --- a/pages/tutorials-sequencer/_meta.en.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "sync_fgw": "How to sync Madara with Madara (FGW)?", - "query_fgw": "How to query Madara FGW endpoint?" -} From cfdab0a0870de3934de6ba7135f8e5c64694adeb Mon Sep 17 00:00:00 2001 From: antiyro Date: Thu, 17 Oct 2024 16:58:14 +0100 Subject: [PATCH 6/8] cleaned for ci --- pages/chain-architecture/sequencer.en.mdx | 2 +- pages/index.en.mdx | 2 +- pages/quickstart/launch.en.mdx | 5 +- pages/releases.en.mdx | 2 +- pages/tutorials-chain/custom.en.mdx | 80 ++++--- pages/tutorials-chain/how.en.mdx | 3 +- pages/tutorials-full-node/customize.en.mdx | 235 +++++++++++---------- pages/tutorials-full-node/launch.en.mdx | 7 +- pages/tutorials-full-node/query.en.mdx | 44 ++-- 9 files changed, 198 insertions(+), 182 deletions(-) diff --git a/pages/chain-architecture/sequencer.en.mdx b/pages/chain-architecture/sequencer.en.mdx index f1f5846..511652c 100644 --- a/pages/chain-architecture/sequencer.en.mdx +++ b/pages/chain-architecture/sequencer.en.mdx @@ -53,4 +53,4 @@ Sequencers play a critical role in the network's smooth functioning, and as such It's worth noting that Starknet is actively moving towards decentralization [Starknet Architecture Overview](https://docs.starknet.io/architecture-and-concepts/network-architecture/starknet-architecture-overview#starknet-architecture-overview). The current roadmap for Starknet includes plans to decentralize the sequencer role. This shift towards decentralization will allow more participants to become sequencers, contributing to the overall robustness and resilience of the network. -Sequencers are a vital component of the Starknet ecosystem, responsible for ordering, executing, and batching transactions into blocks. Their efficient operation is crucial for Starknet's ability to handle high transaction volumes while maintaining security and scalability. \ No newline at end of file +Sequencers are a vital component of the Starknet ecosystem, responsible for ordering, executing, and batching transactions into blocks. Their efficient operation is crucial for Starknet's ability to handle high transaction volumes while maintaining security and scalability. diff --git a/pages/index.en.mdx b/pages/index.en.mdx index bdc9572..462e5c4 100644 --- a/pages/index.en.mdx +++ b/pages/index.en.mdx @@ -18,7 +18,7 @@ import { Package, Rocket, Wrench, - BrainCircuit + BrainCircuit, } from "lucide-react"; # Welcome to the Madara Documentation diff --git a/pages/quickstart/launch.en.mdx b/pages/quickstart/launch.en.mdx index de332b8..9b5acc5 100644 --- a/pages/quickstart/launch.en.mdx +++ b/pages/quickstart/launch.en.mdx @@ -31,10 +31,13 @@ As an introduction to the following section, we created a video tutorial to give ``` ### Follow the tutorial + - We recommend continuing with the [Next Section](#build-your-chain-from-source), which will help you better understand the different components of Madara by building from source. + We recommend continuing with the [Next + Section](#build-your-chain-from-source), which will help you better understand + the different components of Madara by building from source. ## Build Your Chain from source diff --git a/pages/releases.en.mdx b/pages/releases.en.mdx index fe5e7fd..3a9e738 100644 --- a/pages/releases.en.mdx +++ b/pages/releases.en.mdx @@ -24,7 +24,7 @@ Within Madara's client, there are separate and distinct components that operate ### Current Versions Supported of Each Components | Starknet | Sierra | Cairo | JSON-RPC | Blockifier | -|----------|--------|---------------|----------|------------| +| -------- | ------ | ------------- | -------- | ---------- | | 0.13.2 | 1.6.0 | 2.0.0 - 2.8.2 | >= 0.7.1 | >=0.8.0 | ## Madara v0.9.0 (October 24, 2024) diff --git a/pages/tutorials-chain/custom.en.mdx b/pages/tutorials-chain/custom.en.mdx index 3f19d7c..6aae9ab 100644 --- a/pages/tutorials-chain/custom.en.mdx +++ b/pages/tutorials-chain/custom.en.mdx @@ -1,48 +1,41 @@ ---- -title: Customize a Madara App Chain -lang: en-US -description: Learn how to customize a Madara App chain ---- +Here is the corrected version of the text with minor grammatical adjustments: -import { Steps } from "nextra-theme-docs"; -import { Callout } from "nextra-theme-docs"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { - faLinux, - faApple, - faWindows, -} from "@fortawesome/free-brands-svg-icons"; +--- -# How to customize your App Chain +# How to Customize Your App Chain This guide will walk you through the process of customizing a Madara client for your specific App Chain needs. -## Quick start tutorial +## 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 App Chain. +As an introduction to the following section, we have created a video tutorial to give you more context on how to customize your Madara App Chain. -- Video goes here -- - We recommend continuing with the [Next Section](#step-by-step-tutorial), which will help you better understand the different components of Madara customization. + We recommend continuing with the [Next Section](#step-by-step-tutorial), which + will help you better understand the different components of Madara + customization. -## Step by step tutorial +## Step-by-Step Tutorial - This tutorial assumes that you already know how to launch a Madara App Chain. For more information about how to launch a Madara App Chain, please head up to [this tutorial](/tutorials-chain/how). + This tutorial assumes that you already know how to launch a Madara App Chain. + For more information about how to launch a Madara App Chain, please refer to + [this tutorial](/tutorials-chain/how). -### Configure your Madara client +### Configure Your Madara Client Now that you have your client installed and running smoothly in sequencer mode, you may want to configure it further to match your desired setup or network. There are two types of configuration for your node: - **Node Configuration**: the configuration of your node itself as a sequencer 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 your App Chain manipulating only the Chain Configuration (for advanced Node configuration please visit the [Configuration](fundamentals/configuration) section of the Node Operator section). +In this tutorial, we'll focus on a simple configuration of your App Chain by manipulating only the Chain Configuration (for advanced Node configuration, please visit the [Configuration](fundamentals/configuration) section of the Node Operator guide). -Here, we will simply imagine that our node wants to launch a Starknet clone App Chain with the following configuration: +Here, we will imagine that our node wants to launch a Starknet clone App Chain with the following configuration: ```yml chain_name: "Starklone" @@ -55,45 +48,46 @@ 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 + 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: +You simply need to save this configuration as a `.yml` file somewhere on your machine and call it via: - **`--chain-config-path `**: Specifies the chain configuration file path. -Which in our case would give the following command: +In our case, the command would be: ```bash cargo run --release -- \ --name Madara \ ---sequencer +--sequencer \ --base-path /var/lib/madara \ --l1-endpoint ${ETHEREUM_API_URL} \ --chain-config-path "/path/to/your/config.yml" ``` -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: +Another way to run this configuration would be to override the elements that differ from the original Starknet mainnet configuration using: - **`--preset `**: Uses a preset as the chain configuration. + - Possible values: `mainnet`, `sepolia`, `integration`, `devnet` - **`--chain-config-override `**: Overrides specific chain configuration parameters. @@ -113,4 +107,4 @@ cargo run --release -- \ --chain-config-override chain_name="Starklone" chain_id="SN_KLONE" native_fee_token_address="0x012345a0fc34fa1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d" parent_fee_token_address="0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7" sequencer_address="0x01234a1bd84444c89232ec27754698e5d2e7e1a7f1539f12027f28b23ec9f3d8" ``` -You now know how to customize your App Chain! To learn more about customizing your client, visit the sections [Node Configuration](/fundamentals/configuration) and [Chain Configuration](/chain-configuration/parameters). +You now know how to customize your App Chain! To learn more about customizing your client, visit the [Node Configuration](/fundamentals/configuration) and [Chain Configuration](/chain-configuration/parameters) sections. diff --git a/pages/tutorials-chain/how.en.mdx b/pages/tutorials-chain/how.en.mdx index 146c040..1fb4557 100644 --- a/pages/tutorials-chain/how.en.mdx +++ b/pages/tutorials-chain/how.en.mdx @@ -50,7 +50,6 @@ This installation process will help you build the binary directly from the sourc [Installation](/get-started/install) section of the Node Operator category. - ### Install dependencies We first need to make sure you have everything needed to complete this tutorial. @@ -121,4 +120,4 @@ Now if you've ran the above command you should see an error like that: Error: In Sequencer mode, you must define a Chain config path with `--chain-config-path ` or use a preset with `--preset `. ``` -You now have your first App Chain running! We now recomand you to customize it in the following tutorial [How to customize your App Chain](/tutorials-chain/custom). \ No newline at end of file +You now have your first App Chain running! We now recomand you to customize it in the following tutorial [How to customize your App Chain](/tutorials-chain/custom). diff --git a/pages/tutorials-full-node/customize.en.mdx b/pages/tutorials-full-node/customize.en.mdx index c111668..580e8cf 100644 --- a/pages/tutorials-full-node/customize.en.mdx +++ b/pages/tutorials-full-node/customize.en.mdx @@ -26,13 +26,17 @@ As an introduction to the following section, we created a video tutorial to give -- Video goes here -- - We recommend continuing with the [Next Section](#step-by-step-tutorial), which will help you better understand the different components of Madara customization. + We recommend continuing with the [Next Section](#step-by-step-tutorial), which + will help you better understand the different components of Madara + customization. ## Step by step tutorial - 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). + 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). ### Configure your Full Node @@ -48,118 +52,125 @@ In this tutorial, we'll focus on a simple configuration of both so you can under ### 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 `**: Specify JSON-RPC server TCP port. - - - **`--rpc-cors `**: Specify browser Origins allowed to access the HTTP & WS RPC servers. - - - **`--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. - - - 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). - - - ### 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 `**: 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" - ``` - - - 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`. - - - 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 specific chain configuration parameters. +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 `**: Specify JSON-RPC server TCP port. + +- **`--rpc-cors `**: Specify browser Origins allowed to access the HTTP & WS RPC servers. + +- **`--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. + +{" "} + + 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). + + +### 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 `**: 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" +``` + +{" "} + + 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`. + + +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 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" - ``` +```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" +``` + - 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). +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). diff --git a/pages/tutorials-full-node/launch.en.mdx b/pages/tutorials-full-node/launch.en.mdx index f129f80..16c8e86 100644 --- a/pages/tutorials-full-node/launch.en.mdx +++ b/pages/tutorials-full-node/launch.en.mdx @@ -26,7 +26,9 @@ As an introduction to the following section, we created a video tutorial to give /video goes here/ - 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. + 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. ## Step by step tutorial @@ -92,4 +94,5 @@ As an introduction to the following section, we created a video tutorial to give If you don't have an L1 endpoint url we recommend you to head up to the [Verification](/) section to get one - \ No newline at end of file + + diff --git a/pages/tutorials-full-node/query.en.mdx b/pages/tutorials-full-node/query.en.mdx index 97d3148..1b8ea62 100644 --- a/pages/tutorials-full-node/query.en.mdx +++ b/pages/tutorials-full-node/query.en.mdx @@ -26,7 +26,9 @@ As an introduction to the following section, we have created a video tutorial to -- Insert video here -- - We recommend continuing with the [Step-by-Step Tutorial](#step-by-step-tutorial), which will help you better understand how to interact with Madara RPC endpoints. + We recommend continuing with the [Step-by-Step + Tutorial](#step-by-step-tutorial), which will help you better understand how + to interact with Madara RPC endpoints. ## Step-by-Step Tutorial @@ -42,11 +44,11 @@ Before you begin, ensure that: 1. **You have a Madara client running**: If you haven't set up a node yet, you can refer to the [Launch a Madara Full Node](/tutorials-full-node/launch) tutorial. 2. **This client have an RPC Endpoint accessible**: You can expose the RPC endpoint of your Madara client by using the following parameters: - - **`--rpc-port `**: Specify JSON-RPC server TCP port. +- **`--rpc-port `**: Specify JSON-RPC server TCP port. - - **`--rpc-cors `**: Specify browser Origins allowed to access the HTTP & WS RPC servers. +- **`--rpc-cors `**: Specify browser Origins allowed to access the HTTP & WS RPC servers. - - **`--rpc-external`**: Listen to all RPC interfaces. Default is local. +- **`--rpc-external`**: Listen to all RPC interfaces. Default is local. 3. **You have an HTTP Client Tool**: Have a tool to make HTTP POST requests, such as [curl](https://curl.se/docs/manpage.html), [Postman](https://www.postman.com/), or any programming language with HTTP capabilities. @@ -54,20 +56,23 @@ Before you begin, ensure that: Now that you have everything set up, let's try to understand the interface Madara exposes. A Madara client exposes a JSON-RPC interface that adheres to the latest [Starknet JSON-RPC specifications](https://github.com/starkware-libs/starknet-specs/releases). This interface allows you to interact with the node by sending JSON-RPC requests and receiving responses. +Here is the reformulated text in English: -Cette interface JSON-RPC a plusieurs catégorie de methodes: +This JSON-RPC interface has several categories of methods: -- **Read methods**: des methodes de lecture seule, celles ci vont juste demander a votre client des donnees statique stockee par celui ci tel que par exemple les transactions du block 100000. -- **Historical methods**: Celle-ci sont des methodes de lecture particulieres. Toutes les methodes finissant par "at" tel que `starknet_getStorageAt` vous permettent de recuperer une valeur a un momment donnee de sa vie. L'address de stockage 0x5 d'un contract peut avoir eu la valeur "0x123" au block 50000 et "0x321" au block 100000. -- **Trace methods**: ces methodes permettent de generer la trace d'une execution et necessitent generalement une re-execution de celle ci via Blockifier -- **Write methods**: ces methodes vont directement modifier l'état de la chaine en question. Si celle-ci sont run depuis un Full Node alors celui-ci les forward au sequencer, seul responsavle des modification d'etat +- **Read methods**: These are read-only methods, which simply request static data stored by your client, such as transactions from block 100000. +- **Historical methods**: These are special read methods. All methods ending with "at", such as `starknet_getStorageAt`, allow you to retrieve a value at a specific point in time. For instance, the storage address 0x5 of a contract may have had the value "0x123" at block 50000 and "0x321" at block 100000. +- **Trace methods**: These methods allow you to generate the trace of an execution, usually requiring a re-execution via Blockifier. +- **Write methods**: These methods directly modify the state of the chain. If run from a Full Node, they are forwarded to the sequencer, which is the only entity responsible for state changes. ### Testing the Connection To verify that your client is accessible, let's send a simple request to get the chain id: - **Note**: Pour des raisons de simplicité ici nous allons utiliser l'endpoint par defaut: http://localhost:9944, il se peut que le votre soit different, pour savoir quel est votre endpoint RPC veuillez examiner les logs au lancement de votre client. + **Note**: For simplicity, we'll use the default endpoint here: + http://localhost:9944. Yours may be different, so check your client's logs + when launching to find your RPC endpoint. ```bash @@ -167,21 +172,21 @@ While `curl` is useful for quick tests, you can use programming languages and li **JavaScript Example:** ```javascript -const axios = require('axios'); +const axios = require("axios"); -const rpcEndpoint = 'http://localhost:9944/'; +const rpcEndpoint = "http://localhost:9944/"; const getBlockNumber = async () => { try { const response = await axios.post(rpcEndpoint, { - jsonrpc: '2.0', - method: 'starknet_blockNumber', + jsonrpc: "2.0", + method: "starknet_blockNumber", params: [], - id: 1 + id: 1, }); - console.log('Current block number:', response.data.result); + console.log("Current block number:", response.data.result); } catch (error) { - console.error('Error:', error.response.data.error); + console.error("Error:", error.response.data.error); } }; @@ -222,7 +227,8 @@ Now that you're familiar with querying the Madara RPC endpoint, you can: - For more advanced interactions, consider using Starknet SDKs or client libraries that provide higher-level abstractions over the JSON-RPC API. + For more advanced interactions, consider using Starknet SDKs or client + libraries that provide higher-level abstractions over the JSON-RPC API. ## Summary @@ -236,4 +242,4 @@ In this tutorial, you've learned how to: By leveraging the JSON-RPC interface, you can fully interact with the Starknet network through your Madara Full Node. ---- \ No newline at end of file +--- From 1ce3cf1adcc234b0bb64b0bbc5d715e714c3d57c Mon Sep 17 00:00:00 2001 From: antiyro Date: Thu, 17 Oct 2024 17:52:29 +0100 Subject: [PATCH 7/8] cleaned for ci --- cspell.json | 1 + pages/tutorials-chain/how.en.mdx | 2 +- pages/tutorials-full-node/customize.en.mdx | 2 ++ pages/tutorials-full-node/launch.en.mdx | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cspell.json b/cspell.json index 1d0302c..77c23e9 100644 --- a/cspell.json +++ b/cspell.json @@ -4,6 +4,7 @@ "words": [], "flagWords": [], "ignorePaths": [], + "ignoreWords": ["Rollups", "Blockifier", "Starklone", "KLONE"], "dictionaryDefinitions": [ { "name": "starknet", diff --git a/pages/tutorials-chain/how.en.mdx b/pages/tutorials-chain/how.en.mdx index 1fb4557..c16ef6d 100644 --- a/pages/tutorials-chain/how.en.mdx +++ b/pages/tutorials-chain/how.en.mdx @@ -120,4 +120,4 @@ Now if you've ran the above command you should see an error like that: Error: In Sequencer mode, you must define a Chain config path with `--chain-config-path ` or use a preset with `--preset `. ``` -You now have your first App Chain running! We now recomand you to customize it in the following tutorial [How to customize your App Chain](/tutorials-chain/custom). +You now have your first App Chain running! We now recommend you to customize it in the following tutorial [How to customize your App Chain](/tutorials-chain/custom). diff --git a/pages/tutorials-full-node/customize.en.mdx b/pages/tutorials-full-node/customize.en.mdx index 580e8cf..9023a96 100644 --- a/pages/tutorials-full-node/customize.en.mdx +++ b/pages/tutorials-full-node/customize.en.mdx @@ -83,6 +83,7 @@ cargo run --release -- \ If you run this command, you can now query your Madara Full Node on the RPC endpoint 9945. {" "} + For more information on how to query your Full Node client, we recommend following the tutorial [How to query a Madara RPC @@ -146,6 +147,7 @@ cargo run --release -- \ ``` {" "} + Please note that the `--network mainnet` parameter, which overwrites any chain config with the mainnet configuration preset, has been removed here to allow diff --git a/pages/tutorials-full-node/launch.en.mdx b/pages/tutorials-full-node/launch.en.mdx index 16c8e86..c004d95 100644 --- a/pages/tutorials-full-node/launch.en.mdx +++ b/pages/tutorials-full-node/launch.en.mdx @@ -79,7 +79,7 @@ As an introduction to the following section, we created a video tutorial to give ### 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. + This command will start the Madara client with a basic set arguments synchronizing directly with Starknet mainnet. For further configuration we recommend you to head up to the [Configure Your Node](#configure-your-node) section down below. ```bash cargo run --release -- \ From 22743a0a7197b4601d5803c82425b28f735274c1 Mon Sep 17 00:00:00 2001 From: antiyro Date: Thu, 17 Oct 2024 17:55:18 +0100 Subject: [PATCH 8/8] fixed build --- pages/tutorials-chain/custom.en.mdx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/pages/tutorials-chain/custom.en.mdx b/pages/tutorials-chain/custom.en.mdx index 6aae9ab..35d2739 100644 --- a/pages/tutorials-chain/custom.en.mdx +++ b/pages/tutorials-chain/custom.en.mdx @@ -1,6 +1,19 @@ -Here is the corrected version of the text with minor grammatical adjustments: - --- +title: How to Customize Your App Chain +lang: en-US +description: Learn How to Customize Your App Chain +--- + +import { Steps } from "nextra-theme-docs"; +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 Your App Chain