🔌Installation
💻 Hardware Requirements
Components | Minimum Requirements |
---|---|
CPU | 4 |
RAM | 8+ GB |
STORAGE | 400 GB SSD |
1️⃣ Installation packeges and dependencies
sudo apt update && sudo apt upgrade -y
sudo apt install curl git wget htop tmux build-essential jq make lz4 gcc unzip -y
➡️ Go Installation
cd $HOME
VER="1.22.6"
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
➡️ Set Vars
You can replace 56 with anything you want. Please write 3 digits.
echo "export OG_PORT="56"" >> $HOME/.bash_profile
source $HOME/.bash_profile
2️⃣ Install node
wget https://zgchaind-test.s3.ap-east-1.amazonaws.com/0gchaind-linux-v0.3.0
chmod +x ./0gchaind-linux-v0.3.0
mkdir -p /root/.0gchain/cosmovisor/upgrades/v0.3.0/bin
sudo mv ./0gchaind-linux-v0.3.0 /root/.0gchain/cosmovisor/upgrades/v0.3.0/bin/0gchaind
wget https://github.com/0glabs/0g-chain/releases/download/v0.3.1.alpha.1/0gchaind-linux-v0.3.1.alpha.1
chmod +x ./0gchaind-linux-v0.3.1.alpha.1
mkdir -p /root/.0gchain/cosmovisor/upgrades/v0.3.1/bin
sudo mv ./0gchaind-linux-v0.3.1.alpha.1 /root/.0gchain/cosmovisor/upgrades/v0.3.1/bin/0gchaind
wget https://github.com/0glabs/0g-chain/releases/download/v0.4.0/0gchaind-linux-v0.4.0
chmod +x ./0gchaind-linux-v0.4.0
mkdir -p /root/.0gchain/cosmovisor/upgrades/v0.4.0/bin
sudo mv ./0gchaind-linux-v0.4.0 /root/.0gchain/cosmovisor/upgrades/v0.4.0/bin/0gchaind
sudo ln -sfn $HOME/.0gchain/cosmovisor/upgrades/v0.4.0 $HOME/.0gchain/cosmovisor/current
sudo ln -sfn $HOME/.0gchain/cosmovisor/current/bin/0gchaind /usr/local/bin/0gchaind
go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@v1.7.0
➡️ Create a service
sudo tee /etc/systemd/system/0gchaind.service > /dev/null << EOF
[Unit]
Description=0gchaind node service
After=network-online.target
[Service]
User=$USER
ExecStart=$(which cosmovisor) run start --log_output_console
Restart=on-failure
RestartSec=10
LimitNOFILE=65535
Environment="DAEMON_HOME=$HOME/.0gchain"
Environment="DAEMON_NAME=0gchaind"
Environment="UNSAFE_SKIP_BACKUP=true"
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:$HOME/.0gchain/cosmovisor/current/bin"
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable 0gchaind
➡️ Initialize the node
0gchaind config chain-id zgtendermint_16600-2
0gchaind config keyring-backend os
0gchaind config node tcp://localhost:${OG_PORT}657
0gchaind init MONIKER-NAME --chain-id zgtendermint_16600-2
➡️ Genesis
rm ~/.0gchain/config/genesis.json
curl -Ls https://github.com/0glabs/0g-chain/releases/download/v0.2.3/genesis.json > $HOME/.0gchain/config/genesis.json
➡️Addrbook
wget -O $HOME/.0gchain/config/addrbook.json "https://server-5.itrocket.net/testnet/og/addrbook.json"
➡️ Gas Settings
sed -i 's|minimum-gas-prices =.*|minimum-gas-prices = "0ua0gi"|g' $HOME/.0gchain/config/app.toml
➡️ Port
sed -i.bak -e "s%:1317%:${OG_PORT}317%g;
s%:8080%:${OG_PORT}080%g;
s%:9090%:${OG_PORT}090%g;
s%:9091%:${OG_PORT}091%g;
s%:8545%:${OG_PORT}545%g;
s%:8546%:${OG_PORT}546%g;
s%:6065%:${OG_PORT}065%g" $HOME/.0gchain/config/app.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
➡️ Peers and Seeds
SEEDS="8f21742ea5487da6e0697ba7d7b36961d3599567@og-testnet-seed.itrocket.net:47656"
PEERS="779acfc7fc7d45865c1f2652e8bd329e29f36b9f@49.13.125.108:26656,0ae19691f97f5797694c253bc06c79c8b58ea2a8@85.190.242.81:26656,78083fc2c1f98e849ff2969467b82ca154979cdd@128.140.38.222:26656,ffdf7a8cc6dbbd22e25b1590f61da149349bdc2e@135.181.229.206:26656,5e098c96e69e3e2a943b923eda791ba34543f792@116.202.210.96:26656,40aae18c8cbadbe3dd6ee21ff3843ac3e1daac23@5.189.191.104:26656,c0d35052a7612d992f721b25f186a5d1f569405e@195.201.194.188:26656,3a8a28c734a4d32052065d9f6006c14dfa7a4e4e@37.27.59.176:18456,7207c781cc31324f179bf2dbbd670fa79e119d3b@37.27.131.251:18456,0c2d883524434768b5df39c71749651acdd620c8@188.34.160.230:26656,681265e1b4aa06b62654cda78007951d30d24cc6@193.22.147.103:56656,ff8534292b54e69db55f1486adeca9dde9335137@95.216.143.132:26656,528fd49ac79811239695eb1c4c9eadc430bd2bf2@95.216.207.113:26656,4c7b139e9ec5671887ba66e0f5ff8c1192cf8f43@37.27.93.29:26656,b6a05c26f8d2d18e0e77b2e991845eb43115714c@144.76.30.120:34656,0cbf8674f7048247a34f7436585823063a893440@85.190.242.86:26656,bc32262de08f9129697c9b8a643804c83550a760@109.199.104.42:26656,f649fa05a3522bf8a1cd576fe50884b45b25b67e@37.60.240.206:26656,04d4b245bcad036489ea3e258ceb687f21d0009d@194.238.30.192:26656,a6e237dac24b1987d24f191bbcf95fc7dba120ff@176.9.63.6:16656"
sed -i -e "s/^seeds *=.*/seeds = \"$SEEDS\"/; s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.0gchain/config/config.toml
➡️ Pruning
sed -i -e "s/^pruning *=.*/pruning = \"custom\"/" $HOME/.0gchain/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"100\"/" $HOME/.0gchain/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"10\"/" $HOME/.0gchain/config/app.toml
sed -i -e "s/^indexer *=.*/indexer = \"null\"/" $HOME/.0gchain/config/config.toml
➡️ Snap
0gchaind tendermint unsafe-reset-all --home $HOME/.0gchain
if curl -s --head curl https://snapshots-testnet.unitynodes.com/0gchain-testnet/0gchain-testnet-latest.tar.lz4 | head -n 1 | grep "200" > /dev/null; then
curl https://snapshots-testnet.unitynodes.com/0gchain-testnet/0gchain-testnet-latest.tar.lz4 | lz4 -dc - | tar -xf - -C $HOME/.0gchain
else
echo no have snap
fi
➡️ Let's get started
sudo systemctl restart 0gchaind
journalctl -fu 0gchaind -o cat
➡️ Create wallet
0gchaind keys add wallet-name --eth
➡️ Import wallet
0gchaind keys add wallet-name --eth --recover
➡️ Import private key
0gchaind keys unsafe-export-eth-key wallet-name
➡️ Faucet
➡️ Create Validator
Reminder: You can't create a validator without Sync. You must have to catch the latest block.
cd $HOME
0gchaind tx staking create-validator \
--amount=1000000ua0gi \
--pubkey=$(0gchaind tendermint show-validator) \
--moniker=MONIKER-YAZ \
--chain-id=zgtendermint_16600-2 \
--commission-rate=0.05 \
--commission-max-rate=0.10 \
--commission-max-change-rate=0.01 \
--min-self-delegation=1 \
--from=wallet-name \
--identity="" \
--website="" \
--details="" \
--node=http://localhost:${OG_PORT}657 \
-y
➡️ Delegation
0gchaind tx staking delegate $(0gchaind keys show wallet-name --bech val -a) ammount000000ua0gi --from wallet-name --node=http://localhost:${OG_PORT}657 -y
➡️ Complete deletion
cd $HOME
sudo systemctl stop 0gchaind
sudo systemctl disable 0gchaind
sudo rm -rf /etc/systemd/system/0gchaind.service
sudo systemctl daemon-reload
sudo rm -f /usr/local/bin/0gchaind
sudo rm -f $(which 0gchaind)
sudo rm -rf $HOME/.0gchain
sed -i "/OG_PORT_/d" $HOME/.bash_profile
➡️ Block check
local_height=$(curl -s localhost:${OG_PORT}657/status | jq -r .result.sync_info.latest_block_height); network_height=$(curl -s https://0g-testnet-rpc.mictonode.com/status | jq -r .result.sync_info.latest_block_height); blocks_left=$((network_height - local_height)); echo "Your node height: $local_height"; echo "Network height: $network_height"; echo "Blocks left: $blocks_left"
Your node height - the current block of your node
Network height - the last block of the network
Blocks left - how many blocks your node has left to sync.
Last updated