-
Notifications
You must be signed in to change notification settings - Fork 58
Update to use rollkit cli instead of <binary>d #383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# How to connect a rollup to a local DA network | ||
|
||
This guide provides a quick and straightforward method to start a local Data Availability (DA) network and configure your rollup to post data to it. | ||
|
||
## Setting Up a Local DA Network | ||
yarikbratashchuk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
To set up a local DA network node on your machine, run the following script to install and start the local DA node: | ||
|
||
```bash | ||
curl -sSL https://rollkit.dev/install-local-da.sh | bash -s {{constants.localDALatestTag}} | ||
``` | ||
|
||
This script will build and run the node, which will then listen on port `7980`. | ||
|
||
## Configuring your rollup to connect to the local DA network | ||
|
||
To connect your rollup to the local DA network, you need to pass the `--rollkit.da_address` flag with the local DA node address. | ||
|
||
## Run your rollup | ||
|
||
Start your rollup node with the following command, ensuring to include the DA address flag: | ||
|
||
```bash | ||
rollkit start \ | ||
--rollkit.da_address http://localhost:7980 \ | ||
<other-flags> | ||
``` | ||
|
||
## Summary | ||
|
||
By following these steps, you will set up a local DA network node and configure your rollup to post data to it. This setup is useful for testing and development in a controlled environment. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# How to create a genesis for your rollup | ||
|
||
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. | ||
|
||
## 1. Setting variables | ||
|
||
First, set the necessary variables for your chain, here is an example: | ||
yarikbratashchuk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```sh | ||
VALIDATOR_NAME=validator1 | ||
CHAIN_ID=rollup-chain | ||
KEY_NAME=rollup-key | ||
CHAINFLAG="--chain-id ${CHAIN_ID}" | ||
TOKEN_AMOUNT="10000000000000000000000000stake" | ||
STAKING_AMOUNT="1000000000stake" | ||
``` | ||
|
||
## 2. Ensuring `rollkit.toml` is present and building entrypoint | ||
|
||
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: | ||
|
||
```sh | ||
rollkit rebuild | ||
``` | ||
yarikbratashchuk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
This creates an `entrypoint` binary in the root of your rollup directory. which is used to run all the operations on the rollup chain. | ||
|
||
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: | ||
|
||
```sh | ||
rollkit toml init | ||
``` | ||
|
||
## 3. Resetting existing genesis/chain data | ||
|
||
Reset any existing genesis or chain data: | ||
|
||
```sh | ||
rollkit tendermint unsafe-reset-all | ||
``` | ||
|
||
## 4. Initializing the validator | ||
|
||
Initialize the validator with the chain ID you set: | ||
|
||
```sh | ||
rollkit init $VALIDATOR_NAME --chain-id $CHAIN_ID | ||
``` | ||
|
||
## 5. Adding a key to keyring backend | ||
|
||
Add a key to the keyring-backend: | ||
|
||
```sh | ||
rollkit keys add $KEY_NAME --keyring-backend test | ||
``` | ||
|
||
## 6. Adding a genesis account | ||
|
||
Add a genesis account with the specified token amount: | ||
|
||
```sh | ||
rollkit genesis add-genesis-account $KEY_NAME $TOKEN_AMOUNT --keyring-backend test | ||
``` | ||
|
||
## 7. Setting the staking amount in the genesis transaction | ||
|
||
Set the staking amount in the genesis transaction: | ||
|
||
```sh | ||
rollkit genesis gentx $KEY_NAME $STAKING_AMOUNT --chain-id $CHAIN_ID --keyring-backend test | ||
``` | ||
|
||
## 8. Collecting genesis transactions | ||
|
||
Collect the genesis transactions: | ||
|
||
```sh | ||
rollkit genesis collect-gentxs | ||
``` | ||
|
||
## 9. Configuring the genesis file | ||
|
||
Copy the centralized sequencer address into `genesis.json`: | ||
|
||
```sh | ||
ADDRESS=$(jq -r '.address' ~/.rollup/config/priv_validator_key.json) | ||
PUB_KEY=$(jq -r '.pub_key' ~/.rollup/config/priv_validator_key.json) | ||
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 | ||
``` | ||
|
||
## 10. Creating a restart script | ||
|
||
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)): | ||
|
||
```sh | ||
[ -f restart-rollup.sh ] && rm restart-rollup.sh | ||
|
||
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 | ||
``` | ||
|
||
## 11. Starting the chain | ||
|
||
Finally, start the chain with the following command: | ||
|
||
```sh | ||
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" | ||
``` | ||
|
||
## Summary | ||
|
||
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# How to configure DA chain block syncing time | ||
|
||
The `--rollkit.da_block_time` flag is used to configure the time in seconds that the rollup will wait for a block to be synced from the DA chain. | ||
yarikbratashchuk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```bash | ||
--rollkit.da_block_time duration | ||
``` | ||
|
||
An example command would look like this: | ||
|
||
```bash | ||
rollkit start [existing flags...] // [!code --] | ||
rollkit start [existing flags...] --rollkit.da_block_time=30s // [!code ++] | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# How to configure the maximum number of blocks pending DA submission | ||
|
||
The `--rollkit.max_pending_blocks` flag is used to configure the maximum limit of blocks pending DA submission (0 for no limit) | ||
|
||
```bash | ||
--rollkit.max_pending_blocks uint | ||
``` | ||
|
||
An example command would look like this: | ||
|
||
```bash | ||
rollkit start [existing flags...] // [!code --] | ||
rollkit start [existing flags...] --rollkit.max_pending_blocks=100 // [!code ++] | ||
``` | ||
|
||
yarikbratashchuk marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# How to Use Rollkit CLI | ||
|
||
This guide will walk you through the basics of installing and using Rollkit CLI. You'll learn how to install the CLI, initialize a configuration file (`rollkit.toml`), and run rollup commands. | ||
|
||
## 1. Installing Rollkit CLI | ||
|
||
<!-- markdownlint-disable MD033 --> | ||
<script setup> | ||
import constants from '../.vitepress/constants/constants.js' | ||
</script> | ||
|
||
To install Rollkit CLI, execute the following command: | ||
|
||
```bash-vue | ||
curl -sSL https://rollkit.dev/install.sh | sh -s {{constants.rollkitLatestTag}} | ||
``` | ||
|
||
This command downloads and installs the Rollkit CLI of specified version. | ||
|
||
## 2. Initializing `rollkit.toml` | ||
|
||
The `rollkit.toml` file is a configuration file that Rollkit uses to understand the structure and entry point of your rollup. To initialize this file, follow these steps: | ||
|
||
### Steps to Generate `rollkit.toml`: | ||
|
||
1. Run the following command to generate the `rollkit.toml` file: | ||
|
||
```bash | ||
rollkit toml init | ||
``` | ||
|
||
2. You should see an output similar to this (example taken from [GM world](/tutorials/gm-world) tutorial): | ||
|
||
```bash | ||
Found rollup entrypoint: /root/gm/cmd/gmd/main.go, adding to rollkit.toml | ||
Could not find rollup config under gm. Please put the chain.config_dir in the rollkit.toml file manually. | ||
Initialized rollkit.toml file in the current directory. | ||
yarikbratashchuk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``` | ||
|
||
3. The output indicates that the rollup entrypoint is `~/gm/cmd/gmd/main.go`. | ||
|
||
4. Open the `rollkit.toml` file, and under the `[chain]` section, set `config_dir` to the appropriate directory where your chain configuration is. For GM World tutorial, `rollkit.toml` file looks like this: | ||
|
||
```toml | ||
entrypoint = "./cmd/gmd/main.go" | ||
|
||
[chain] | ||
config_dir = "./.gm" | ||
``` | ||
|
||
Adjust `entrypoint` and `config_dir` according to your project structure. | ||
|
||
## 3. Running Rollup Commands Using Rollkit CLI | ||
|
||
Once you have the `rollkit.toml` file set up, you can run any rollup command using the Rollkit CLI. Ensure you are in the directory containing the `rollkit.toml` file when executing commands. | ||
|
||
### Example: | ||
|
||
1. Navigate to the directory containing the `rollkit.toml` file. | ||
|
||
2. Now you could do: | ||
|
||
```bash | ||
# instead of <rollup>d start | ||
rollkit start | ||
# instead of <rollup>d tx | ||
rollkit tx | ||
# for any <rollup>d <command> | ||
rollkit <command> | ||
``` | ||
yarikbratashchuk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
## Summary | ||
|
||
By following these steps, you can install the Rollkit CLI, initialize the `rollkit.toml` configuration file, and run rollup commands. This setup helps you manage and interact with your rollup project efficiently. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.