Skip to content

Commit b265441

Browse files
authored
feat: add DA overview and bring local-da into tutorials (#509)
1 parent 84860e8 commit b265441

File tree

5 files changed

+103
-16
lines changed

5 files changed

+103
-16
lines changed

.vitepress/config.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,21 @@ function sidebarHome() {
223223
text: "DA",
224224
collapsed: true,
225225
items: [
226+
{
227+
text: "Overview",
228+
link: "/tutorials/da/overview",
229+
},
230+
{
231+
text: "Local DA",
232+
link: "/tutorials/da/local-da",
233+
},
226234
{
227235
text: "Celestia",
228-
link: "/tutorials/celestia-da",
236+
link: "/tutorials/da/celestia-da",
229237
},
230238
{
231239
text: "Avail",
232-
link: "/tutorials/avail-da",
240+
link: "/tutorials/da/avail-da",
233241
},
234242
],
235243
},
@@ -310,10 +318,6 @@ function sidebarHome() {
310318
text: "Use the Rollkit CLI",
311319
link: "/guides/use-rollkit-cli",
312320
},
313-
{
314-
text: "Connect to a local DA",
315-
link: "/guides/connect-local-da",
316-
},
317321
{
318322
text: "Create genesis for your rollup",
319323
link: "/guides/create-genesis",

tutorials/avail-da.md renamed to tutorials/da/avail-da.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Deploying a rollup to Avail
1+
# Using Avail as DA
22

33
## 🌞 Introduction {#introduction}
44

tutorials/celestia-da.md renamed to tutorials/da/celestia-da.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Deploying a rollup to Celestia
1+
# Using Celestia as DA
22

33
<!-- markdownlint-disable MD033 -->
44
<script setup>
5-
import constants from '../.vitepress/constants/constants.js'
5+
import constants from '../../.vitepress/constants/constants.js'
66
</script>
77

88
## 🌞 Introduction {#introduction}
@@ -54,13 +54,27 @@ The output of the command above will look similar to this:
5454
Your DA_BLOCK_HEIGHT is 2127672
5555
```
5656

57-
Now, let's obtain the authentication token of your light node using the following command (omit the --p2p.network flag for Mainnet Beta):
57+
Now, let's obtain the authentication token of your light node using the following command:
5858

59-
```bash
59+
::: code-group
60+
61+
```bash [Arabica Devnet]
6062
AUTH_TOKEN=$(celestia light auth write --p2p.network arabica)
6163
echo -e "\n Your DA AUTH_TOKEN is $AUTH_TOKEN \n"
6264
```
6365

66+
```bash [Mocha Testnet]
67+
AUTH_TOKEN=$(celestia light auth write --p2p.network mocha)
68+
echo -e "\n Your DA AUTH_TOKEN is $AUTH_TOKEN \n"
69+
```
70+
71+
```bash [Mainnet Beta]
72+
AUTH_TOKEN=$(celestia light auth write)
73+
echo -e "\n Your DA AUTH_TOKEN is $AUTH_TOKEN \n"
74+
```
75+
76+
:::
77+
6478
The output of the command above will look similar to this:
6579

6680
```bash

guides/connect-local-da.md renamed to tutorials/da/local-da.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
# How to connect a rollup to a local DA network
1+
# Using Local DA
22

33
<!-- markdownlint-disable MD033 -->
44
<script setup>
5-
import constants from '../.vitepress/constants/constants.js'
5+
import constants from '../../.vitepress/constants/constants.js'
66
</script>
77

8-
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.
8+
## Introduction {#introduction}
9+
10+
This tutorial serves as a comprehensive guide for using the [local-da](https://github.com/rollkit/local-da) with your chain.
11+
12+
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.
913

1014
## Setting Up a Local DA Network
1115

@@ -25,10 +29,25 @@ To connect your rollup to the local DA network, you need to pass the `--rollkit.
2529

2630
Start your rollup node with the following command, ensuring to include the DA address flag:
2731

28-
```bash
32+
::: code-group
33+
34+
```sh [Quick Start]
35+
rollkit start --rollkit.da_address http://localhost:7980
36+
```
37+
38+
```sh [Wordle Chain]
2939
rollkit start \
40+
--rollkit.aggregator \
3041
--rollkit.da_address http://localhost:7980 \
31-
<other-flags>
42+
--rollkit.sequencer_rollup_id wordle
43+
```
44+
45+
:::
46+
47+
You should see the following log message indicating that your rollup is connected to the local DA network:
48+
49+
```shell
50+
I[2024-11-15|14:54:19.842] DA server is already running module=main address=http://localhost:7980
3251
```
3352

3453
## Summary

tutorials/da/overview.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
description: This page provides an overview of how rollkit integrates with DA.
3+
---
4+
5+
<!-- markdownlint-disable MD033 -->
6+
7+
# DA
8+
9+
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.
10+
11+
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.
12+
13+
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.
14+
15+
## Go DA {#go-da}
16+
17+
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`.
18+
19+
```go
20+
// DA defines very generic interface for interaction with Data Availability layers.
21+
type DA interface {
22+
// Get returns Blob for each given ID, or an error.
23+
Get(ctx context.Context, ids []ID, namespace Namespace) ([]Blob, error)
24+
25+
// Submit submits the Blobs to Data Availability layer.
26+
Submit(ctx context.Context, blobs []Blob, gasPrice float64, namespace Namespace) ([]ID, error)
27+
}
28+
```
29+
30+
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).
31+
32+
## Mock DA {#mock-da}
33+
34+
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.
35+
36+
If you revisit the logs from those tutorials, you will see one of the first lines being:
37+
38+
```shell
39+
I[2024-11-15|14:09:41.735] Starting mock DA server module=main address=http://localhost:26658
40+
```
41+
42+
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.
43+
44+
## DA Layers {#da-layers}
45+
46+
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.
47+
48+
* [Local DA](local-da.md)
49+
* [Celestia DA](celestia-da.md)
50+
* [Avail DA](avail-da.md)

0 commit comments

Comments
 (0)