From ab7968f03ba3bf32cb142620a45126be7a3c8d08 Mon Sep 17 00:00:00 2001 From: Matthew Sevey <15232757+MSevey@users.noreply.github.com> Date: Fri, 15 Nov 2024 14:55:37 -0500 Subject: [PATCH 1/2] feat: add DA overview and bring local-da into tutorials --- .vitepress/config.ts | 12 +++++-- tutorials/{ => da}/avail-da.md | 2 +- tutorials/{ => da}/celestia-da.md | 22 ++++++++++--- tutorials/da/local-da.md | 55 +++++++++++++++++++++++++++++++ tutorials/da/overview.md | 50 ++++++++++++++++++++++++++++ 5 files changed, 134 insertions(+), 7 deletions(-) rename tutorials/{ => da}/avail-da.md (99%) rename tutorials/{ => da}/celestia-da.md (91%) create mode 100644 tutorials/da/local-da.md create mode 100644 tutorials/da/overview.md diff --git a/.vitepress/config.ts b/.vitepress/config.ts index 39bc9dfc4..beafb1ee2 100644 --- a/.vitepress/config.ts +++ b/.vitepress/config.ts @@ -223,13 +223,21 @@ function sidebarHome() { text: "DA", collapsed: true, items: [ + { + text: "Overview", + link: "/tutorials/da/overview", + }, + { + text: "Local DA", + link: "/tutorials/da/local-da", + }, { text: "Celestia", - link: "/tutorials/celestia-da", + link: "/tutorials/da/celestia-da", }, { text: "Avail", - link: "/tutorials/avail-da", + link: "/tutorials/da/avail-da", }, ], }, diff --git a/tutorials/avail-da.md b/tutorials/da/avail-da.md similarity index 99% rename from tutorials/avail-da.md rename to tutorials/da/avail-da.md index aa4e7fdf6..5cd7a8062 100644 --- a/tutorials/avail-da.md +++ b/tutorials/da/avail-da.md @@ -1,4 +1,4 @@ -# Deploying a rollup to Avail +# Using Avail as DA ## 🌞 Introduction {#introduction} diff --git a/tutorials/celestia-da.md b/tutorials/da/celestia-da.md similarity index 91% rename from tutorials/celestia-da.md rename to tutorials/da/celestia-da.md index ac8d47e2e..3a5a7f063 100644 --- a/tutorials/celestia-da.md +++ b/tutorials/da/celestia-da.md @@ -1,8 +1,8 @@ -# Deploying a rollup to Celestia +# Using Celestia as DA ## 🌞 Introduction {#introduction} @@ -54,13 +54,27 @@ The output of the command above will look similar to this: Your DA_BLOCK_HEIGHT is 2127672 ``` -Now, let's obtain the authentication token of your light node using the following command (omit the --p2p.network flag for Mainnet Beta): +Now, let's obtain the authentication token of your light node using the following command: -```bash +::: code-group + +```bash [Arabica Devnet] AUTH_TOKEN=$(celestia light auth write --p2p.network arabica) echo -e "\n Your DA AUTH_TOKEN is $AUTH_TOKEN \n" ``` +```bash [Mocha Testnet] +AUTH_TOKEN=$(celestia light auth write --p2p.network mocha) +echo -e "\n Your DA AUTH_TOKEN is $AUTH_TOKEN \n" +``` + +```bash [Mainnet Beta] +AUTH_TOKEN=$(celestia light auth write) +echo -e "\n Your DA AUTH_TOKEN is $AUTH_TOKEN \n" +``` + +::: + The output of the command above will look similar to this: ```bash diff --git a/tutorials/da/local-da.md b/tutorials/da/local-da.md new file mode 100644 index 000000000..8577ec801 --- /dev/null +++ b/tutorials/da/local-da.md @@ -0,0 +1,55 @@ +# Using Local DA + + + + +## Introduction {#introduction} + +This tutorial serves as a comprehensive guide for using the [local-da](https://github.com/rollkit/local-da) with your chain. + +Before proceeding, ensure that you have completed the [quick start](/tutorials/quick-start) or [build a chain](/tutorials/wordle) tutorial, which covers installing the rollkit CLI, building your chain, and running your chain. + +## 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-vue +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: + +::: code-group + +```sh [Quick Start] +rollkit start --rollkit.da_address http://localhost:7980 +``` + +```sh [Wordle Chain] +rollkit start \ + --rollkit.aggregator \ + --rollkit.da_address http://localhost:7980 \ + --rollkit.sequencer_rollup_id wordle +``` + +::: + +You should see the following log message indicating that your rollup is connected to the local DA network: + +```shell +I[2024-11-15|14:54:19.842] DA server is already running module=main address=http://localhost:7980 +``` + +## 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. diff --git a/tutorials/da/overview.md b/tutorials/da/overview.md new file mode 100644 index 000000000..38ceed5b8 --- /dev/null +++ b/tutorials/da/overview.md @@ -0,0 +1,50 @@ +--- +description: This page provides an overview of how rollkit integrates with DA. +--- + + + +# DA + +Now that you have the foundations of running and building a rollup with Rollkit, it is time to start customizing it to fit your needs. + +The first choice you need to make is which data availability (DA) layer to use. The DA layer is a critical component of a blockchain, as it provides the data availability and finality guarantees that your chain needs to operate securely. + +Rollkit uses the [go-da interface](https://github.com/rollkit/go-da) to communicate to DA layers. Any DA layer that implements this interface can be used with Rollkit. + +## Go DA {#go-da} + +The [go-da interface](https://github.com/rollkit/go-da) defines the core functions required to interact with a DA layer. Probably the two most important functions being `Get` and `Submit`. + +```go +// DA defines very generic interface for interaction with Data Availability layers. +type DA interface { + // Get returns Blob for each given ID, or an error. + Get(ctx context.Context, ids []ID, namespace Namespace) ([]Blob, error) + + // Submit submits the Blobs to Data Availability layer. + Submit(ctx context.Context, blobs []Blob, gasPrice float64, namespace Namespace) ([]ID, error) +} +``` + +DA layers can integrate the `go-da` interface directly into their node like [Celestia](celestia-da), or they can define a middleware service like [Avail](avail-da). + +## Mock DA {#mock-da} + +You might have noticed that we did not define any DA layer during the [quick start](../quick-start.md) or [build a chain](../wordle.md) tutorials. This is because we used a mock DA layer that is built into Rollkit. + +If you revisit the logs from those tutorials, you will see one of the first lines being: + +```shell +I[2024-11-15|14:09:41.735] Starting mock DA server module=main address=http://localhost:26658 +``` + +The mock DA layer is a simple in-memory DA layer that is great for testing and development. It is not suitable for production use, as it does not provide the data availability and finality guarantees that a real DA layer would. + +## DA Layers {#da-layers} + +Now that you have a better understanding of what a DA layer is, you can start to explore the different DA layers that are available to use with Rollkit. + +* [Local DA](local-da.md) +* [Celestia DA](celestia-da.md) +* [Avail DA](avail-da.md) From 14097e08659883b7f5d679fca7461f66e00b6704 Mon Sep 17 00:00:00 2001 From: MSevey <15232757+MSevey@users.noreply.github.com> Date: Mon, 18 Nov 2024 10:07:48 -0500 Subject: [PATCH 2/2] chore: remove local-da how to guide --- .vitepress/config.ts | 4 ---- guides/connect-local-da.md | 36 ------------------------------------ 2 files changed, 40 deletions(-) delete mode 100644 guides/connect-local-da.md diff --git a/.vitepress/config.ts b/.vitepress/config.ts index beafb1ee2..6b955abe6 100644 --- a/.vitepress/config.ts +++ b/.vitepress/config.ts @@ -318,10 +318,6 @@ function sidebarHome() { text: "Use the Rollkit CLI", link: "/guides/use-rollkit-cli", }, - { - text: "Connect to a local DA", - link: "/guides/connect-local-da", - }, { text: "Create genesis for your rollup", link: "/guides/create-genesis", diff --git a/guides/connect-local-da.md b/guides/connect-local-da.md deleted file mode 100644 index 165787852..000000000 --- a/guides/connect-local-da.md +++ /dev/null @@ -1,36 +0,0 @@ -# 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-vue -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 \ - -``` - -## 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.