---
# System prepended metadata

title: How to run a DAL node

---

[toc]
# How to run a DAL node

Various roles need to run the DAL node, each requiring a unique configuration based on their responsibilities. These roles are:

- Baker
- Bootstrap Node
- Slot Producer
- Slot Consumer


In this document, we will explain the responsibilities of each role and guide you on how to configure the DAL node appropriately for each specific role.

## Basic commands

Before we get into how each role should set up and operate their nodes, let's start by explaining the essential commands that everyone will need to use.

### Configure the DAL node

```
$ octez-dal-node config init --data-dir <data-dir> --rpc-addr <rpc-addr> --net-addr <net-addr> --expected-pow <expected-pow>
```

- `--data-dir`: The location of the directory in which we store the dal data.
- `--rpc-addr`: The RPC address in which this instance of DAL node can be reached.
- `--net-addr`: The P2P address in which this instance of DAL node can be reached.
- `--expected-pow`: Expected level of proof-of-work for peers identity. Should be the same between nodes in the network.

Further more, there are role-specific arguments that specify the "profile" in which the DAL node runs in (`--producer-profile`, `--bootstrap-profile`, etc). They will be explained in later sections.

### Run the DAL node

```
$ octez-dal-node run --data-dir <data-dir> --endpoint <your-octez-node-rpc-address-and-port>
```

- `--data-dir`: The data directory you specified when running `octez-dal-node config init`
- `--endpoint`: The RPC endpoint of your octez-node.


## Run a DAL node as a baker

As a baker, you have the duty to attest the availability of shards that have been uploaded to the DAL network. This process involves
- downloading and verifying these shards, and
- posting attestation about their availability to L1.

In order to accomplish this, you are required to operate the DAL node together with your baker node in the following way.

### Configure the DAL node

First, you must configure your DAL node:


```
$ octez-dal-node config init --data-dir <data-dir> --rpc-addr <rpc-addr> --net-addr <net-addr> --expected-pow <expected-pow>
```

Node that for the baker no profile argument is required.

For example, for dailynet:

```
$ touch ~/tezos-dailynet-dal
$ octez-dal-node config init --data-dir ~/tezos-dailynet-dal --rpc-addr 127.0.0.1:49025 --net-addr 127.0.0.1:36403 --expected-pow 26.
```

### Run the DAL node

Next, you must run your DAL node:

```
$ octez-dal-node run --data-dir <data-dir> --endpoint <octez-node-rpc-addr>
```

For example:

```
$  octez-dal-node run --data-dir ~/tezos-dailynet-dal --endpoint http://localhost:8732
```

### Start baker daemon

When starting the baker daemon, provide the `<rpc-addr>` you specified when initializing the DAL node:
```
$ ./octez-baker run ... --dal-node <rpc-addr>
```

## Run a DAL node as a slot producer

The slot producer's role is to publish slots on the DAL network. For instance, a roll-up sequencer will run a slot producer to aggregate transactions and send them to the DAL for consumption by the roll-up node. 

When publishing some data (e.g. a batch of transactions), the slot producer follows these steps:
1. Post the data to the DAL node. 
    - The DAL node will split the message into shards and return the commitment to the shards.
3. Post the commitment to the L1.

Then, after `attestation_lag` blocks are past and the slot receives enough attestations, the data will be considered "available".


### Configure the DAL node

First, you must configure your DAL node:


```
$ octez-dal-node config init --data-dir <data-dir> --rpc-addr <rpc-addr> --net-addr <net-addr> --expected-pow <expected-pow> --producer-profile <slot-indexes>
```

The key argument is the `--producer-profile <slot-indexes>`. The `<slot-indexes>` here are the slot indexes in which the slot producer will post data to.


For example, for a dailynet that publishes to slot index `0,1,2,3,4`:

```
$ touch ~/tezos-dailynet-dal
$ ./octez-node run --data-dir /tmp/tezt-1036835/1/node1 --net-addr 127.0.0.1:53733 --rpc-addr localhost:45655 --allow-all-rpc localhost:45655 --network https://teztnets.xyz/dailynet-2023-09-26

```

### Run the DAL node

Next, you must run your DAL node:

```
$ octez-dal-node run --data-dir <data-dir> --endpoint <octez-node-rpc-addr>
```

For example:

```
$  octez-dal-node run --data-dir ~/tezos-dailynet-dal --endpoint http://localhost:8732
```

### Publish data to the DAL

TBF


## Run a DAL node as a bootstrap node

The role of a bootstrap node is to enable DAL nodes to find each other at the bootstrap phase.

DAL nodes form their own P2P network independent of the Tezos L1 P2P. This means the DAL nodes need their own peer discovery mechanism when bootstrapping nodes to the network. This works as follows:


- Some entity in the network runs a DAL node in the bootstrap profile (will explain how later).
- When a DAL node starts, it first connects to the DAL bootstrap node.
- The DAL bootstrap node responds with other DAL nodes.

Next, we will explain how to run a bootstrap node.

### Configure the DAL node

:::danger
#### Important note:
If you run a DAL node with the `--bootstrap-profile` argument, that node will need to specialize in bootstrapping nodes and will NOT be able to download/verify shards on behalf of the baker. This is problematic as bootstrap node operators often run bakers.

In order to deal with this incompatibility issue, a bootstrap node operator must:
- First start a DAL node for it's baker by following the [Run a DAL node as a baker](#Run-a-DAL-node-as-a-baker) section.
- Then start a **new separate DAL node** by following the instructions in this section.

:::

First, you must configure your DAL node:


```
$ octez-dal-node config init --data-dir <data-dir> --rpc-addr <rpc-addr> --net-addr <net-addr> --expected-pow <expected-pow> --bootstrap-node
```

Note that the `--bootstrap-node` argument is provided to start the node as a bootstrap node. Also note that the `<data-dir>` and `<net-addr>` must be different from the one used in [Run a DAL node as a baker](#Run-a-DAL-node-as-a-baker) section.

For example, for dailynet:

```
$ touch ~/tezos-dailynet-dal-bootstrap
$ octez-dal-node config init --data-dir ~/tezos-dailynet-dal-bootstrap --rpc-addr 127.0.0.1:49025 --net-addr 127.0.0.1:36404 --expected-pow 26. --bootstrap-node
```


### Run the DAL node

Next, you must run your DAL node:

```
$ octez-dal-node run --data-dir <data-dir> --endpoint <octez-node-rpc-addr>
```

For example:

```
$  octez-dal-node run --data-dir ~/tezos-dailynet-dal-bootstrap --endpoint http://localhost:8732
```

### Add the bootstrap node to the network config


Add the DAL bootstrap node address (the one specified in `--net-addr` above) to the network config file under `"network" -> "dal_config" -> "bootstrap_peers"`. The exact way to do this will depend on the network you are connecting to. Here is an example of how the updated config file will look like:

```
{ "data-dir": "...",
  "p2p": { ... },
  "network":
    { "genesis":
        { ... },
      "genesis_parameters":
        { ... },
      "chain_name": "...",
      "sandboxed_chain_name": "...",
      "default_bootstrap_peers": [ ... ],
      "dal_config":
        { "activated": true,
          "use_mock_srs_for_testing":
            { "redundancy_factor": 16, "page_size": 4096,
              "slot_size": 262144, "number_of_shards": 512 },
          "bootstrap_peers": [ <your-bootstrap-dal-node-net-addr> ] } } }
```
