Skip to content
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

Update to use rollkit cli instead of <binary>d #394

Merged
merged 2 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 41 additions & 19 deletions .vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,46 +255,68 @@ function sidebarHome() {
collapsed: true,
items: [
{
text: "Configuration",
collapsed: true,
items: [
{
text: "How to restart your rollup",
link: "/guides/restart-rollup",
text: "Use the Rollkit CLI",
link: "/guides/use-rollkit-cli",
},
{
text: "How to run as a full and sequencer node",
link: "/guides/full-and-sequencer-node",
text: "Connect to a local DA",
link: "/guides/connect-local-da",
},
{
text: "How to configure gas price",
link: "/guides/gas-price",
text: "Create genesis for your rollup",
link: "/guides/create-genesis",
},
{
text: "How to change speed of block production",
link: "/guides/block-times",
text: "Restart your rollup",
link: "/guides/restart-rollup",
},
{
text: "How to use lazy sequencing (aggregation)",
link: "/guides/lazy-sequencing",
text: "Run as a full and sequencer node",
link: "/guides/full-and-sequencer-node",
},
{
text: "How to test and deploy smart-contracts",
link: "/guides/cw-orch",
text: "Configure gas price",
link: "/guides/gas-price",
},
{ text: "How to add zkML to your rollup", link: "/guides/zkml" },
{
text: "How to add an IBC connection to your rollup",
link: "/guides/ibc-connection",
text: "Configure max pending blocks",
link: "/guides/max-pending-blocks",
},
{
text: "How to integrate Range with your rollup",
link: "/guides/rollkit-monitoring",
text: "Configure DA chain block sync time",
link: "/guides/da-block-time",
},
{
text: "How to use IBC token (TIA) as gas token in your rollup",
link: "/guides/use-tia-for-gas",
text: "Change speed of block production",
link: "/guides/block-times",
},
{
text: "Use lazy sequencing (aggregation)",
link: "/guides/lazy-sequencing",
},
],
},
{
text: "Test and deploy smart-contracts",
link: "/guides/cw-orch",
},
{ text: "Add zkML to your rollup", link: "/guides/zkml" },
{
text: "Add an IBC connection to your rollup",
link: "/guides/ibc-connection",
},
{
text: "Integrate Range with your rollup",
link: "/guides/rollkit-monitoring",
},
{
text: "Use IBC token (TIA) as gas token in your rollup",
link: "/guides/use-tia-for-gas",
},
],
},
{
Expand Down
2 changes: 1 addition & 1 deletion .vitepress/constants/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ const constants = Object.freeze({

localDALatestTag: "v0.2.0",

igniteVersionTag: "v28.3.0",
igniteVersionTag: "v28.4.0",
});
export default constants;
31 changes: 31 additions & 0 deletions guides/connect-local-da.md
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

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.
112 changes: 112 additions & 0 deletions guides/create-genesis.md
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:

```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
```

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.
14 changes: 14 additions & 0 deletions guides/da-block-time.md
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 ++]
```
15 changes: 15 additions & 0 deletions guides/max-pending-blocks.md
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 ++]
```

73 changes: 73 additions & 0 deletions guides/use-rollkit-cli.md
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.
```

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>
```
## Summary
yarikbratashchuk marked this conversation as resolved.
Show resolved Hide resolved

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.
4 changes: 1 addition & 3 deletions public/install-gm-rollup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@
echo "Downloading GM tutorial rollup source code..."
git clone https://github.com/rollkit/gm.git
cd gm || { echo "Failed to find the downloaded repository"; exit 1; }
git fetch && git checkout remotes/origin/tutorial-local-da
echo "Building and configuring rollup chain..."
bash init.sh
git fetch && git checkout remotes/origin/tutorial-local-da-rollkit
Loading
Loading