From cb6f466c0c6a260f421e8dfd0873767250a7e17d Mon Sep 17 00:00:00 2001 From: Yarik Bratashchuk Date: Thu, 19 Sep 2024 13:20:33 +0000 Subject: [PATCH 1/5] Full node, before refining --- .vitepress/config.ts | 4 +- ...ull-and-sequencer-node.md => full-node.md} | 50 +++++++++++-------- 2 files changed, 32 insertions(+), 22 deletions(-) rename guides/{full-and-sequencer-node.md => full-node.md} (64%) diff --git a/.vitepress/config.ts b/.vitepress/config.ts index 87bc5e0a5..060b6d932 100644 --- a/.vitepress/config.ts +++ b/.vitepress/config.ts @@ -283,8 +283,8 @@ function sidebarHome() { link: "/guides/restart-rollup", }, { - text: "Run as a full and sequencer node", - link: "/guides/full-and-sequencer-node", + text: "Run a full node", + link: "/guides/full-node", }, { text: "Configuration", diff --git a/guides/full-and-sequencer-node.md b/guides/full-node.md similarity index 64% rename from guides/full-and-sequencer-node.md rename to guides/full-node.md index 21ac0d0f6..3c5dd704d 100644 --- a/guides/full-and-sequencer-node.md +++ b/guides/full-node.md @@ -1,17 +1,14 @@ -# Full and sequencer node rollup setup +# Full node rollup setup -This guide will cover how to set up the GM World rollup example as -a multi-node network using a full and sequencer node. +This guide will cover how to set up a full node to run alongside a sequencer node. ## Running a local DA network {#running-local-da} -In this demo, we'll be using the local-da setup used in [GM World](../tutorials/gm-world) - To set up a local DA network node: ```bash-vue @@ -22,22 +19,37 @@ This script builds and runs the node, now listening on port `7980`. ## Running a sequencer node -By following the [GM World](../tutorials/gm-world) tutorial, you will have a sequencer node running. +We expect that you have your sequencer node running. We will now set up a full node to run alongside the sequencer node. -We wil now set up a full node to run alongside the sequencer node. +## Getting started +In order to run a full node you have to specify a different config directory. and copy the genesis file from the sequencer node to the full node. +Then you can use rollkit cli to start the full node. -## Getting started +## Initialize chain config and copy the genesis file + +We will use rollkit cli to run commands (instead of the actual binary) so we need to update config dir in the rollkit.toml file like this: + +```bash +[chain] + config_dir = "/root/.yourrollupd" // [!code --] + config_dir = "/root/.yourrollupd_fn" // [!code ++] +``` + +Now we will initialize the chain config for the full node: + +```bash +rollkit init FullNode --chain-id=your-rollup-chain-id +``` -Clone the script for the full node: +Now copy the genesis file from the sequencer node to the full node: ```bash -# From inside the `gm` directory -cd $HOME/gm -wget https://rollkit.dev/gm/init-full-node.sh +cp /root/.yourrollupd/config/genesis.json /root/.yourrollupd_fn/config/genesis.json ``` -### Update the p2p address + +### Set up the p2p address for the sequencer node Once your sequencer node starts producing blocks, it will show the p2p address, beginning with 12D: @@ -61,22 +73,20 @@ beginning with 12D: ... ``` -In your `init-full-node.sh` script, you will now set the `P2P_ID` variable -for your script to use: +Create an environment variable with the p2p address: ```bash -P2P_ID="your-p2p-id" // [!code --] -P2P_ID="12D3KooWJbD9TQoMSSSUyfhHMmgVY3LqCjxYFz8wQ92Qa6DAqtmh" // [!code ++] +export P2P_ID="12D3KooWJbD9TQoMSSSUyfhHMmgVY3LqCjxYFz8wQ92Qa6DAqtmh" // [!code ++] ``` ## Start the full node -Now run your full node with the script: +Now run your full node like this: ```bash -# from the gm directory -bash init-full-node.sh +rollkit start --rollkit.aggregator=false --rollkit.da_address http://127.0.0.1:7980 --rpc.laddr tcp://127.0.0.1:46657 --grpc.address 127.0.0.1:9390 --p2p.seeds $P2P_ID@127.0.0.1:26656 --p2p.laddr "0.0.0.0:46656" ``` +Notice that we are using the `P2P_ID` environment variable to set the seed node and we expect that the sequencer node is listening for p2p connections on port `26656`. Also we specify the `--rollkit.aggregator=false` flag to indicate that this node is not an aggregator node. The rest of the flags are used just to specify the ports and addresses where the node will listen for connections, and it should be different from the sequencer node. Your full node will now start and connect to the sequencer node. You should see the following output: ```bash From 81c1e0b9117a24d6508a03afdc0297900ae0c1d8 Mon Sep 17 00:00:00 2001 From: Yarik Bratashchuk Date: Thu, 19 Sep 2024 13:36:53 +0000 Subject: [PATCH 2/5] Rewording --- .vitepress/config.ts | 2 +- guides/full-node.md | 110 +++++++++++++++++-------------------------- 2 files changed, 44 insertions(+), 68 deletions(-) diff --git a/.vitepress/config.ts b/.vitepress/config.ts index 060b6d932..8133108f6 100644 --- a/.vitepress/config.ts +++ b/.vitepress/config.ts @@ -283,7 +283,7 @@ function sidebarHome() { link: "/guides/restart-rollup", }, { - text: "Run a full node", + text: "Run a rollup full node", link: "/guides/full-node", }, { diff --git a/guides/full-node.md b/guides/full-node.md index 3c5dd704d..9b2ce38e6 100644 --- a/guides/full-node.md +++ b/guides/full-node.md @@ -1,108 +1,84 @@ -# Full node rollup setup +# Rollup Full Node Setup Guide - - +## Introduction -This guide will cover how to set up a full node to run alongside a sequencer node. +This guide covers how to set up a full node to run alongside a sequencer node in a Rollkit-based blockchain network. A full node maintains a complete copy of the blockchain and helps validate transactions, improving the network's decentralization and security. -## Running a local DA network {#running-local-da} +## Prerequisites -To set up a local DA network node: +Before starting, ensure you have: -```bash-vue -curl -sSL https://rollkit.dev/install-local-da.sh | bash -s {{constants.localDALatestTag}} -``` - -This script builds and runs the node, now listening on port `7980`. - -## Running a sequencer node - -We expect that you have your sequencer node running. We will now set up a full node to run alongside the sequencer node. +- A local Data Availability (DA) network node running on port `7980`. +- A Rollkit sequencer node running and posting blocks to the DA network. +- The Rollkit CLI installed on your system. -## Getting started +## Setting Up Your Full Node -In order to run a full node you have to specify a different config directory. and copy the genesis file from the sequencer node to the full node. -Then you can use rollkit cli to start the full node. +### Initialize Chain Config and Copy Genesis File -## Initialize chain config and copy the genesis file +First, update the `config_dir` in the `rollkit.toml` file: -We will use rollkit cli to run commands (instead of the actual binary) so we need to update config dir in the rollkit.toml file like this: - -```bash +```toml [chain] config_dir = "/root/.yourrollupd" // [!code --] config_dir = "/root/.yourrollupd_fn" // [!code ++] ``` -Now we will initialize the chain config for the full node: +Initialize the chain config for the full node: ```bash rollkit init FullNode --chain-id=your-rollup-chain-id ``` -Now copy the genesis file from the sequencer node to the full node: +Copy the genesis file from the sequencer node: ```bash cp /root/.yourrollupd/config/genesis.json /root/.yourrollupd_fn/config/genesis.json ``` +### Set Up P2P Connection to Sequencer Node -### Set up the p2p address for the sequencer node +Identify the sequencer node's P2P address from its logs. It will look similar to: -Once your sequencer node starts producing blocks, it will show the p2p address, -beginning with 12D: - -```bash -... -1:55PM INF service start impl=RPC module=server msg="Starting RPC service" -1:55PM INF service start impl=Node module=server msg="Starting Node service" -1:55PM INF serving HTTP listen address=[::]:26657 module=server -1:55PM INF starting P2P client module=server -1:55PM INF listening on address=/ip4/127.0.0.1/tcp/36656/p2p/12D3KooWJbD9TQoMSSSUyfhHMmgVY3LqCjxYFz8wQ92Qa6DAqtmh module=p2p // [!code focus] -1:55PM INF listening on address=/ip4/163.172.162.109/tcp/36656/p2p/12D3KooWJbD9TQoMSSSUyfhHMmgVY3LqCjxYFz8wQ92Qa6DAqtmh module=p2p // [!code focus] -1:55PM INF no seed nodes - only listening for connections module=p2p -1:55PM INF working in aggregator mode block time=1000 module=server -1:55PM INF starting API server... address=tcp://0.0.0.0:1317 module=api-server -1:55PM INF serve module=api-server msg="Starting RPC HTTP server on [::]:1317" -1:55PM INF Creating and publishing block height=3458 module=BlockManager -1:55PM INF finalized block block_app_hash=A1A55270140B772643DCB444E0503B9865BB3702DF2D0A8E143CAF4717D2DB20 height=3458 module=BlockManager num_txs_res=0 num_val_updates=0 -1:55PM INF executed block app_hash=A1A55270140B772643DCB444E0503B9865BB3702DF2D0A8E143CAF4717D2DB20 height=3458 module=BlockManager -1:55PM INF starting gRPC server... address=localhost:9090 module=grpc-server -... +``` +1:55PM INF listening on address=/ip4/127.0.0.1/tcp/36656/p2p/12D3KooWJbD9TQoMSSSUyfhHMmgVY3LqCjxYFz8wQ92Qa6DAqtmh ``` -Create an environment variable with the p2p address: +Create an environment variable with the P2P address: ```bash -export P2P_ID="12D3KooWJbD9TQoMSSSUyfhHMmgVY3LqCjxYFz8wQ92Qa6DAqtmh" // [!code ++] +export P2P_ID="12D3KooWJbD9TQoMSSSUyfhHMmgVY3LqCjxYFz8wQ92Qa6DAqtmh" ``` -## Start the full node +### Start the Full Node -Now run your full node like this: +Run your full node with the following command: ```bash -rollkit start --rollkit.aggregator=false --rollkit.da_address http://127.0.0.1:7980 --rpc.laddr tcp://127.0.0.1:46657 --grpc.address 127.0.0.1:9390 --p2p.seeds $P2P_ID@127.0.0.1:26656 --p2p.laddr "0.0.0.0:46656" +rollkit start --rollkit.aggregator=false \ + --rollkit.da_address http://127.0.0.1:7980 \ + --rpc.laddr tcp://127.0.0.1:46657 \ + --grpc.address 127.0.0.1:9390 \ + --p2p.seeds $P2P_ID@127.0.0.1:26656 \ + --p2p.laddr "0.0.0.0:46656" ``` -Notice that we are using the `P2P_ID` environment variable to set the seed node and we expect that the sequencer node is listening for p2p connections on port `26656`. Also we specify the `--rollkit.aggregator=false` flag to indicate that this node is not an aggregator node. The rest of the flags are used just to specify the ports and addresses where the node will listen for connections, and it should be different from the sequencer node. -Your full node will now start and connect to the sequencer node. You should see the following output: -```bash -... +Key points about this command: +- `--rollkit.aggregator=false` indicates this is not an aggregator node. +- The ports and addresses are different from the sequencer node to avoid conflicts. +- We use the `P2P_ID` environment variable to set the seed node. + +## Verifying Full Node Operation + +After starting your full node, you should see output similar to: + +``` 2:33PM DBG indexed transactions height=1 module=txindex num_txs=0 2:33PM INF block marked as DA included blockHash=7897885B959F52BF0D772E35F8DA638CF8BBC361C819C3FD3E61DCEF5034D1CC blockHeight=5532 module=BlockManager -2:33PM DBG block body retrieved daHeight=1 hash=7897885B959F52BF0D772E35F8DA638CF8BBC361C819C3FD3E61DCEF5034D1CC height=5532 module=BlockManager -2:33PM DBG block not found in cache height=2 module=BlockManager -2:33PM INF block marked as DA included blockHash=E2E01078F151633768876E822D65EF52DD39E5073BB27AC5F903E52D48339F5C blockHeight=5533 module=BlockManager -2:33PM INF block marked as DA included blockHash=B88DA651CD1AC7116CD95B3CFB6369BD8964BF77B3E909944F816B2E35DF8EF4 blockHeight=5534 module=BlockManager -2:33PM DBG block body retrieved daHeight=1 hash=E2E01078F151633768876E822D65EF52DD39E5073BB27AC5F903E52D48339F5C height=5533 module=BlockManager -2:33PM INF block marked as DA included blockHash=376E44AB9F7023E76480CCD39F2D908FFE05911BF5C0387F5FF788C32D4C312E blockHeight=5535 module=BlockManager -2:33PM DBG block not found in cache height=2 module=BlockManager -2:33PM INF block marked as DA included blockHash=ABF1789EFB08F3DF7422579C9E52A0E6A54B4CDC8EB5FA32CA2E751ACCAEE23B blockHeight=5536 module=BlockManager -... ``` -Congratulations! You will now have a full node running alongside your -Rollkit sequencer. +This output indicates that your full node is successfully connecting to the network and processing blocks. + +## Conclusion + +You've now set up a full node running alongside your Rollkit sequencer. From 4fc67f3c0842f44c7e09d456bcb9f5905e059cf2 Mon Sep 17 00:00:00 2001 From: Yarik Bratashchuk Date: Thu, 19 Sep 2024 13:38:19 +0000 Subject: [PATCH 3/5] use bash instead of toml code block --- guides/full-node.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/full-node.md b/guides/full-node.md index 9b2ce38e6..88ea31c98 100644 --- a/guides/full-node.md +++ b/guides/full-node.md @@ -18,7 +18,7 @@ Before starting, ensure you have: First, update the `config_dir` in the `rollkit.toml` file: -```toml +```bash [chain] config_dir = "/root/.yourrollupd" // [!code --] config_dir = "/root/.yourrollupd_fn" // [!code ++] From ee4b62b321dd60971480299a7bb87600aa5559a1 Mon Sep 17 00:00:00 2001 From: Yarik Bratashchuk Date: Thu, 19 Sep 2024 13:53:04 +0000 Subject: [PATCH 4/5] update overview --- guides/overview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/overview.md b/guides/overview.md index 402c06d38..48f1c1e31 100644 --- a/guides/overview.md +++ b/guides/overview.md @@ -17,7 +17,7 @@ In this section, you'll find: * [How to restart your rollup](/guides/restart-rollup.md) * [zkML rollup](/guides/zkml.md) * [IBC connection](/guides/ibc-connection.md) -* [Full and sequencer node rollup setup](/guides/full-and-sequencer-node.md) +* [Full rollup node setup](/guides/full-node.md) * [How to configure gas price](/guides/gas-price.md) * [How to change speed of block production](/guides/block-times.md) * [How to use lazy sequencing (aggregation)](/guides/lazy-sequencing.md) From d700dc5e61eca75b3ac184e972bba21a8a5c25f9 Mon Sep 17 00:00:00 2001 From: Yarik Bratashchuk Date: Fri, 20 Sep 2024 09:22:26 +0000 Subject: [PATCH 5/5] Add comments on moniker, jsonrpc and api ports, and tip on data dir --- guides/full-node.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/guides/full-node.md b/guides/full-node.md index 88ea31c98..517f8e92d 100644 --- a/guides/full-node.md +++ b/guides/full-node.md @@ -24,7 +24,7 @@ First, update the `config_dir` in the `rollkit.toml` file: config_dir = "/root/.yourrollupd_fn" // [!code ++] ``` -Initialize the chain config for the full node: +Initialize the chain config for the full node, lets call it `FullNode` and set the chain ID to your rollup chain ID: ```bash rollkit init FullNode --chain-id=your-rollup-chain-id @@ -60,12 +60,14 @@ rollkit start --rollkit.aggregator=false \ --rpc.laddr tcp://127.0.0.1:46657 \ --grpc.address 127.0.0.1:9390 \ --p2p.seeds $P2P_ID@127.0.0.1:26656 \ - --p2p.laddr "0.0.0.0:46656" + --p2p.laddr "0.0.0.0:46656" \ + --json-rpc.ws-address 127.0.0.1:8547 \ + --api.address tcp://localhost:1318 ``` Key points about this command: - `--rollkit.aggregator=false` indicates this is not an aggregator node. -- The ports and addresses are different from the sequencer node to avoid conflicts. +- The ports and addresses are different from the sequencer node to avoid conflicts. Not everything may be necessary for your setup. - We use the `P2P_ID` environment variable to set the seed node. ## Verifying Full Node Operation @@ -79,6 +81,11 @@ After starting your full node, you should see output similar to: This output indicates that your full node is successfully connecting to the network and processing blocks. +:::tip +If your rollup uses EVM as an execution layar and you see an error like `datadir already used by another process`, it means you have to remove all the state from rollup data directory (`/root/.yourrollup_fn/data/`) and specify a different data directory for the EVM client. +::: + + ## Conclusion You've now set up a full node running alongside your Rollkit sequencer.