0G DA Node
Please do this step after you have completed Validator Node, Storage and KV.
0G DA Node Setup
# Current version used in doc
Binary: server
Version: 1.1.2
Service Name: 0gda.service
⚙️ Hardware Requirement
- Memory: 16 GB
- CPU: 8 cores
- Disk: 1 TB NVME SSD
- Bandwidth: 100 MBps for Download / Upload
Install dependencies
sudo apt-get update
sudo apt-get install pkg-config
sudo apt-get install libssl-dev
sudo apt-get install protobuf-compiler
sudo apt-get install clang
sudo apt-get install llvm llvm-dev
Installation
You might encounter an error during compiling. We will use 0xQuark's method to solve the issue.
# clone official DA node repo
git clone https://github.com/0glabs/0g-da-node.git
# checkout to latest branch
git checkout tags/v1.1.2 -b v1.1.2
# compile server binanry
cargo build --release
(Optional) Change paramenter in build.rs if error is encounted during cargo build
sed -i '/\.protoc_arg("--experimental_allow_proto3_optional")/d' /root/0g-da-node/grpc/build.rs
Download pre-built parameters
# run download param script
$HOME/0g-da-node/dev_support/download_params.sh
Create a copy of config.toml file
cp $HOME/0g-da-node/config_example.toml $HOME/0g-da-node/config.toml
Set 0G DA node variables
# pull variables
JSON_PORT=$(sed -n '/\[json-rpc\]/,/^address/ s/address = "0.0.0.0:\([0-9]*\)".*/\1/p' $HOME/.0gchain/config/app.toml)
ETH_RPC_ENDPOINT=http://$(wget -qO- eth0.me):$JSON_PORT
SOCKET_ADDRESS=http://$(wget -qO- eth0.me):34000
# print variables
echo JSON PORT:$JSON_PORT
echo ETH_RPC_ENDPOINT:$ETH_RPC_ENDPOINT
echo SOCKET_ADDRESS:$SOCKET_ADDRESS
Export private key temporary
PRIVATE_KEY=$(0gchaind keys unsafe-export-eth-key $WALLET_NAME)
echo $PRIVATE_KEY
[IMPORTANT] Generate BLS key for 0G DA node
remember to save this key as you will be submitting the key to smart contract and will require it to run DA node
# generate new BLS key
cd $HOME/0g-da-node
cargo run --bin key-gen
#copy the BLS key generated and paste here to set key for next step
read -sp "Enter your extracted bls private key: " BLS_PRIVATE_KEY && echo
Configure config.toml with variables set
sed -i "s|eth_rpc_endpoint = .*|eth_rpc_endpoint = \"$ETH_RPC_ENDPOINT\"|" $HOME/0g-da-node/config.toml
sed -i "s|socket_address = .*|socket_address = \"$SOCKET_ADDRESS\"|" $HOME/0g-da-node/config.toml
sed -i "s|da_entrance_address = .*|da_entrance_address = \"0x857C0A28A8634614BB2C96039Cf4a20AFF709Aa9\"|" $HOME/0g-da-node/config.toml
sed -i "s|start_block_number = .*|start_block_number = 940000|" $HOME/0g-da-node/config.toml
sed -i "s|signer_bls_private_key = .*|signer_bls_private_key = \"$BLS_PRIVATE_KEY\"|" $HOME/0g-da-node/config.toml
sed -i "s|signer_eth_private_key = .*|signer_eth_private_key = \"$PRIVATE_KEY\"|" $HOME/0g-da-node/config.toml
Create 0gda service to run in the background
sudo tee /etc/systemd/system/0gda.service > /dev/null <<EOF
[Unit]
Description=DA Node
After=network.target
[Service]
User=$HOME
WorkingDirectory=$HOME/0g-da-node/target/release
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
Start 0G DA Node
sudo systemctl daemon-reload && \
sudo systemctl enable 0gda && \
sudo systemctl start 0gda && \
sudo journalctl -u 0gda -f -o cat
Stop 0G DA node
sudo systemctl stop 0gda
Check 0G DA Logs
sudo journalctl -u 0gda -f -o cat
Log examples
2024-07-31T03:34:24.845407Z INFO chain_state::da_handler: checking da entrance logs from 468665 to 468665 block..
2024-07-31T03:34:29.868067Z INFO chain_state::da_handler: checking da entrance logs from 468666 to 468666 block..
2024-07-31T03:34:34.906116Z INFO chain_state::da_handler: checking da entrance logs from 468667 to 468667 block..
2024-07-31T03:34:39.928655Z INFO chain_state::da_handler: checking da entrance logs from 468668 to 468668 block..
2024-07-31T03:34:50.031114Z INFO chain_state::da_handler: checking da entrance logs from 468669 to 468669 block..
2024-07-31T03:34:55.136151Z INFO chain_state::da_handler: checking da entrance logs from 468670 to 468670 block..
2024-07-31T03:35:00.178691Z INFO chain_state::da_handler: checking da entrance logs from 468671 to 468671 block..
2024-07-31T03:35:00.186358Z INFO chain_state::da_handler: new file found, epoch: 81, quorum_id: 0, data_root: [B, 39, D1, 35, BF, 3B, 55, C9, 30, 13, 78, 53, D, 5, 8, C4, 90, 28, C7, 6E, 8A, 2F, 98, DD, 85, FF, 9A, 1, 29, D9, 1C, 84]
2024-07-31T03:35:10.263287Z INFO chain_state::da_handler: checking da entrance logs from 468672 to 468672 block..
2024-07-31T03:35:15.295832Z INFO chain_state::da_handler: checking da entrance logs from 468673 to 468673 block..
2024-07-31T03:35:17.616324Z INFO grpc::service: Received request remote_addr=Some(13.208.209.200:53686)
2024-07-31T03:35:17.622721Z INFO grpc::service: used 5 ms to deserialize 1 slices.
2024-07-31T03:35:17.685958Z INFO grpc::service: used 62 ms to verify 1 slices.
2024-07-31T03:35:17.693743Z INFO grpc::service: responsed in 77 ms
2024-07-31T03:35:20.320293Z INFO chain_state::da_handler: checking da entrance logs from 468674 to 468674 block..
2024-07-31T03:35:30.367462Z INFO chain_state::da_handler: checking da entrance logs from 468675 to 468675 block..
2024-07-31T03:35:35.448298Z INFO chain_state::da_handler: checking da entrance logs from 468676 to 468676 block..
2024-07-31T03:36:26.126599Z INFO chain_state::da_handler: checking da entrance logs from 468684 to 468684 block..
Last updated