Skip to content

Installation

0G banner”

Hardware Requirement
CharacteristicSpecification
Operating SystemUbuntu 18.04 or later LTS
Number of CPUs8
RAM16GB
Storage1TB NVMe SSD
Bandwidth100mps for Download / Upload
1. Install dependencies
Terminal window
sudo apt-get update
sudo apt-get install clang cmake build-essential pkg-config libssl-dev protobuf-compiler llvm llvm-dev
2. Install go
Terminal window
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" && \
echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> ~/.bash_profile && \
source ~/.bash_profile && \
go version
3. Install rust
Terminal window
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
4. Download & build binary
Terminal window
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
banner banner
Download params
Terminal window
./dev_support/download_params.sh
banner
5. Generate BLS private key:

On the first run of DA node, it will register the signer information in DA contract. To generate a BLS private key if don’t have:

Terminal window
cargo run --bin key-gen
banner banner
6. Configuration
Terminal window
nano $HOME/0g-da-node/config.toml

Sample:

Terminal window
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 = "VPS_Public_IP: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"
  • Replace your keys
socket_address = VPS_Public_IP:34000 signer_bls_private_key = 85656xxxxxxx signer_eth_private_key = 4534xxxxxx miner_eth_private_key = 4534xxxxxx
7. Create service
Terminal window
sudo tee /etc/systemd/system/0gda.service > /dev/null <<EOF
[Unit]
Description=0G-DA Node
After=network.target
[Service]
User=root
Environment="RUST_BACKTRACE=full"
Environment="RUST_LOG=debug"
WorkingDirectory=/root/0g-da-node
ExecStart=/root/0g-da-node/target/release/server --config /root/0g-da-node/config.toml
Restart=always
RestartSec=10
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
8. Start node
Terminal window
sudo systemctl daemon-reload && \
sudo systemctl enable 0gda && \
sudo systemctl start 0gda && \
sudo systemctl status 0gda
9. Check log
Terminal window
sudo journalctl -u 0gda -f -o cat

Result:

Terminal window
Started 0G-DA Node.
2024-07-17T09:41:10.694786Z INFO da_miner::watcher: Epoch number at building stage 49
2024-07-17T09:41:10.694845Z INFO server: DA sampling mine service started
2024-07-17T09:41:10.698023Z INFO da_miner::stage1: New epoch epoch=49
2024-07-17T09:41:10.698030Z INFO da_miner::line_metadata: New epoch context to fetch epoch=48
2024-07-17T09:41:10.698034Z INFO da_miner::stage1: Get new sample task task=SampleTask { hash: 0x910db06eaf5e438c41396f20f6097b9b7b4faf7f861710a9fff70bd7e0915ca4, height: 287610, quality: 441711766194596082395824375185729628956870974218904739530401550323154943 }
2024-07-17T09:41:10.698166Z INFO chain_state::signers_handler: try to register signer: account 0x596b2add5c699ac6a613b095c650a5c56f8f746f, pubkey g1 (6914847423637448936794734431470388528995731195599747578257214847858215685133, 11602285283891211058773588294715585131894267902591040094723519571098928625940), pubkey g2: (QuadExtField(1204380380243995618972839808142996103035665253128665383217252956367825322384 + 11077671150211890023623941482150985329943240080079848691284591478836302923495 * u), QuadExtField(1464894275111760754975857373436721668838278104480357096427665759821327506225 + 12223041631561381719659521685311570347652356099101305007174602573075449105146 * u)), socket: "12.34.678.110:34000"
2024-07-17T09:41:10.719173Z INFO chain_state::transactor: new transaction sent with hash 0xc1967f4b5830038de9a354c2035cfcf4b044b7b6fe0388f69aa11f31840f2ddd, tx_info: RegisterSigner(0x596b2add5c699ac6a613b095c650a5c56f8f746f)
2024-07-17T09:41:45.722084Z INFO chain_state::transactor: transaction 0xc1967f4b5830038de9a354c2035cfcf4b044b7b6fe0388f69aa11f31840f2ddd confirmed, status unknown.
2024-07-17T09:41:45.722099Z INFO chain_state::signers_handler: signer registered
2024-07-17T09:41:45.722163Z INFO server: starting grpc server at "0.0.0.0:34000"
2024-07-17T09:41:45.723751Z INFO chain_state::da_handler: checking da entrance logs from 287625 to 287630 block..
2024-07-17T09:41:45.725675Z INFO chain_state::signers_handler: registering for next epoch: 50
2024-07-17T09:41:45.726556Z INFO chain_state::signers_handler: try to register epoch: account 0x596b2add5c699ac6a613b095c650a5c56f8f746f, epoch: 50
2024-07-17T09:41:45.747271Z INFO chain_state::transactor: new transaction sent with hash 0x76945c983d07614ae870c41d8e11989377888274a1ae1644a9f880d03797c7d1, tx_info: RegisterEpoch(0x596b2add5c699ac6a613b095c650a5c56f8f746f, 50)
2024-07-17T09:41:46.064072Z INFO grpc: grpc server listening 0.0.0.0:34000
2024-07-17T09:41:50.731179Z INFO chain_state::da_handler: checking da entrance logs from 287631 to 287631 block..
# Delete node
Terminal window
sudo systemctl stop 0gda
sudo systemctl disable 0gda
sudo rm /etc/systemd/system/0gda.service
rm -rf $HOME/0g-da-node