Skip to content

Install and Configure 0G DA Client

The 0G DA Client serves as the interface for interacting with the Data Availability layer. It includes the disperser service, which is responsible for encoding data and submitting it to the 0G network.

Before installation, ensure your system has the necessary build tools and a supported version of the Go programming language.

Update the package index and install required utilities:

Terminal window
sudo apt-get update
sudo apt-get install cmake screen -y

The DA Client requires Go 1.22.0 or higher. Use the following commands to install or update your Go environment:

Terminal window
wget https://go.dev/dl/go1.22.0.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.22.0.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc

Clone the repository and build the client binaries from source.

Terminal window
cd $HOME
git clone -b v1.0.0-testnet https://github.com/0glabs/0g-da-client.git
cd $HOME/0g-da-client
make build

The DA Client’s behavior is controlled via the Makefile located in the disperser directory. You must configure your RPC endpoints and private keys here.

Open the Makefile for editing:

Terminal window
nano $HOME/0g-da-client/disperser/Makefile

Within the run_combined section, locate and update the following flags with your specific infrastructure details:

FlagDescription
--chain.rpcYour 0G Chain RPC endpoint
--chain.private-keyThe private key for the account paying gas fees
--combined-server.storage.flow-contractThe address of the Flow contract

Creating a systemd service ensures the DA Client remains active and recovers automatically from crashes.

Terminal window
sudo tee /etc/systemd/system/0gdacli.service > /dev/null <<EOF
[Unit]
Description=0G DA Client Node
After=network.target
[Service]
User=root
WorkingDirectory=$HOME/0g-da-client/disperser
ExecStart=/usr/local/go/bin/go run combined_server.go --config config.toml
Restart=always
RestartSec=10
LimitNOFILE=65535
Environment="PATH=/usr/local/go/bin:/usr/bin:/bin"
[Install]
WantedBy=multi-user.target
EOF

Note: While the original instructions used make run_combined, it is considered a best practice in production to point ExecStart directly to the binary or the specific Go entry point to avoid overhead.

Reload the systemd daemon and enable the service:

Terminal window
sudo systemctl daemon-reload
sudo systemctl enable 0gdacli
sudo systemctl start 0gdacli

Monitor the client’s output to ensure it is successfully dispersing data to the DA nodes:

Terminal window
sudo journalctl -u 0gdacli -f -o cat
ActionCommand
Check Statussudo systemctl status 0gdacli
Restart Clientsudo systemctl restart 0gdacli
Stop Clientsudo systemctl stop 0gdacli