DA Node Setup
Setting up a DA node
Update packages and Install dependencies:
sudo apt update && sudo apt upgrade -y
sudo apt install curl git wget htop tmux build-essential jq make gcc tar clang pkg-config libssl-dev ncdu protobuf-compiler -y
Install :
cd $HOME
VER="1.22.0"
wget "https://golang.org/dl/go$VER.linux-amd64.tar.gz"
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf "go$VER.linux-amd64.tar.gz"
rm "go$VER.linux-amd64.tar.gz"
[ ! -f ~/.bash_profile ] && touch ~/.bash_profile
echo "export PATH=$PATH:/usr/local/go/bin:~/go/bin" >> ~/.bash_profile
source $HOME/.bash_profile
[ ! -d ~/go/bin ] && mkdir -p ~/go/bin
go version
Install rust:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Download and build binary, download params:
cd $HOME
rm -rf 0g-da-node
git clone https://github.com/0glabs/0g-da-node.git
cd 0g-da-node
git fetch --all --tag
git checkout v1.1.3
git submodule update --init
cargo build --release
./dev_support/download_params.sh
Generate BLS private key, if you don't have one. It will register the signer information in DA contract when you first run DA node.
❗NOTE: Keep the key safe.
cargo run --bin key-gen
Create a config.toml file:
nano $HOME/0g-da-node/config.toml
Paste the following in config.toml file and insert socket_address (VPS_Public_IP:34000), signer_bls_private_key, signer_eth_private_key, miner_eth_private_key:
log_level = "info"
data_path = "./db/"
# path to downloaded params folder
encoder_params_dir = "params/"
# grpc server listen address
grpc_listen_address = "0.0.0.0:34000"
# chain eth rpc endpoint
eth_rpc_endpoint = "https://evmrpc-testnet.0g.ai"
# public grpc service socket address to register in DA contract
# ip:34000 (keep same port as the grpc listen address)
# or if you have dns, fill your dns
socket_address = "<public_ip/dns>:34000"
# data availability contract to interact with
da_entrance_address = "0x857C0A28A8634614BB2C96039Cf4a20AFF709Aa9"
# deployed block number of da entrance contract
start_block_number = 940000
# signer BLS private key
signer_bls_private_key = ""
# signer eth account private key
signer_eth_private_key = ""
# miner eth account private key, (could be the same as 'signer_eth_private_key', but not recommended)
miner_eth_private_key = ""
# whether to enable data availability sampling
enable_das = "true"
Create Service file:
sudo tee /etc/systemd/system/0gda.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=always
RestartSec=10
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
Enable and start service:
sudo systemctl daemon-reload
sudo systemctl enable 0gda
sudo systemctl start 0gda
Check logs:
sudo journalctl -u 0gda -f -o cat
Delete DA node
sudo systemctl stop 0gda
sudo systemctl disable 0gda
sudo rm /etc/systemd/system/0gda.service
rm -rf $HOME/0g-da-node