sudo apt-get updatesudo apt-get install clang cmake build-essential pkg-config libssl-dev protobuf-compiler llvm llvm-dev
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
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
git clone https://github.com/0glabs/0g-da-node.gitcd 0g-da-nodegit fetch --all --taggit checkout v1.1.3git submodule update --initcargo build --release
./dev_support/download_params.sh
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:
cargo run --bin key-gen
nano $HOME/0g-da-node/config.toml
Sample:
log_level = "info" data_path = "./db/" # path to downloaded params folderencoder_params_dir = "params/" # grpc server listen addressgrpc_listen_address = "0.0.0.0:34000"# chain eth rpc endpointeth_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 dnssocket_address = "VPS_Public_IP:34000" # data availability contract to interact withda_entrance_address = "0x857C0A28A8634614BB2C96039Cf4a20AFF709Aa9"# deployed block number of da entrance contractstart_block_number = 940000 # signer BLS private keysigner_bls_private_key = ""# signer eth account private keysigner_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 samplingenable_das = "true"
sudo tee /etc/systemd/system/0gda.service > /dev/null <<EOF[Unit]Description=0G-DA NodeAfter=network.target [Service]User=rootEnvironment="RUST_BACKTRACE=full"Environment="RUST_LOG=debug"WorkingDirectory=/root/0g-da-nodeExecStart=/root/0g-da-node/target/release/server --config /root/0g-da-node/config.tomlRestart=alwaysRestartSec=10LimitNOFILE=65535 [Install]WantedBy=multi-user.targetEOF
sudo systemctl daemon-reload && \sudo systemctl enable 0gda && \sudo systemctl start 0gda && \sudo systemctl status 0gda
sudo journalctl -u 0gda -f -o cat
Result:
Started 0G-DA Node.2024-07-17T09:41:10.694786Z INFO da_miner::watcher: Epoch number at building stage 492024-07-17T09:41:10.694845Z INFO server: DA sampling mine service started2024-07-17T09:41:10.698023Z INFO da_miner::stage1: New epoch epoch=492024-07-17T09:41:10.698030Z INFO da_miner::line_metadata: New epoch context to fetch epoch=482024-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 registered2024-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: 502024-07-17T09:41:45.726556Z INFO chain_state::signers_handler: try to register epoch: account 0x596b2add5c699ac6a613b095c650a5c56f8f746f, epoch: 502024-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:340002024-07-17T09:41:50.731179Z INFO chain_state::da_handler: checking da entrance logs from 287631 to 287631 block..
sudo systemctl stop 0gdasudo systemctl disable 0gdasudo rm /etc/systemd/system/0gda.servicerm -rf $HOME/0g-da-node