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

Recast this as a node/baker/DAL tutorial #495

Merged
merged 11 commits into from
Dec 20, 2024
2 changes: 2 additions & 0 deletions docs/architecture/nodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ Nodes cooperate with clients and with each other through an [RPC interface](#the

The Octez suite, which is an implementation of the Tezos node and other executables, instantiates these principles in the [Octez software architecture](https://tezos.gitlab.io/shell/the_big_picture.html).

For instructions on running a node, see the tutorial [Run a Tezos node in 5 steps](/tutorials/join-dal-baker).

## Protocol and shell

The software that runs Tezos nodes is split into two main parts:
Expand Down
21 changes: 17 additions & 4 deletions docs/tutorials/join-dal-baker.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
---
title: Join the DAL as a baker in 5 steps
title: Run a Tezos node in 5 steps
authors: Tezos core developers, Tim McMackin
last_update:
date: 21 October 2024
date: 18 December 2024
---

As described in [Nodes](/architecutre/nodes), Tezos nodes are peer-to-peer programs that run the Tezos network.
Anyone can run a node, and they might do so for many different reasons, including:

- Running nodes makes the Tezos network resilient and secure
- Public nodes may have rate limits, so running your own node allows you to send unlimited requests to it to get information about Tezos or to send transactions from your dApps
- Running a node is part of being a baker and receiving the rewards for baking

This tutorial covers setting up a Tezos node as a baker, which includes running these processes:

- An Octez node, sometimes referred to as a Tezos node
- A baker daemon
- A [DAL](/architecture/data-availability-layer) node

## Why is a DAL node needed?

The Tezos data availability layer (DAL) is a peer-to-peer network that Tezos Smart Rollups can use to fetch data securely.
The DAL is a key component for the scalability and bandwidth of Tezos and it's important for bakers to run DAL nodes along with their layer 1 nodes.

## Why are DAL bakers needed?

When users and dApps submit data to the DAL, bakers use DAL nodes to verify that the data is available.
Then the bakers attest that the data is available.
Smart Rollup nodes can retrieve the data from DAL nodes only when enough bakers have attested that the data is available.
Expand Down
66 changes: 64 additions & 2 deletions docs/tutorials/join-dal-baker/run-baker.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,54 @@
title: "Step 4: Run an Octez baking daemon"
authors: Tezos core developers, Tim McMackin
last_update:
date: 2 December 2024
date: 19 December 2024
---

Now that you have a DAL node, you can run a baking daemon that can attest to DAL data or restart an existing baking daemon to connect it to the DAL node.
Now that you have a layer 1 node and a DAL node, you can run a baking daemon that can create blocks and attests to DAL data.
If you already have a baking daemon, you can restart it to connect to the DAL node.

1. Optional: Set up a remote signer to secure the keys that the baker uses as described in [Signer](https://tezos.gitlab.io/user/key-management.html#signer) in the Octez documentation.

1. To run a baking daemon that connects to the DAL, start it as usual and pass the URL to your DAL node to it with the `--dal-node` argument:

```bash
octez-baker-PsParisC run with local node "$HOME/.tezos-node" my_baker --liquidity-baking-toggle-vote pass --adaptive-issuance-vote on --dal-node http://127.0.0.1:10732
```

Note that the command for the baker depends on the protocol version.
This example uses the ParisC protocol, so the command starts with `octez-baker-PsParisC`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to use a variable here for the protocol suffix that gets instantiated by Docusaurus at build time, to avoid changing the tutorial at a protocol shift?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few ways to do this -- I'll add a note as part of our discussion about a list of to-dos for each protocol upgrade.

Check the current version of the protocol to see what command to run, and change this command when you upgrade to newer versions of the protocol.

You may append `>>"$HOME/octez-baker.log" 2>&1` to redirect its output in a log file.

1. Ensure that the baker runs persistently.
Look up how to run programs persistently in the documentation for your operating system.
You can also refer to [Run a persistent baking node](https://opentezos.com/node-baking/baking/persistent-baker/) on opentezos.com.

For example, if your operating system uses the `systemd` software suite, your service file might look like this example:

```systemd
[Unit]
Description=Octez baker
Wants=network-online.target
After=network-online.target
Requires=octez-node.service

[Install]
WantedBy=multi-user.target

[Service]
Type=simple
User=tezos
ExecStart=octez-baker-PsParisC run with local node "$HOME/.tezos-node" my_baker --liquidity-baking-toggle-vote pass --adaptive-issuance-vote on --dal-node http://127.0.0.1:10732
WorkingDirectory=/opt/octez-baker
Restart=on-failure
RestartSec=5
StandardOutput=append:/opt/octez-baker.log
StandardError=append:/opt/octez-baker.log
SyslogIdentifier=%n
```

1. In the same terminal window, run this command:

```bash
Expand Down Expand Up @@ -99,3 +130,34 @@ Therefore, staking more tez brings more rewards but does not reduce the attestat
- Attach DAL attestations: `ready to attach DAL attestation ...`

Whether these messages appear or not after the attestation delay, proceed to [Step 5: Verifications](/tutorials/join-dal-baker/verify-rights).

## Optional: Run an accuser

The accuser is a daemon that monitors blocks and looks for problems, such as bakers who double-sign blocks or inject multiple attestations.
If it finds a problem, it posts a denunciation operation, which penalizes the baker.
timothymcmackin marked this conversation as resolved.
Show resolved Hide resolved
You don't have to run an accuser, but if you do, you can receive some of the penalties when the accuser denounces a baker.
timothymcmackin marked this conversation as resolved.
Show resolved Hide resolved

Like the baker, the command for the accuser has the protocol name at the end.
For example, if your operating system uses the `systemd` software suite, the attester service file might look like this example:

```systemd
[Unit]
Description=Octez accuser
Wants=network-online.target
After=network-online.target
Requires=octez-node.service

[Install]
WantedBy=multi-user.target

[Service]
Type=simple
User=tezos
ExecStart=octez-accuser-PsParisC run
WorkingDirectory=/opt/octez-accuser
Restart=on-failure
RestartSec=5
StandardOutput=append:/opt/octez-accuser.log
StandardError=append:/opt/octez-accuser.log
SyslogIdentifier=%n
```
21 changes: 11 additions & 10 deletions docs/tutorials/join-dal-baker/run-dal-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
title: "Step 3: Run an Octez DAL node"
authors: Tezos core developers, Tim McMackin
last_update:
date: 2 December 2024
date: 19 December 2024
---

The DAL node is responsible for temporarily storing data and providing it to bakers and Smart Rollups.
Follow these steps to run the DAL node:

1. Ensure that the port that the DAL node runs on (by default, 11732) is accessible from outside its system.
You may need to adapt your firewall rules or set up network address translation (NAT) to direct external traffic to the DAL node.
Expand Down Expand Up @@ -112,23 +113,23 @@ You can also refer to [Setting up Octez Services](https://tezos.gitlab.io/introd
```systemd
[Unit]
Description=Octez DAL node
Wants = network-online.target
After = network-online.target
Requires = octez-node.service
Wants=network-online.target
After=network-online.target
Requires=octez-node.service

[Install]
WantedBy=multi-user.target
RequiredBy = octez-baker.service
RequiredBy=octez-baker.service

[Service]
Type=simple
User=mybaker
ExecStart=/usr/bin/octez-dal-node run --data-dir /opt/dal
WorkingDirectory=/opt/dal
User=tezos
ExecStart=/usr/bin/octez-dal-node run --data-dir $HOME/.tezos-dal-node
WorkingDirectory=$HOME/.tezos-dal-node
Restart=on-failure
RestartSec=5
StandardOutput=append:/opt/dal/octez-dal-node.log
StandardError=append:/opt/dal/octez-dal-node.log
StandardOutput=append:/opt/octez-dal-node.log
StandardError=append:/opt/octez-dal-node.log
SyslogIdentifier=%n
```

Expand Down
25 changes: 24 additions & 1 deletion docs/tutorials/join-dal-baker/run-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ last_update:
date: 2 December 2024
---

The first thing you need to run a baker and a DAL node is a Tezos layer 1 node, which is an instance of the `octez-node` program and part of the Octez suite of programs.
The first thing you need is a Tezos layer 1 node, which is an instance of the `octez-node` program and part of the Octez suite of programs.

## Installing Octez

Expand Down Expand Up @@ -102,6 +102,29 @@ For example, the command to download a Ghostnet snapshot from the European serve
Look up how to run programs persistently in the documentation for your operating system.
You can also refer to [Run a persistent baking node](https://opentezos.com/node-baking/baking/persistent-baker/) on opentezos.com or [Setting up Octez Services](https://tezos.gitlab.io/introduction/services.html) in the Octez documentation.

For example, if your operating system uses the `systemd` software suite, your service file might look like this example:

```systemd
[Unit]
Description=Octez node
Wants=network-online.target
After=network-online.target

[Install]
WantedBy=multi-user.target

[Service]
Type=simple
User=tezos
ExecStart=octez-node run --rpc-addr 127.0.0.1:8732 --data-dir $HOME/.tezos-node
WorkingDirectory=/opt/octez-node
Restart=on-failure
RestartSec=5
StandardOutput=append:/opt/octez-node.log
StandardError=append:/opt/octez-node.log
SyslogIdentifier=%n
```

1. Optional: When the node has bootstrapped and caught up with the current head block, you can delete the snapshot file to save space.

In the meantime, you can continue the baking infrastructure while the node is bootstrapping.
Expand Down
2 changes: 1 addition & 1 deletion sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ const sidebars = {
'tutorials/create-an-nft/nft-tznft',
{
type: 'category',
label: 'Join the DAL as a baker',
label: 'Run a Tezos node in 5 steps',
link: {
type: 'doc',
id: 'tutorials/join-dal-baker',
Expand Down
Loading