Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Commit 48fb7da

Browse files
Update DAL file server tutorial for Ghostnet (#424)
* WIP update tutorial for Ghostnet * REmove weeklynet issue * Clarify default port * This needs to be "slots", not "slot" * Complete update of tutorial for Ghostnet * Update source command after Rust installation * Some tweaks * Typo * root-relative links * Updates to get it working * Doesn't compile with Rust 1.81 * Install trusted setup * Correct override command * correct URL * Bakers do the attesting * Correct step numbering * Clarify variables * Some final tweaks * Default port for node. * Remove unnecessary ---endpoint arguments
1 parent 16c6298 commit 48fb7da

File tree

8 files changed

+215
-149
lines changed

8 files changed

+215
-149
lines changed

docs/tutorials/build-files-archive-with-dal.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
title: Implement a file archive with the DAL and a Smart Rollup
3-
authors: 'Tezos Core Developers'
3+
authors: Tezos Core Developers
44
last_update:
5-
date: 10 June 2024
5+
date: 27 January 2025
66
dependencies:
77
octez: 21.2
88
rust: 1.80.0
@@ -12,17 +12,16 @@ dependencies:
1212
The Data Availability Layer (DAL) is a companion peer-to-peer network for the Tezos blockchain, designed to provide additional data bandwidth to Smart Rollups.
1313
It allows users to share large amounts of data in a way that is decentralized and permissionless, because anyone can join the network and post and read data on it.
1414

15-
In this tutorial, you will set up a file archive that stores and retrieves files with the DAL.
15+
This tutorial uses the Ghostnet test network, but you can use the information in it to work with other test networks or Tezos Mainnet.
16+
17+
In this tutorial, you set up a file archive that stores and retrieves files with the DAL.
1618
You will learn:
1719

1820
- How data is organized and shared with the DAL and the reveal data channel
1921
- How to read data from the DAL in a Smart Rollup
2022
- How to host a DAL node
2123
- How to publish data and files with the DAL
2224

23-
This tutorial uses the [Weeklynet test network](https://teztnets.com/weeklynet-about).
24-
Weeklynet runs just like other Tezos networks like Mainnet and Ghostnet, with its own nodes, bakers, and accusers, so you don't need to run your own nodes and bakers.
25-
2625
See these links for more information about the DAL:
2726

2827
- For technical information about how the DAL works, see [Data Availability Layer](https://tezos.gitlab.io/shell/dal.html) in the Octez documentation.
@@ -33,18 +32,19 @@ See these links for more information about the DAL:
3332
In this tutorial, you set up these components:
3433

3534
- The Octez client, which you use to manage a local wallet, deploy a Smart Rollup, and send data to the DAL
35+
- A layer 1 node to provide a connection to Tezos and information about the state of layer 1, including metadata about what data is available on the DAL
3636
- A Data Availability Layer node (not to be confused with a layer 1 node), which stores data temporarily and distributes it to Smart Rollups
3737
- A Smart Rollup that listens for data published to the DAL, retrieves it from the DAL node, and stores it locally
3838
- A Smart Rollup node that runs your Smart Rollup
3939

40-
For simplicity, you do not set up a layer 1 node or a baker, which are responsible for verifying that the data is available before Smart Rollups can access it.
41-
Instead, you use the existing nodes and bakers that are running on Weeklynet.
40+
For simplicity, you do not set up a baker, which is responsible for verifying and attesting that the data is available before Smart Rollups can access it.
41+
For instructions on running a layer 1 node and baker with the DAL, see the tutorial [Join the DAL as a baker, in 5 steps](/tutorials/join-dal-baker).
4242

4343
## Tutorial diagram
4444

4545
Here is a diagram that shows the components that you set up in this tutorial in a light blue background:
4646

47-
![A diagram of the DAL file tutorial, highlighting the Octez client, DAL node, and Smart Rollup that you create with a light blue background to distinguish them from the existing DAL nodes, layer 1 nodes, and bakers](/img/tutorials/dal-file-tutorial-setup.png)
47+
![A diagram of the DAL file tutorial, highlighting the Octez client, DAL node, layer 1 node, and Smart Rollup that you create with a light blue background to distinguish them from the existing DAL nodes, layer 1 nodes, and bakers](/img/tutorials/dal-file-tutorial-setup.png)
4848

4949
<!-- https://lucid.app/lucidchart/58f5577e-91b5-4237-89c4-a8cdf81c71ad/edit -->
5050

@@ -93,7 +93,7 @@ The DAL works like this:
9393
For example, if a certificate is included in level 100 and the attestation lag is 4, bakers must attest that the data is available in level 104, along with their usual attestations that build on level 103.
9494

9595
If enough shards are attested in that level, the data becomes available to Smart Rollups at the end of layer 104.
96-
If not enough shards are attested in that level, the certificate is considered bogus and the related data is dropped.
96+
If not enough shards are attested in that level, the certificate is considered bogus, the related data is dropped, and Smart Rollups cannot access it.
9797

9898
1. The Smart Rollup node monitors the blocks and when it sees attested DAL data, it connects to a DAL node to request the data.
9999
Smart Rollups must store the data if they need it because it is available on the DAL for only a short time.

docs/tutorials/build-files-archive-with-dal/get-dal-params.md

Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
title: "Part 2: Getting the DAL parameters"
3-
authors: 'Tezos Core Developers'
3+
authors: Tezos core developers, Tim McMackin
44
last_update:
5-
date: 14 February 2024
5+
date: 27 Jan 2025
66
---
77

88
The Data Availability Layer stores information about the available data in layer 1 blocks.
@@ -27,7 +27,7 @@ Different networks can have different DAL parameters.
2727
Future changes to the protocol may allow the DAL to resize dynamically based on usage.
2828

2929
Therefore, clients must get information about the DAL before sending data to it.
30-
In these steps, you set up a simple Smart Rollup to get the current DAL parameters and print them to the log.
30+
Smart contracts can't access the DAL; it is intended for Smart Rollups, so in these steps you set up a simple Smart Rollup to get the current DAL parameters and print them to the log.
3131

3232
## Prerequisites
3333

@@ -52,10 +52,13 @@ To get the DAL parameters, you can use built-in functions in the Tezos [Rust SDK
5252
tezos-smart-rollup = { version = "0.2.2", features = [ "proto-alpha" ] }
5353
```
5454

55+
If you set up your Docker container with a connected folder on the host machine, you can create this file in the connected folder and it will appear in the Docker container.
56+
5557
As a reminder, the kernel of a Smart Rollup is a WASM program.
5658
The `proto-alpha` feature is necessary to get access to the functions specific to the DAL because they are not yet released in the main version of the Smart Rollup toolkit.
5759

5860
If you need a text editor inside the Docker container, you can run `sudo apk add nano` to install the [Nano text editor](https://www.nano-editor.org/).
61+
If you set up the container with a volume, you can use any editor on your host machine to edit the file and it appears in the linked folder in the container.
5962

6063
1. Create a file named `src/lib.rs` to be the kernel.
6164

@@ -74,10 +77,15 @@ To get the DAL parameters, you can use built-in functions in the Tezos [Rust SDK
7477

7578
This function gets the DAL parameters of the currently connected network and prints them to the log.
7679

77-
1. From the folder that contains the `Cargo.toml` file, run these commands to build the kernel:
80+
1. From the folder that contains the `Cargo.toml` file, run this command to build the kernel:
7881

7982
```bash
8083
cargo build --release --target wasm32-unknown-unknown
84+
```
85+
86+
1. Run this command to copy the compiled kernel to the current folder:
87+
88+
```bash
8189
cp target/wasm32-unknown-unknown/release/files_archive.wasm .
8290
```
8391

@@ -98,30 +106,33 @@ Now the Smart Rollup is ready to deploy.
98106

99107
## Deploying the Smart Rollup and starting a node
100108

101-
Follow these steps to deploy the Smart Rollup to Weeklynet and start a node:
109+
Follow these steps to deploy the Smart Rollup to Ghostnet and start a node:
102110

103-
1. Run this command to deploy the Smart Rollup, replacing `$MY_ACCOUNT` with your account alias and `$ENDPOINT` with the RPC endpoint:
111+
1. Run this command to deploy the Smart Rollup, replacing `my_wallet` with your Octez client account alias:
104112

105113
```bash
106-
octez-client --endpoint ${ENDPOINT} \
107-
originate smart rollup files_archive from ${MY_ACCOUNT} \
114+
octez-client originate smart rollup files_archive from my_wallet \
108115
of kind wasm_2_0_0 of type unit with kernel "$(cat installer.hex)" \
109116
--burn-cap 2.0 --force
110117
```
111118

112-
1. Start the node with this command:
119+
The Octez client assumes that your local node is running at http://127.0.0.1:8732.
120+
If your node is running at a different host name or port, pass the host name and port of the node to the `--endpoint` argument.
121+
For example, if the node is running on port 8733, include `--endpoint http://127.0.0.1:8733` in the command.
122+
123+
1. Start the Smart Rollup node with this command:
113124

114125
```bash
115-
octez-smart-rollup-node --endpoint ${ENDPOINT} \
116-
run observer for files_archive with operators \
117-
--data-dir ./_rollup_node --log-kernel-debug
126+
octez-smart-rollup-node run observer for files_archive \
127+
with operators --data-dir ./_rollup_node --log-kernel-debug
118128
```
119129

120130
For simplicity, this command runs the Smart Rollup in observer mode, which does not require a stake of 10,000 tez to publish commitments.
121131

122-
1. Open a new terminal window in the same environment.
123-
If you are using a Docker container, you can enter the container with the `docker exec` command, as in `docker exec -it my-image /bin/sh`.
124-
To get the name of the Docker container, you run the `docker ps` command.
132+
Like the `octez-client` command, this command assumes that your local node is running at http://127.0.0.1:8732.
133+
If your node is running at a different host name or port, pass the host name and port of the node to the `--endpoint` argument.
134+
135+
1. Leave the node running in that terminal window and open a new terminal window in the same environment.
125136

126137
1. Run this command to watch the node's log:
127138

@@ -132,11 +143,12 @@ To get the name of the Docker container, you run the `docker ps` command.
132143
The log prints the current DAL parameters, as in this example:
133144

134145
```
135-
RollupDalParameters { number_of_slots: 32, attestation_lag: 4, slot_size: 65536, page_size: 4096 }
136-
RollupDalParameters { number_of_slots: 32, attestation_lag: 4, slot_size: 65536, page_size: 4096 }
137-
RollupDalParameters { number_of_slots: 32, attestation_lag: 4, slot_size: 65536, page_size: 4096 }
138-
RollupDalParameters { number_of_slots: 32, attestation_lag: 4, slot_size: 65536, page_size: 4096 }
139-
RollupDalParameters { number_of_slots: 32, attestation_lag: 4, slot_size: 65536, page_size: 4096 }
146+
RollupDalParameters { number_of_slots: 32, attestation_lag: 8, slot_size: 126944, page_size: 3967 }
147+
RollupDalParameters { number_of_slots: 32, attestation_lag: 8, slot_size: 126944, page_size: 3967 }
148+
RollupDalParameters { number_of_slots: 32, attestation_lag: 8, slot_size: 126944, page_size: 3967 }
149+
RollupDalParameters { number_of_slots: 32, attestation_lag: 8, slot_size: 126944, page_size: 3967 }
150+
RollupDalParameters { number_of_slots: 32, attestation_lag: 8, slot_size: 126944, page_size: 3967 }
151+
RollupDalParameters { number_of_slots: 32, attestation_lag: 8, slot_size: 126944, page_size: 3967 }
140152
```
141153

142154
These parameters are:
@@ -148,11 +160,11 @@ These parameters are:
148160

149161
## Setting up a deployment script
150162

151-
In later parts of this tutorial, you will update and redeploy the Smart Rollup multiple times.
163+
In later parts of this tutorial, you update and redeploy the Smart Rollup multiple times.
152164
To simplify the process, you can use this script:
153165

154166
```bash
155-
#!/usr/bin/bash
167+
#!/bin/sh
156168

157169
alias="${1}"
158170

@@ -167,25 +179,24 @@ cp target/wasm32-unknown-unknown/release/files_archive.wasm .
167179
smart-rollup-installer get-reveal-installer -P _rollup_node/wasm_2_0_0 \
168180
-u files_archive.wasm -o installer.hex
169181

170-
octez-client --endpoint ${ENDPOINT} \
171-
originate smart rollup files_archive from "${alias}" of kind wasm_2_0_0 \
182+
octez-client originate smart rollup files_archive from "${alias}" of kind wasm_2_0_0 \
172183
of type unit with kernel "$(cat installer.hex)" --burn-cap 2.0 --force
173184

174-
octez-smart-rollup-node --endpoint ${ENDPOINT} \
175-
run observer for files_archive with operators --data-dir _rollup_node \
185+
octez-smart-rollup-node run observer for files_archive \
186+
with operators --data-dir _rollup_node \
176187
--dal-node http://localhost:10732 --log-kernel-debug
177188
```
178189

179-
To use it, save it in a file with an `sh` extension, such as `deploy_smart_rollup.sh` and give it executable permission.
190+
To use it, save it in a file with an `sh` extension, such as `deploy_smart_rollup.sh` and give it executable permission by running `chmod +x deploy_smart_rollup.sh`.
180191
Then you can run it any tme you update the `lib.rs` or `Cargo.toml` files to deploy a new Smart Rollup by passing your account alias, as in this example:
181192

182193
```bash
183-
./deploy_smart_rollup.sh $MY_ACCOUNT
194+
./deploy_smart_rollup.sh my_wallet
184195
```
185196

186197
If you run this script and see an error that says that the file was not found, update the first line of the script (the shebang) to the path to your shell interpreter.
187-
For example, if you are using the Tezos Docker image, the path is `/bin/sh`, so the first line becomes `#!/bin/sh`.
188-
Then try the command `./deploy_smart_rollup.sh $MY_ACCOUNT` again.
198+
For example, if you are using the Tezos Docker image, the path is `/bin/sh`, so the first line is `#!/bin/sh`.
199+
Then try the command `./deploy_smart_rollup.sh my_wallet` again.
189200

190201
In the next section, you will get information about the state of slots in the DAL.
191202
See [Part 3: Getting slot information](/tutorials/build-files-archive-with-dal/get-slot-info).

docs/tutorials/build-files-archive-with-dal/get-slot-info.md

Lines changed: 43 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
title: "Part 3: Getting slot information"
3-
authors: 'Tezos Core Developers'
3+
authors: Tezos core developers, Tim McMackin
44
last_update:
5-
date: 14 February 2024
5+
date: 11 September 2024
66
---
77

88
When clients send data to the DAL, they must choose which slot to put it in.
@@ -11,9 +11,8 @@ If more than one client tries to write to the same slot and a baker includes tho
1111
The other operations fail and the clients must re-submit the data to be included in a future block.
1212

1313
For this reason, clients should check the status of slots to avoid conflicts.
14-
For example, slots 0, 30, and 31 are often used for regression tests.
1514

16-
To see which slots are in use, you can use the Explorus indexer at https://explorus.io/dal and select Weeklynet.
15+
To see which slots are in use, you can use the Explorus indexer at https://explorus.io/dal and select your network.
1716
For example, this screenshot shows that slots 10 and 25 are in use:
1817

1918
![The Explorus indexer, showing the slots that are in use in each block](/img/tutorials/dal-explorus-slots.png)
@@ -24,16 +23,33 @@ Similarly, the protocol assigns bakers to monitor certain slots.
2423

2524
## Starting a DAL node
2625

27-
To run a DAL node, use the Octez `octez-dal-node` command and pass the slots to monitor in the `--producer-profiles` argument.
26+
To run a DAL node, you must configure a set of cryptographic parameters for it and the use the Octez `octez-dal-node` command and pass the slots to monitor in the `--observer-profiles` argument:
2827

29-
Run this command to start a DAL node and monitor slot 0:
28+
1. In a new terminal window in the Docker container, run this command to download the trusted setup scripts:
3029

31-
```bash
32-
octez-dal-node run --endpoint ${ENDPOINT} \
33-
--producer-profiles=0 --data-dir _dal_node
34-
```
30+
```bash
31+
wget https://gitlab.com/tezos/tezos/-/raw/master/scripts/install_dal_trusted_setup.sh https://gitlab.com/tezos/tezos/-/raw/master/scripts/version.sh
32+
```
33+
34+
1. Run this command to make the scripts executable:
35+
36+
```bash
37+
chmod +x install_dal_trusted_setup.sh version.sh
38+
```
39+
40+
1. Run this command to install the trusted setup:
3541

36-
Leave this process running in terminal window.
42+
```bash
43+
./install_dal_trusted_setup.sh --legacy
44+
```
45+
46+
1. Run this command to start a DAL node and monitor slot 0:
47+
48+
```bash
49+
octez-dal-node run --observer-profiles=0 --data-dir _dal_node
50+
```
51+
52+
Leave this process running in the terminal window.
3753

3854
## Accessing the slot data from a Smart Rollup
3955

@@ -122,14 +138,13 @@ Follow these steps to update the Smart Rollup to access information about slot 0
122138
tezos-smart-rollup-host = { version = "0.2.2", features = [ "proto-alpha" ] }
123139
```
124140

125-
1. Stop the Smart Rollup process.
126-
127-
1. Run the commands to build and deploy the Smart Rollup and start the node.
141+
1. Stop the process that is running the `octez-smart-rollup-node` program.
128142

143+
1. Run the commands to build and deploy the Smart Rollup and start the Smart Rollup node.
129144

130-
If you set up the deployment script as described in [Part 2: Getting the DAL parameters](/tutorials/build-files-archive-with-dal/get-dal-params), you can run `./deploy_smart_rollup.sh $MY_ACCOUNT`.
145+
If you set up the deployment script as described in [Part 2: Getting the DAL parameters](/tutorials/build-files-archive-with-dal/get-dal-params), you can run `./deploy_smart_rollup.sh my_wallet`, where `my_wallet` is the Octez client alias of your address.
131146

132-
If not, run these commands, using your account alias for `MY_ACCOUNT`:
147+
If not, run these commands, where `my_wallet` is the Octez client alias of your address:
133148

134149
```bash
135150
rm -rf _rollup_node
@@ -139,12 +154,11 @@ Follow these steps to update the Smart Rollup to access information about slot 0
139154
smart-rollup-installer get-reveal-installer -P _rollup_node/wasm_2_0_0 \
140155
-u files_archive.wasm -o installer.hex
141156

142-
octez-client --endpoint ${ENDPOINT} \
143-
originate smart rollup files_archive from "${MY_ACCOUNT}" of kind wasm_2_0_0 \
157+
octez-client originate smart rollup files_archive from my_wallet of kind wasm_2_0_0 \
144158
of type unit with kernel "$(cat installer.hex)" --burn-cap 2.0 --force
145159

146-
octez-smart-rollup-node --endpoint ${ENDPOINT} \
147-
run observer for files_archive with operators --data-dir _rollup_node \
160+
octez-smart-rollup-node run observer for files_archive \
161+
with operators --data-dir _rollup_node \
148162
--dal-node http://localhost:10732 --log-kernel-debug
149163
```
150164

@@ -153,21 +167,21 @@ Follow these steps to update the Smart Rollup to access information about slot 0
153167
The log shows information about slot 0, as in this example:
154168

155169
```
156-
RollupDalParameters { number_of_slots: 32, attestation_lag: 4, slot_size: 65536, page_size: 4096 }
157-
No attested slot at index 0 for level 56875
170+
RollupDalParameters { number_of_slots: 32, attestation_lag: 8, slot_size: 126944, page_size: 3967 }
171+
No attested slot at index 0 for level 7325504
158172
See you in the next level
159-
RollupDalParameters { number_of_slots: 32, attestation_lag: 4, slot_size: 65536, page_size: 4096 }
160-
Attested slot at index 0 for level 56876: [16, 0, 0, 2, 89, 87, 0, 0, 0, 0]
173+
RollupDalParameters { number_of_slots: 32, attestation_lag: 8, slot_size: 126944, page_size: 3967 }
174+
No attested slot at index 0 for level 7325505
161175
See you in the next level
162-
RollupDalParameters { number_of_slots: 32, attestation_lag: 4, slot_size: 65536, page_size: 4096 }
163-
No attested slot at index 0 for level 56877
176+
RollupDalParameters { number_of_slots: 32, attestation_lag: 8, slot_size: 126944, page_size: 3967 }
177+
No attested slot at index 0 for level 7325506
164178
See you in the next level
165179
```
166180

167-
For the first 4 Tezos blocks produced after the origination of the Smart Rollup, the kernel will report that no slot has been attested for the targeted level, _even if Explorus states the opposite_.
181+
For the first 8 Tezos blocks produced after the origination of the Smart Rollup, the kernel will report that no slot has been attested for the targeted level, _even if Explorus states the opposite_.
168182
This is because, as of January, 2024, a Smart Rollup cannot fetch the content of a slot published before it is originated.
169-
This is why you must wait for 4 blocks before seeing slot page contents being
183+
This is why you must wait for 8 blocks before seeing slot page contents being
170184
logged.
171185

172186
Now that you can see the state of the slots, you can find an unused slot and publish data to it.
173-
When you are ready, continue to [Part 3: Publishing on the DAL](/tutorials/build-files-archive-with-dal/publishing-on-the-dal).
187+
When you are ready, continue to [Part 4: Publishing on the DAL](/tutorials/build-files-archive-with-dal/publishing-on-the-dal).

0 commit comments

Comments
 (0)