0chain validator ( vietnamese )
1. Tải và giải nén galileo-v1.2.1
bashSao chépChỉnh sửacd $HOME
rm -rf galileo
wget "https://0g.j-node.net/testnet/galileo-v1.2.1.zip"
unzip galileo-v1.2.1.zip
mv galileo-v1.2.1 galileo2. Phân quyền chạy cho các file nhị phân
bashSao chépChỉnh sửasudo chmod 777 $HOME/galileo/bin/geth
sudo chmod 777 $HOME/galileo/bin/0gchaind3. Chỉ copy binary 0gchaind vào thư mục Go bin để tiện gọi
0gchaind vào thư mục Go bin để tiện gọibashSao chépChỉnh sửamkdir -p $HOME/go/bin
cp $HOME/galileo/bin/0gchaind $HOME/go/bin/0gchaindLưu ý: Không copy geth để tránh ghi đè node Story.
4. Nạp lại cấu hình shell và kiểm tra phiên bản
bashSao chépChỉnh sửasource $HOME/.bash_profile
geth version # kiểm tra geth hiện tại đang dùng (Story)
0gchaind version # kiểm tra 0gchaind đã copy5. Khai báo biến môi trường cho node galileo
bashSao chépChỉnh sửaecho "export WALLET='YOUR_WALLET_NAME'" >> $HOME/.bash_profile
echo "export MONIKER='YOUR_NODE_NAME'" >> $HOME/.bash_profile
echo "export OG_PORT='11'" >> $HOME/.bash_profile
source $HOME/.bash_profileThay YOUR_WALLET_NAME và YOUR_NODE_NAME bằng giá trị thực.
6. Chuẩn bị thư mục dữ liệu cho node
bashSao chépChỉnh sửamkdir -p $HOME/.0gchaind
cp -r $HOME/galileo/0g-home $HOME/.0gchaind7. Khởi tạo Geth cho galileo node (lưu ý chạy geth bằng đường dẫn tuyệt đối)
bashSao chépChỉnh sửa$HOME/galileo/bin/geth init --datadir $HOME/.0gchaind/0g-home/geth-home $HOME/galileo/genesis.json8. Khởi tạo 0gchaind, copy file config và validator key
bashSao chépChỉnh sửa0gchaind init "$MONIKER" --home $HOME/.0gchaind/tmp
cp $HOME/.0gchaind/tmp/data/priv_validator_state.json $HOME/.0gchaind/0g-home/0gchaind-home/data/
cp $HOME/.0gchaind/tmp/config/node_key.json $HOME/.0gchaind/0g-home/0gchaind-home/config/
cp $HOME/.0gchaind/tmp/config/priv_validator_key.json $HOME/.0gchaind/0g-home/0gchaind-home/config/
rm -rf $HOME/.0gchaind/tmp9. Cấu hình node (moniker, chain-id, keyring-backend, app, pruning, indexer)
bashSao chépChỉnh sửased -i -e "s/^moniker *=.*/moniker = \"$MONIKER\"/" $HOME/.0gchaind/0g-home/0gchaind-home/config/config.toml
sed -i -e "s|^chain-id *=.*|chain-id = \"0gchain-16601\"|" $HOME/.0gchaind/0g-home/0gchaind-home/config/client.toml
sed -i -e "s|^keyring-backend *=.*|keyring-backend = \"os\"|" $HOME/.0gchaind/0g-home/0gchaind-home/config/client.toml
sed -i 's/beacon-kit/chaincfg/g' $HOME/.0gchaind/0g-home/0gchaind-home/config/app.toml
sed -i 's/minimum-gas-prices = ".*"/minimum-gas-prices = "0.00252ua0gi"/' $HOME/.0gchaind/0g-home/0gchaind-home/config/app.toml
sed -i \
-e 's|^pruning *=.*|pruning = "custom"|' \
-e 's|^pruning-keep-recent *=.*|pruning-keep-recent = "100"|' \
-e 's|^pruning-keep-every *=.*|pruning-keep-every = "0"|' \
-e 's|^pruning-interval *=.*|pruning-interval = "50"|' \
$HOME/.0gchaind/0g-home/0gchaind-home/config/app.toml
sed -i -e "s/^indexer *=.*/indexer = \"null\"/" $HOME/.0gchaind/0g-home/0gchaind-home/config/config.toml10. Cấu hình port geth (theo biến OG_PORT) — chỉnh config geth trong galileo
bashSao chépChỉnh sửased -i "s/HTTPPort = .*/HTTPPort = ${OG_PORT}545/" $HOME/galileo/geth-config.toml
sed -i "s/WSPort = .*/WSPort = ${OG_PORT}546/" $HOME/galileo/geth-config.toml
sed -i "s/AuthPort = .*/AuthPort = ${OG_PORT}551/" $HOME/galileo/geth-config.toml
sed -i "s/ListenAddr = .*/ListenAddr = \":${OG_PORT}303\"/" $HOME/galileo/geth-config.toml
sed -i "s/^# *Port = .*/# Port = ${OG_PORT}901/" $HOME/galileo/geth-config.toml
sed -i "s/^# *InfluxDBEndpoint = .*/# InfluxDBEndpoint = \"http:\/\/localhost:${OG_PORT}086\"/" $HOME/galileo/geth-config.toml11. Cấu hình port cho 0gchain
bashSao chépChỉnh sửased -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%:26660%:${OG_PORT}660%g" $HOME/.0gchaind/0g-home/0gchaind-home/config/config.toml
sed -i.bak -e "s%:26657%:${OG_PORT}657%g" $HOME/.0gchaind/0g-home/0gchaind-home/config/client.toml12. Thiết lập peers cho node
bashSao chépChỉnh sửaPEERS="[email protected]:47656,[email protected]:26656,[email protected]:26656,[email protected]:14656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:47656,[email protected]:12656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,c442324089Last updated