For more detailed information, visit the 0G DA documentation
- rpc : https://rpc.0g.posthuman.digital
- grpc: https://grpc.0g.posthuman.digital
- rest-api: https://rest-api.0g.posthuman.digital
- json-rpc : https://json-rpc.0g.posthuman.digital
- storage-node: https://storage-node.0g.posthuman.digital
- storage-kv: https://storage-kv.0g.posthuman.digital
- da-node: https://da-node.0g.posthuman.digital
- da-client: https://da-client.0g.posthuman.digital
guide's current binaries version: v0.2.3
current chain : zgtendermint_16600-2
sudo apt update && \
sudo apt install curl git jq build-essential gcc unzip wget lz4 openssl -y
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
EDIT YOUR MONIKER
echo "export WALLET="wallet"" >> $HOME/.bash_profile
echo "export MONIKER="<your-moniker>"" >> $HOME/.bash_profile
echo "export OG_CHAIN_ID="zgtendermint_16600-2"" >> $HOME/.bash_profile
echo "export OG_PORT="26"" >> $HOME/.bash_profile
source $HOME/.bash_profile
git clone -b v0.2.3 https://github.com/0glabs/0g-chain.git
cd 0g-chain
make install
0gchaind version
cd $HOME
0gchaind init $MONIKER --chain-id $OG_CHAIN_ID
0gchaind config chain-id $OG_CHAIN_ID
0gchaind config node tcp://localhost:${OG_PORT}657
0gchaind config keyring-backend os
wget https://github.com/0glabs/0g-chain/releases/download/v0.2.3/genesis.json -O $HOME/.0gchain/config/genesis.json
SEEDS="81987895a11f6689ada254c6b57932ab7ed909b6@54.241.167.190:26656,010fb4de28667725a4fef26cdc7f9452cc34b16d@54.176.175.48:26656,e9b4bc203197b62cc7e6a80a64742e752f4210d5@54.193.250.204:26656,68b9145889e7576b652ca68d985826abd46ad660@18.166.164.232:26656" && \
sed -i.bak -e "s/^seeds *=.*/seeds = \"${SEEDS}\"/" $HOME/.0gchain/config/config.toml
8. Add peers to the config.toml (i recommend using seeds only, but it's up to you whether to add peers) (currently no peers)
peers=""
sed -i -e "s|^persistent_peers *=.*|persistent_peers = \"$peers\"|" $HOME/.0gchain/config/config.toml
sed -i.bak -e "s%:26658%:${OG_PORT}658%g;
s%:26657%:${OG_PORT}657%g;
s%:6060%:${OG_PORT}060%g;
s%:26656%:${OG_PORT}656%g;
s%^external_address = \"\"%external_address = \"$(wget -qO- eth0.me):${OG_PORT}656\"%;
s%:26660%:${OG_PORT}660%g" $HOME/.0gchain/config/config.toml
sed -i \
-e "s/^pruning *=.*/pruning = \"custom\"/" \
-e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"100\"/" \
-e "s/^pruning-interval *=.*/pruning-interval = \"10\"/" \
"$HOME/.0gchain/config/app.toml"
sed -i \
-e 's/address = "127.0.0.1:8545"/address = "0.0.0.0:8545"/' \
-e 's|^api = ".*"|api = "eth,txpool,personal,net,debug,web3"|' \
$HOME/.0gchain/config/app.toml
sed -i "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0ua0gi\"/" $HOME/.0gchain/config/app.toml
sed -i -e "s/prometheus = false/prometheus = true/" $HOME/.0gchain/config/config.toml
sed -i -e "s/^indexer *=.*/indexer = \"null\"/" $HOME/.0gchain/config/config.toml
sudo tee /etc/systemd/system/0gchaind.service > /dev/null <<EOF
[Unit]
Description=0G Node
After=network.target
[Service]
User=$USER
Type=simple
ExecStart=$(which 0gchaind) start --home $HOME/.0gchain --log_output_console
Restart=on-failure
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload && \
sudo systemctl enable 0gchaind && \
sudo systemctl restart 0gchaind && sudo journalctl -u 0gchaind -fn 100 -o cat
0gchaind keys add $WALLET --eth
query the 0x address
echo "0x$(0gchaind debug addr $(0gchaind keys show $WALLET -a) | grep hex | awk '{print $3}')"
THEN U MUST REQUEST THE TEST TOKEN FROM THE FAUCET BY ENTERING YOUR 0X ADDRESS
OR YOU CAN IMPORT YOUR EXISTING WALLET
0gchaind keys add $WALLET --recover --keyring-backend os --eth
0gchaind status | jq .sync_info
make sure your node block height has been synced with the latest block height. or you can check the catching_up
value must be false
0gchaind q bank balances $(0gchaind keys show $WALLET -a)
EDIT YOUR IDENTITY, WEBSITE URL, YOUR MAIL AND YOUR DETAILS. BUT THOSE ARE OPTIONAL
0gchaind tx staking create-validator \
--amount=1000000ua0gi \
--pubkey=$(0gchaind tendermint show-validator) \
--moniker=$MONIKER \
--chain-id=$OG_CHAIN_ID \
--commission-rate=0.10 \
--commission-max-rate=0.20 \
--commission-max-change-rate=0.01 \
--min-self-delegation=1 \
--from=$WALLET \
--identity=<your-identity> \
--website=<your-website-url> \
--security-contact=<your-mail> \
--details="let's buidl 0g together" \
--gas=auto --gas-adjustment=1.4 \
-y
1uaogi = (10)^(-6)AOGI = 0.000001AOGI
nano /$HOME/.0gchain/config/priv_validator_key.json
nano /$HOME/.0gchain/data/priv_validator_state.json
copy all of the contents of the !and files and save them in a safe place. This is a vital step in case you need to migrate your validator node
sudo systemctl stop 0gchaind
sudo systemctl disable 0gchaind
sudo rm -rf /etc/systemd/system/0gchaind.service
sudo rm -r 0g-chain
sudo rm -rf $HOME/.0gchain
sed -i "/OG_/d" $HOME/.bash_profile
cd $HOME
rm -rf $HOME/0g-chain
git clone -b <0G node version> https://github.com/0glabs/0g-chain.git
make install
source .profile
0gchaind version
# Restart the node
sudo systemctl restart 0gchaind && sudo journalctl -u 0gchaind -fn 100 -o cat
please check the latest node version!
guide's current binaries version: v0.3.4
sudo apt-get update
sudo apt-get install clang cmake build-essential
sudo apt install libssl-dev
sudo apt install pkg-config
sudo apt-get install protobuf-compiler
sudo apt-get install clang
sudo apt-get install 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
PLEASE INPUT YOUR OWN JSON-RPC ENDPOINT (VALIDATOR_NODE_IP:8545) OR YOU CAN OUR ENDPOINTS PLEASE CHECK POSTHUMAN's endpoints
read -p "Enter json-rpc: " BLOCKCHAIN_RPC_ENDPOINT && echo "Current json-rpc: $BLOCKCHAIN_RPC_ENDPOINT"
ENR_ADDRESS=$(wget -qO- eth0.me)
echo "export ENR_ADDRESS=${ENR_ADDRESS}" >> ~/.bash_profile
echo 'export ZGS_LOG_DIR="$HOME/0g-storage-node/run/log"' >> ~/.bash_profile
echo 'export ZGS_LOG_SYNC_BLOCK="802"' >> ~/.bash_profile
echo 'export LOG_CONTRACT_ADDRESS="0x8873cc79c5b3b5666535C825205C9a128B1D75F1"' >> ~/.bash_profile
echo 'export MINE_CONTRACT="0x85F6722319538A805ED5733c5F4882d96F1C7384"' >> ~/.bash_profile
echo "export BLOCKCHAIN_RPC_ENDPOINT=\"$BLOCKCHAIN_RPC_ENDPOINT\"" >> ~/.bash_profile
source ~/.bash_profile
echo -e "\n\033[31mCHECK YOUR STORAGE NODE VARIABLES\033[0m\n\nLOG_CONTRACT_ADDRESS: $LOG_CONTRACT_ADDRESS\nMINE_CONTRACT: $MINE_CONTRACT\nZGS_LOG_SYNC_BLOCK: $ZGS_LOG_SYNC_BLOCK\nBLOCKCHAIN_RPC_ENDPOINT: $BLOCKCHAIN_RPC_ENDPOINT\n\n" "\033[3m\"lets buidl together\" - Grand Valley\033[0m"
ALSO CHECK THE JSON-RPC SYNC, MAKE SURE IT'S IN THE LATEST BLOCK
curl -s -X POST $BLOCKCHAIN_RPC_ENDPOINT -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' | jq -r '.result' | xargs printf "%d\n"
cd $HOME
git clone https://github.com/0glabs/0g-storage-node.git
cd $HOME/0g-storage-node
git stash
git fetch --all --tags
git tag -d v0.3.4
git checkout 5b6a4c716174b4af1635bfe903cd4f82894e0533
git submodule update --init
sudo apt install cargo
then build it
cargo build --release
obtain yout wallet's private key by using this command in your validator node :
0gchaind keys unsafe-export-eth-key $WALLET
store your private key in variable:
read -sp "Enter your private key: " PRIVATE_KEY && echo
sed -i '
s|^\s*#\s*miner_key\s*=.*|miner_key = "'"$PRIVATE_KEY"'"|
s|^\s*#\?\s*network_dir\s*=.*|network_dir = "network"|
s|^\s*#\s*network_enr_address\s*=.*|network_enr_address = "'"$ENR_ADDRESS"'"|
s|^\s*#\?\s*network_enr_tcp_port\s*=.*|network_enr_tcp_port = 1234|
s|^\s*#\?\s*network_enr_udp_port\s*=.*|network_enr_udp_port = 1234|
s|^\s*#\?\s*network_libp2p_port\s*=.*|network_libp2p_port = 1234|
s|^\s*#\?\s*network_discovery_port\s*=.*|network_discovery_port = 1234|
s|^\s*#\s*rpc_listen_address\s*=.*|rpc_listen_address = "0.0.0.0:5678"|
s|^\s*#\?\s*rpc_enabled\s*=.*|rpc_enabled = true|
s|^\s*#\?\s*db_dir\s*=.*|db_dir = "db"|
s|^\s*#\?\s*log_config_file\s*=.*|log_config_file = "log_config"|
s|^\s*#\?\s*log_directory\s*=.*|log_directory = "log"|
s|^\s*#\?\s*network_boot_nodes\s*=.*|network_boot_nodes = \["/ip4/54.219.26.22/udp/1234/p2p/16Uiu2HAmTVDGNhkHD98zDnJxQWu3i1FL1aFYeh9wiQTNu4pDCgps","/ip4/52.52.127.117/udp/1234/p2p/16Uiu2HAkzRjxK2gorngB1Xq84qDrT4hSVznYDHj6BkbaE4SGx9oS","/ip4/18.167.69.68/udp/1234/p2p/16Uiu2HAm2k6ua2mGgvZ8rTMV8GhpW71aVzkQWy7D37TTDuLCpgmX"]|
s|^\s*#\?\s*log_contract_address\s*=.*|log_contract_address = "'"$LOG_CONTRACT_ADDRESS"'"|
s|^\s*#\?\s*mine_contract_address\s*=.*|mine_contract_address = "'"$MINE_CONTRACT"'"|
s|^\s*#\?\s*log_sync_start_block_number\s*=.*|log_sync_start_block_number = '"$ZGS_LOG_SYNC_BLOCK"'|
s|^\s*#\?\s*blockchain_rpc_endpoint\s*=.*|blockchain_rpc_endpoint = "'"$BLOCKCHAIN_RPC_ENDPOINT"'"|
' $HOME/0g-storage-node/run/config-testnet.toml
echo "info,hyper=warn,h2=warn" > $HOME/0g-storage-node/run/log_config
sudo tee /etc/systemd/system/zgs.service > /dev/null <<EOF
[Unit]
Description=ZGS Node
After=network.target
[Service]
User=$USER
WorkingDirectory=$HOME/0g-storage-node/run
ExecStart=$HOME/0g-storage-node/target/release/zgs_node --config $HOME/0g-storage-node/run/config-testnet.toml
Restart=on-failure
RestartSec=10
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload && \
sudo systemctl enable zgs && \
sudo systemctl start zgs && \
sudo systemctl status zgs
- check the logs file
ls -lt $ZGS_LOG_DIR
- full logs command
tail -f ~/0g-storage-node/run/log/zgs.log.$(TZ=UTC date +%Y-%m-%d)
- tx_seq-only logs command
tail -f ~/0g-storage-node/run/log/zgs.log.$(TZ=UTC date +%Y-%m-%d) | grep tx_seq:
MAKE SURE YOUR LOGS HAS THE INCREASING TX_SEQ VALUE
WAIT UNTIL IT SYNCED TO THE LATEST TX_SEQ NUMBER ON THE OG STORAGE SCAN
- minimized-logs command
tail -f ~/0g-storage-node/run/log/zgs.log.$(TZ=UTC date +%Y-%m-%d) | grep -v "discv5\|network\|connect\|16U\|nounce"
- check your storage node through rpc
curl -X POST http://localhost:5678 -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"zgs_getStatus","params":[],"id":1}' | jq
sudo systemctl stop zgs
sudo systemctl disable zgs
sudo rm /etc/systemd/system/zgs.service
sudo rm -rf $HOME/0g-storage-node
sudo systemctl stop zgs
sudo systemctl disable zgs
sudo rm /etc/systemd/system/zgs.service
rm -rf $HOME/0g-storage-node
sudo apt-get update
sudo apt-get install clang cmake build-essential
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
PLEASE INPUT YOUR STORAGE NODE URL (http://STORAGE_NODE_IP:5678,http://STORAGE_NODE_IP:5679) , YOUR JSON RPC ENDPOINT (VALIDATOR_NODE_IP:8545) OR YOU CAN USE OUR ENDPOINTS PLEASE CHECK POSTHUMAN's endpoints
read -p "Enter json-rpc: " BLOCKCHAIN_RPC_ENDPOINT && echo "Current json-rpc: $BLOCKCHAIN_RPC_ENDPOINT" &&
read -p "Enter storage node urls: " ZGS_NODE && echo "Current storage node urls: $ZGS_NODE" &&
echo 'export ZGS_LOG_SYNC_BLOCK="802"' >> ~/.bash_profile
echo "export ZGS_NODE=\"$ZGS_NODE\"" >> ~/.bash_profile
echo 'export LOG_CONTRACT_ADDRESS="0x8873cc79c5b3b5666535C825205C9a128B1D75F1"' >> ~/.bash_profile
echo 'export MINE_CONTRACT="0x85F6722319538A805ED5733c5F4882d96F1C7384"' >> ~/.bash_profile
echo "export BLOCKCHAIN_RPC_ENDPOINT=\"$BLOCKCHAIN_RPC_ENDPOINT\"" >> ~/.bash_profile
source ~/.bash_profile
echo -e "\n\033[31mCHECK YOUR STORAGE KV VARIABLES\033[0m\n\nZGS_NODE: $ZGS_NODE\nLOG_CONTRACT_ADDRESS: $LOG_CONTRACT_ADDRESS\nMINE_CONTRACT: $MINE_CONTRACT\nZGS_LOG_SYNC_BLOCK: $ZGS_LOG_SYNC_BLOCK\nBLOCKCHAIN_RPC_ENDPOINT: $BLOCKCHAIN_RPC_ENDPOINT\n\n" "\033[3m\"lets buidl together\" - Grand Valley\033[0m"
cd $HOME
git clone https://github.com/0glabs/0g-storage-kv.git
cd $HOME/0g-storage-kv
git fetch
git checkout tags/v1.1.0-testnet
git submodule update --init
sudo apt install cargo
then build it
cargo build --release
cp /$HOME/0g-storage-kv/run/config_example.toml /$HOME/0g-storage-kv/run/config.toml
sed -i '
s|^\s*#\?\s*rpc_enabled\s*=.*|rpc_enabled = true|
s|^\s*#\?\s*rpc_listen_address\s*=.*|rpc_listen_address = "0.0.0.0:6789"|
s|^\s*#\?\s*db_dir\s*=.*|db_dir = "db"|
s|^\s*#\?\s*kv_db_dir\s*=.*|kv_db_dir = "kv.DB"|
s|^\s*#\?\s*log_config_file\s*=.*|log_config_file = "log_config"|
s|^\s*#\?\s*log_contract_address\s*=.*|log_contract_address = "'"$LOG_CONTRACT_ADDRESS"'"|
s|^\s*#\?\s*zgs_node_urls\s*=.*|zgs_node_urls = "'"$ZGS_NODE"'"|
s|^\s*#\?\s*mine_contract_address\s*=.*|mine_contract_address = "'"$MINE_CONTRACT"'"|
s|^\s*#\?\s*log_sync_start_block_number\s*=.*|log_sync_start_block_number = '"$ZGS_LOG_SYNC_BLOCK"'|
s|^\s*#\?\s*blockchain_rpc_endpoint\s*=.*|blockchain_rpc_endpoint = "'"$BLOCKCHAIN_RPC_ENDPOINT"'"|
' $HOME/0g-storage-kv/run/config.toml
sudo tee /etc/systemd/system/zgskv.service > /dev/null <<EOF
[Unit]
Description=ZGS KV
After=network.target
[Service]
User=$USER
WorkingDirectory=$HOME/0g-storage-kv/run
ExecStart=$HOME/0g-storage-kv/target/release/zgs_kv --config $HOME/0g-storage-kv/run/config.toml
Restart=on-failure
RestartSec=10
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload && \
sudo systemctl enable zgskv && \
sudo systemctl start zgskv && \
sudo systemctl status zgskv
sudo journalctl -u zgskv -fn 100 -o cat
MAKE SURE YOUR LOGS HAS THE SYNCED TX_SEQ(tx sequence) VALUE, CHECK STORAGE SCAN
sudo systemctl stop zgskv
sudo systemctl disable zgskv
sudo rm -rf /etc/systemd/system/zgskv.service
sudo rm -rf 0g-storage-kv
Node Type | CPU | RAM | Storage |
---|---|---|---|
Full | 8v CPU | 16 GB | 1 TB NVME SSD |
sudo apt update && sudo apt upgrade -y
sudo apt install curl git wget htop tmux build-essential jq make lz4 gcc unzip -y
sudo apt install libssl-dev
sudo apt install pkg-config
git clone https://github.com/0glabs/0g-da-node.git
cd 0g-da-node
cargo build --release
cd dev_support
./download_params.sh
sudo cp -R /root/0g-da-node/dev_support/params /root/0g-da-node/target/release
cd && cd 0g-da-node
cargo run --bin key-gen
mv /root/0g-da-node/config_example.toml /root/0g-da-node/config.toml
sudo nano /root/0g-da-node/config.toml
# grpc_listen_address = "0.0.0.0:34000"
# eth_rpc_endpoint = "https://evm-rpc.0gchain-testnet.unitynodes.com"
# socket_address = "your-server-ip:34000"
# da_entrance_address = "0xDFC8B84e3C98e8b550c7FEF00BCB2d8742d80a69"
# start_block_number = 802
# signer_bls_private_key = "YOUR BLS KEY"
# signer_eth_private_key = "YOUR PRIVATE KEY VALIDATOR"
wget https://snapshots.posthuman.digital/0gchain-testnet/addrbook.json -O $HOME/.0gchain/config/addrbook.json
wget https:///snapshots.posthuman.digital/0gchain-testnet/genesis.json -O $HOME/.0gchain/config/genesis.json
sudo tee /etc/systemd/system/da.service > /dev/null <<EOF
[Unit]
Description=DA Node
After=network.target
[Service]
User=root
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
sudo systemctl daemon-reload
sudo systemctl enable da
sudo systemctl start da
sudo systemctl status da
sudo journalctl -u da -f -o cat
🛠️ Hardware Requirements
Node Type | CPU | RAM | Storage |
---|---|---|---|
Full | 2v CPU | 8GB+ | 1 TB NVME SSD |
Installation packeges and dependencies
sudo apt update && sudo apt upgrade -y
sudo apt-get install screen
Install node
cd
git clone https://github.com/0glabs/0g-da-client.git
cd 0g-da-client
make build
## --chain.private-key YOUR_PRIVAT_KEY_VALIDATOR
## --encoder-socket IP_SERVER_DA_NODE:34000
cd disperser
screen
./bin/combined \
--chain.rpc https://evm-rpc.0gchain-testnet.unitynodes.com \
--chain.private-key YOUR_PRIVAT_KEY_VALIDATOR \
--chain.receipt-wait-rounds 180 \
--chain.receipt-wait-interval 1s \
--chain.gas-limit 2000000 \
--combined-server.use-memory-db \
--combined-server.storage.kv-db-path ./root/0g-storage-kv/run \
--combined-server.storage.time-to-expire 300 \
--disperser-server.grpc-port 51001 \
--batcher.da-entrance-contract 0xDFC8B84e3C98e8b550c7FEF00BCB2d8742d80a69 \
--batcher.da-signers-contract 0x0000000000000000000000000000000000001000 \
--batcher.finalizer-interval 20s \
--batcher.confirmer-num 3 \
--batcher.max-num-retries-for-sign 3 \
--batcher.finalized-block-count 50 \
--batcher.batch-size-limit 500 \
--batcher.encoding-interval 3s \
--batcher.encoding-request-queue-size 1 \
--batcher.pull-interval 10s \
--batcher.signing-interval 3s \
--batcher.signed-pull-interval 20s \
--encoder-socket IP_SERVER_DA_NODE:34000 \
--encoding-timeout 600s \
--signing-timeout 600s \
--chain-read-timeout 12s \
--chain-write-timeout 13s \
--combined-server.log.level-file trace \
--combined-server.log.level-std trace
screen -r DAClient