|
2 | 2 |
|
3 | 3 | This guide will walk you through the process of setting up a genesis for your rollup. Follow the steps below to initialize your rollup chain, add a genesis account, and start the chain. |
4 | 4 |
|
| 5 | +## 0. Pre-requisities |
| 6 | + |
| 7 | +For this guide you need to have a chain directory where you have created and built your chain. |
| 8 | + |
| 9 | +If you don't have a chain directory yet, you can initialize a simple ignite chain by following [this guide](./ignite-rollkit.md) |
| 10 | + |
| 11 | +:::tip |
| 12 | +This guide will use the simple ignite chain created in linked guide. Make sure to update any relevant variables to match your chain. |
| 13 | +::: |
| 14 | + |
5 | 15 | ## 1. Setting variables |
6 | 16 |
|
7 | | -First, set the necessary variables for your chain, here is an example: |
| 17 | +First, set the necessary variables for your chain in the terminal, here is an example: |
8 | 18 |
|
9 | 19 | ```sh |
10 | 20 | VALIDATOR_NAME=validator1 |
11 | | -CHAIN_ID=rollup-chain |
| 21 | +CHAIN_ID=gm |
12 | 22 | KEY_NAME=rollup-key |
13 | 23 | CHAINFLAG="--chain-id ${CHAIN_ID}" |
14 | 24 | TOKEN_AMOUNT="10000000000000000000000000stake" |
15 | 25 | STAKING_AMOUNT="1000000000stake" |
16 | 26 | ``` |
17 | 27 |
|
18 | | -## 2. Ensuring `rollkit.toml` is present and building entrypoint |
| 28 | +## 2. Rebuild your chain |
19 | 29 |
|
20 | 30 | Ensure that `rollkit.toml` is present in the root of your rollup directory (if not, follow a [Guide](/guides/use-rollkit-cli) to set it up) and run the following command to (re)generate an entrypoint binary out of the code: |
21 | 31 |
|
22 | 32 | ```sh |
23 | 33 | rollkit rebuild |
24 | 34 | ``` |
25 | 35 |
|
26 | | -This creates an `entrypoint` binary in the root of your rollup directory. which is used to run all the operations on the rollup chain. |
| 36 | +This (re)creates an `entrypoint` binary in the root of your rollup directory. which is used to run all the operations on the rollup chain. |
| 37 | + |
| 38 | +Ensure that the chain configuration directory is set correctly in the `rollkit.toml` file. |
| 39 | + |
| 40 | +For example: |
| 41 | + |
| 42 | +```sh |
| 43 | +[chain] |
| 44 | + config_dir = "/Users/you/.gm" |
| 45 | +``` |
27 | 46 |
|
28 | | -Ensure that the chain configuration directory is set correctly in the `rollkit.toml` file, if you doubt it, you can remove the `rollkit.toml` file and run the following command to generate a new one: |
| 47 | +:::tip |
| 48 | +You can always recreate the `rollkit.toml` file by deleting it and re-running the following command: |
29 | 49 |
|
30 | 50 | ```sh |
31 | 51 | rollkit toml init |
32 | 52 | ``` |
| 53 | +::: |
33 | 54 |
|
34 | 55 | ## 3. Resetting existing genesis/chain data |
35 | 56 |
|
36 | | -Reset any existing genesis or chain data: |
| 57 | +Reset any existing chain data: |
37 | 58 |
|
38 | 59 | ```sh |
39 | 60 | rollkit tendermint unsafe-reset-all |
40 | 61 | ``` |
41 | 62 |
|
| 63 | +Reset any existing genesis data: |
| 64 | + |
| 65 | +```sh |
| 66 | +rm -rf $HOME/.$CHAIN_ID/config/gentx |
| 67 | +rm $HOME/.$CHAIN_ID/config/genesis.json |
| 68 | +``` |
| 69 | + |
42 | 70 | ## 4. Initializing the validator |
43 | 71 |
|
44 | 72 | Initialize the validator with the chain ID you set: |
@@ -84,29 +112,21 @@ rollkit genesis collect-gentxs |
84 | 112 | Copy the centralized sequencer address into `genesis.json`: |
85 | 113 |
|
86 | 114 | ```sh |
87 | | -ADDRESS=$(jq -r '.address' ~/.rollup/config/priv_validator_key.json) |
88 | | -PUB_KEY=$(jq -r '.pub_key' ~/.rollup/config/priv_validator_key.json) |
89 | | -jq --argjson pubKey "$PUB_KEY" '.consensus["validators"]=[{"address": "'$ADDRESS'", "pub_key": $pubKey, "power": "1000", "name": "Rollkit Sequencer"}]' ~/.rollup/config/genesis.json > temp.json && mv temp.json ~/.rollup/config/genesis.json |
| 115 | +ADDRESS=$(jq -r '.address' ~/.$CHAIN_ID/config/priv_validator_key.json) |
| 116 | +PUB_KEY=$(jq -r '.pub_key' ~/.$CHAIN_ID/config/priv_validator_key.json) |
| 117 | +jq --argjson pubKey "$PUB_KEY" '.consensus["validators"]=[{"address": "'$ADDRESS'", "pub_key": $pubKey, "power": "1000", "name": "Rollkit Sequencer"}]' ~/.$CHAIN_ID/config/genesis.json > temp.json && mv temp.json ~/.$CHAIN_ID/config/genesis.json |
90 | 118 | ``` |
91 | 119 |
|
92 | | -## 10. Creating a restart script |
93 | | - |
94 | | -Create a `restart-rollup.sh` file to restart the chain later, notice the `rollkit.da_address` flag which is the address of the data availability node, for other DA layers it will be a different set of flags (in case of Celestia check out the tutorial [here](/tutorials/celestia-da)): |
95 | | - |
96 | | -```sh |
97 | | -[ -f restart-rollup.sh ] && rm restart-rollup.sh |
98 | | - |
99 | | -echo "rollkit start --rollkit.aggregator --rpc.laddr tcp://127.0.0.1:36657 --grpc.address 127.0.0.1:9290 --p2p.laddr \"0.0.0.0:36656\" --minimum-gas-prices=\"0.025stake\" --rollkit.da_address \"http://localhost:7980\"" >> restart-rollup.sh |
100 | | -``` |
| 120 | +## 10. Starting the chain |
101 | 121 |
|
102 | | -## 11. Starting the chain |
| 122 | +Finally, start the chain with your start command. |
103 | 123 |
|
104 | | -Finally, start the chain with the following command: |
| 124 | +For example, start the simple ignite chain with the following command: |
105 | 125 |
|
106 | 126 | ```sh |
107 | | -rollkit start --rollkit.aggregator --rpc.laddr tcp://127.0.0.1:36657 --grpc.address 127.0.0.1:9290 --p2p.laddr "0.0.0.0:36656" --minimum-gas-prices="0.025stake" --rollkit.da_address "http://localhost:7980" |
| 127 | +rollkit start --rollkit.aggregator --rollkit.sequencer_rollup_id $CHAIN_ID |
108 | 128 | ``` |
109 | 129 |
|
110 | 130 | ## Summary |
111 | 131 |
|
112 | | -By following these steps, you will set up the genesis for your rollup, initialize the validator, add a genesis account, and start the chain on a local data availability network (DA). This guide provides a basic framework for configuring and starting your rollup using the Rollkit CLI. Make sure `rollkit.toml` is present in the root of your rollup directory, and use the `rollkit` command for all operations. |
| 132 | +By following these steps, you will set up the genesis for your rollup, initialize the validator, add a genesis account, and started the chain. This guide provides a basic framework for configuring and starting your rollup using the Rollkit CLI. Make sure `rollkit.toml` is present in the root of your rollup directory, and use the `rollkit` command for all operations. |
0 commit comments