Skip to content

Install and Configure 0G Data Availability (DA) Node

The 0G Data Availability (DA) node is a critical component of the 0G stack, ensuring that data is accessible and verifiable across the network. This technical guide outlines the installation of the DA server from source on an Ubuntu-based system.

Ensure your system is up to date and contains the necessary build tools and libraries for compiling Rust-based blockchain infrastructure.

Install the required packages, including protobuf-compiler and SSL development libraries:

Terminal window
sudo apt-get update
sudo apt install make clang pkg-config libssl-dev build-essential curl protobuf-compiler -y

The DA node requires the Rust compiler. Use the official installer and source the environment variables:

Terminal window
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env

Compile the DA node binary and download the necessary cryptographic parameters for the zero-knowledge setup.

Terminal window
cd $HOME
git clone https://github.com/0glabs/0g-da-node.git
cd $HOME/0g-da-node
cargo build --release

The DA node requires specific parameters to function. Execute the helper script to retrieve them:

Terminal window
./dev_support/download_params.sh

Create your local configuration file from the provided template:

Terminal window
cp $HOME/0g-da-node/config_example.toml $HOME/0g-da-node/config.toml

On the initial run, the DA node must register signer information with the DA contract. If you do not have an existing BLS private key, generate one using the built-in utility:

Terminal window
cargo run --bin key-gen

Note: Securely backup the output of the key generation. This key is required for signing data availability certificates.

To ensure the DA node runs as a persistent background process, create a systemd unit file:

Terminal window
sudo tee /etc/systemd/system/zgda.service > /dev/null <<EOF
[Unit]
Description=0G DA Node
After=network.target
[Service]
User=$USER
WorkingDirectory=$HOME/0g-da-node
ExecStart=$HOME/0g-da-node/target/release/server --config $HOME/0g-da-node/config.toml
Restart=on-failure
RestartSec=10
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF

Enable and start the service:

Terminal window
sudo systemctl daemon-reload
sudo systemctl enable zgda
sudo systemctl restart zgda

Monitor the DA node logs to ensure the server is processing requests and communicating with the 0G network:

Terminal window
sudo journalctl -u zgda -f -o cat
ActionCommand
Check Statussudo systemctl status zgda
Stop Nodesudo systemctl stop zgda
View Recent Logsjournalctl -u zgda -n 100