2024-04-08 01:53:37 +00:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
# 检查是否以root用户运行脚本
|
|
|
|
|
if [ "$(id -u)" != "0" ]; then
|
|
|
|
|
echo "此脚本需要以root用户权限运行。"
|
|
|
|
|
echo "请尝试使用 'sudo -i' 命令切换到root用户,然后再次运行此脚本。"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# 检查并安装 Node.js 和 npm
|
|
|
|
|
function install_nodejs_and_npm() {
|
|
|
|
|
if command -v node > /dev/null 2>&1; then
|
|
|
|
|
echo "Node.js 已安装"
|
|
|
|
|
else
|
|
|
|
|
echo "Node.js 未安装,正在安装..."
|
|
|
|
|
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
|
|
|
|
|
sudo apt-get install -y nodejs
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if command -v npm > /dev/null 2>&1; then
|
|
|
|
|
echo "npm 已安装"
|
|
|
|
|
else
|
|
|
|
|
echo "npm 未安装,正在安装..."
|
|
|
|
|
sudo apt-get install -y npm
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# 检查并安装 PM2
|
|
|
|
|
function install_pm2() {
|
|
|
|
|
if command -v pm2 > /dev/null 2>&1; then
|
|
|
|
|
echo "PM2 已安装"
|
|
|
|
|
else
|
|
|
|
|
echo "PM2 未安装,正在安装..."
|
|
|
|
|
npm install pm2@latest -g
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-20 14:48:41 +00:00
|
|
|
|
# 检查Go环境
|
|
|
|
|
function check_go_installation() {
|
|
|
|
|
if command -v go > /dev/null 2>&1; then
|
|
|
|
|
echo "Go 环境已安装"
|
|
|
|
|
return 0
|
|
|
|
|
else
|
|
|
|
|
echo "Go 环境未安装,正在安装..."
|
|
|
|
|
return 1
|
|
|
|
|
fi
|
|
|
|
|
}
|
2024-04-08 01:53:37 +00:00
|
|
|
|
|
|
|
|
|
# 节点安装功能
|
|
|
|
|
function install_node() {
|
2024-04-25 02:33:46 +00:00
|
|
|
|
|
2024-04-08 01:53:37 +00:00
|
|
|
|
install_nodejs_and_npm
|
|
|
|
|
install_pm2
|
|
|
|
|
|
|
|
|
|
# 检查curl是否安装,如果没有则安装
|
|
|
|
|
if ! command -v curl > /dev/null; then
|
2024-04-09 01:18:51 +00:00
|
|
|
|
sudo apt update && sudo apt install curl git -y
|
2024-04-08 01:53:37 +00:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# 更新和安装必要的软件
|
|
|
|
|
sudo apt update && sudo apt upgrade -y
|
|
|
|
|
sudo apt install curl git wget htop tmux build-essential jq make lz4 gcc unzip liblz4-tool -y
|
|
|
|
|
|
2024-04-20 14:48:41 +00:00
|
|
|
|
# 安装 Go
|
|
|
|
|
if ! check_go_installation; then
|
|
|
|
|
sudo rm -rf /usr/local/go
|
|
|
|
|
curl -L https://go.dev/dl/go1.22.0.linux-amd64.tar.gz | sudo tar -xzf - -C /usr/local
|
|
|
|
|
echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin' >> $HOME/.bash_profile
|
|
|
|
|
source $HOME/.bash_profile
|
|
|
|
|
go version
|
|
|
|
|
fi
|
2024-04-08 01:53:37 +00:00
|
|
|
|
|
|
|
|
|
# 安装所有二进制文件
|
2024-05-08 03:53:50 +00:00
|
|
|
|
git clone -b v0.1.0 https://github.com/0glabs/0g-chain.git
|
|
|
|
|
cd 0g-chain
|
2024-04-08 01:53:37 +00:00
|
|
|
|
make install
|
|
|
|
|
|
2024-05-08 04:00:59 +00:00
|
|
|
|
# 配置0gchaind
|
2024-04-12 08:47:56 +00:00
|
|
|
|
export MONIKER="My_Node"
|
|
|
|
|
export WALLET_NAME="wallet"
|
|
|
|
|
|
2024-04-08 01:53:37 +00:00
|
|
|
|
# 获取初始文件和地址簿
|
|
|
|
|
cd $HOME
|
2024-05-08 03:53:50 +00:00
|
|
|
|
0gchaind init $MONIKER --chain-id zgtendermint_16600-1
|
|
|
|
|
0gchaind config chain-id zgtendermint_16600-1
|
2024-05-08 04:15:31 +00:00
|
|
|
|
0gchaind config node tcp://localhost:26657
|
2024-04-08 01:53:37 +00:00
|
|
|
|
|
|
|
|
|
|
2024-05-08 03:53:50 +00:00
|
|
|
|
# 配置节点
|
|
|
|
|
wget -O ~/.0gchain/config/genesis.json https://github.com/0glabs/0g-chain/releases/download/v0.1.0/genesis.json
|
|
|
|
|
0gchaind validate-genesis
|
2024-05-08 08:27:58 +00:00
|
|
|
|
wget https://smeby.fun/0gchaind-addrbook.json -O $HOME/.0gchain/config/addrbook.json
|
2024-05-08 03:53:50 +00:00
|
|
|
|
|
2024-05-08 04:05:46 +00:00
|
|
|
|
# 配置节点
|
2024-05-08 06:43:56 +00:00
|
|
|
|
SEEDS="c4d619f6088cb0b24b4ab43a0510bf9251ab5d7f@54.241.167.190:26656,44d11d4ba92a01b520923f51632d2450984d5886@54.176.175.48:26656,f2693dd86766b5bf8fd6ab87e2e970d564d20aff@54.193.250.204:26656,f878d40c538c8c23653a5b70f615f8dccec6fb9f@54.215.187.94:26656"
|
2024-05-08 09:18:33 +00:00
|
|
|
|
PEERS="a8d7c5a051c4649ba7e267c94e48a7c64a00f0eb@65.108.127.146:26656,8f463ad676c2ea97f88a1274cdcb9f155522fd49@209.126.8.121:26657,75a398f9e3a7d24c6b3ba4ab71bf30cd59faee5c@95.216.42.217:26656,5a202fb905f20f96d8ff0726f0c0756d17cf23d8@43.248.98.100:26656,9d88e34a436ec1b50155175bc6eba89e7a1f0e9a@213.199.61.18:26656,2b8ee12f4f94ebc337af94dbec07de6f029a24e6@94.16.31.161:26656,52e30a030ff6ded32e7a499de6246c574f57cc27@152.53.32.51:26656"
|
2024-05-08 07:26:08 +00:00
|
|
|
|
sed -i "s/persistent_peers = \"\"/persistent_peers = \"$PEERS\"/" $HOME/.0gchain/config/config.toml
|
2024-05-08 04:05:46 +00:00
|
|
|
|
sed -i "s/seeds = \"\"/seeds = \"$SEEDS\"/" $HOME/.0gchain/config/config.toml
|
|
|
|
|
|
2024-05-15 08:38:12 +00:00
|
|
|
|
配置端口
|
|
|
|
|
node_address="tcp://localhost:13457"
|
|
|
|
|
sed -i -e "s%^proxy_app = \"tcp://127.0.0.1:26658\"%proxy_app = \"tcp://127.0.0.1:13458\"%; s%^laddr = \"tcp://127.0.0.1:26657\"%laddr = \"tcp://127.0.0.1:13457\"%; s%^pprof_laddr = \"localhost:6060\"%pprof_laddr = \"localhost:13460\"%; s%^laddr = \"tcp://0.0.0.0:26656\"%laddr = \"tcp://0.0.0.0:13456\"%; s%^prometheus_listen_addr = \":26660\"%prometheus_listen_addr = \":13466\"%" $HOME/.0gchain/config/config.toml
|
|
|
|
|
sed -i -e "s%^address = \"tcp://localhost:1317\"%address = \"tcp://0.0.0.0:13417\"%; s%^address = \":8080\"%address = \":13480\"%; s%^address = \"localhost:9090\"%address = \"0.0.0.0:13490\"%; s%^address = \"localhost:9091\"%address = \"0.0.0.0:13491\"%; s%:8545%:13445%; s%:8546%:13446%; s%:6065%:13465%" $HOME/.0gchain/config/app.toml
|
|
|
|
|
echo "export OG_RPC_PORT=$node_address" >> $HOME/.bash_profile
|
|
|
|
|
source $HOME/.bash_profile
|
2024-04-08 01:53:37 +00:00
|
|
|
|
# 使用 PM2 启动节点进程
|
2024-05-08 03:53:50 +00:00
|
|
|
|
pm2 start 0gchaind -- start && pm2 save && pm2 startup
|
2024-05-08 08:19:08 +00:00
|
|
|
|
|
|
|
|
|
pm2 stop 0gchaind
|
2024-05-12 15:41:20 +00:00
|
|
|
|
SNAP_NAME=$(curl -s https://testnet.anatolianteam.com/0g/ | egrep -o ">zgtendermint_16600-1.*\.tar.lz4" | tr -d ">")
|
|
|
|
|
curl -L https://testnet.anatolianteam.com/0g/${SNAP_NAME} | tar -I lz4 -xf - -C $HOME/.0gchain
|
|
|
|
|
mv $HOME/.0gchain/priv_validator_state.json.backup $HOME/.0gchain/data/priv_validator_state.json
|
2024-04-08 02:26:03 +00:00
|
|
|
|
|
2024-05-08 08:19:08 +00:00
|
|
|
|
pm2 restart 0gchaind
|
2024-04-08 02:26:03 +00:00
|
|
|
|
|
2024-04-13 08:24:23 +00:00
|
|
|
|
echo '====================== 安装完成,请退出脚本后执行 source $HOME/.bash_profile 以加载环境变量==========================='
|
2024-04-08 01:53:37 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-08 01:57:00 +00:00
|
|
|
|
# 查看0gai 服务状态
|
2024-04-08 01:53:37 +00:00
|
|
|
|
function check_service_status() {
|
|
|
|
|
pm2 list
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-08 01:57:00 +00:00
|
|
|
|
# 0gai 节点日志查询
|
2024-04-08 01:53:37 +00:00
|
|
|
|
function view_logs() {
|
2024-05-08 04:00:59 +00:00
|
|
|
|
pm2 logs 0gchaind
|
2024-04-08 01:53:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# 卸载节点功能
|
|
|
|
|
function uninstall_node() {
|
2024-05-08 03:53:50 +00:00
|
|
|
|
echo "你确定要卸载0gchain 节点程序吗?这将会删除所有相关的数据。[Y/N]"
|
2024-04-08 01:53:37 +00:00
|
|
|
|
read -r -p "请确认: " response
|
|
|
|
|
|
|
|
|
|
case "$response" in
|
|
|
|
|
[yY][eE][sS]|[yY])
|
|
|
|
|
echo "开始卸载节点程序..."
|
2024-05-08 03:53:50 +00:00
|
|
|
|
pm2 stop 0gchaind && pm2 delete 0gchaind
|
|
|
|
|
rm -rf $HOME/.0gchain $HOME/0gchain $(which 0gchaind) && rm -rf 0g-chain
|
2024-04-08 01:53:37 +00:00
|
|
|
|
echo "节点程序卸载完成。"
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
echo "取消卸载操作。"
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# 创建钱包
|
|
|
|
|
function add_wallet() {
|
2024-04-12 07:48:24 +00:00
|
|
|
|
read -p "请输入你想设置的钱包名称: " wallet_name
|
2024-05-08 15:38:33 +00:00
|
|
|
|
0gchaind keys add $wallet_name --eth
|
2024-04-08 01:53:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# 导入钱包
|
|
|
|
|
function import_wallet() {
|
2024-04-12 07:48:24 +00:00
|
|
|
|
read -p "请输入你想设置的钱包名称: " wallet_name
|
2024-05-09 03:12:31 +00:00
|
|
|
|
0gchaind keys add $wallet_name --recover --eth
|
2024-04-08 01:53:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# 查询余额
|
|
|
|
|
function check_balances() {
|
|
|
|
|
read -p "请输入钱包地址: " wallet_address
|
2024-05-08 05:36:57 +00:00
|
|
|
|
0gchaind query bank balances "$wallet_address"
|
2024-04-08 01:53:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# 查看节点同步状态
|
|
|
|
|
function check_sync_status() {
|
2024-05-15 08:04:48 +00:00
|
|
|
|
0gchaind status | jq .sync_info
|
2024-04-08 01:53:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# 创建验证者
|
|
|
|
|
function add_validator() {
|
|
|
|
|
|
2024-04-08 04:01:37 +00:00
|
|
|
|
read -p "请输入您的钱包名称: " wallet_name
|
|
|
|
|
read -p "请输入您想设置的验证者的名字: " validator_name
|
|
|
|
|
read -p "请输入您的验证者详情(例如'吊毛资本'): " details
|
|
|
|
|
|
|
|
|
|
|
2024-05-08 04:00:59 +00:00
|
|
|
|
0gchaind tx staking create-validator \
|
2024-05-08 06:28:26 +00:00
|
|
|
|
--amount=1000000ua0gi \
|
2024-05-08 04:00:59 +00:00
|
|
|
|
--pubkey=$(0gchaind tendermint show-validator) \
|
2024-04-08 04:01:37 +00:00
|
|
|
|
--moniker=$validator_name \
|
2024-05-08 05:38:21 +00:00
|
|
|
|
--chain-id=zgtendermint_16600-1 \
|
2024-04-08 04:01:37 +00:00
|
|
|
|
--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="$details" \
|
2024-05-08 05:38:21 +00:00
|
|
|
|
--gas=auto \
|
|
|
|
|
--gas-adjustment=1.4
|
2024-04-08 01:53:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-04-08 07:10:22 +00:00
|
|
|
|
function install_storage_node() {
|
2024-04-08 01:53:37 +00:00
|
|
|
|
|
2024-04-08 07:10:22 +00:00
|
|
|
|
sudo apt-get update
|
2024-04-09 01:18:51 +00:00
|
|
|
|
sudo apt-get install clang cmake build-essential git screen cargo -y
|
2024-04-08 10:22:15 +00:00
|
|
|
|
|
2024-04-08 07:10:22 +00:00
|
|
|
|
|
|
|
|
|
# 安装Go
|
|
|
|
|
sudo rm -rf /usr/local/go
|
|
|
|
|
curl -L https://go.dev/dl/go1.22.0.linux-amd64.tar.gz | sudo tar -xzf - -C /usr/local
|
|
|
|
|
echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin' >> $HOME/.bash_profile
|
|
|
|
|
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
|
|
|
|
|
source $HOME/.bash_profile
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 克隆仓库
|
|
|
|
|
git clone https://github.com/0glabs/0g-storage-node.git
|
|
|
|
|
|
|
|
|
|
#进入对应目录构建
|
|
|
|
|
cd 0g-storage-node
|
|
|
|
|
git submodule update --init
|
|
|
|
|
|
|
|
|
|
# 构建代码
|
|
|
|
|
cargo build --release
|
|
|
|
|
|
|
|
|
|
#后台运行
|
|
|
|
|
cd run
|
2024-04-10 07:46:20 +00:00
|
|
|
|
|
|
|
|
|
|
2024-04-12 18:24:36 +00:00
|
|
|
|
read -p "请输入你想导入的EVM钱包私钥,不要有0x: " minerkey
|
|
|
|
|
|
2024-04-17 03:20:36 +00:00
|
|
|
|
sed -i "s/miner_id = \"\"/miner_id = \"$(openssl rand -hex 32)\"/" config.toml
|
2024-04-17 03:16:55 +00:00
|
|
|
|
sed -i "s/miner_key = \"\"/miner_key = \"$minerkey\"/" config.toml
|
2024-04-12 18:24:36 +00:00
|
|
|
|
|
2024-04-10 07:46:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-04-08 07:10:22 +00:00
|
|
|
|
screen -dmS zgs_node_session ../target/release/zgs_node --config config.toml
|
|
|
|
|
|
2024-04-08 07:15:52 +00:00
|
|
|
|
echo '====================== 安装完成 ==========================='
|
2024-04-08 07:17:56 +00:00
|
|
|
|
echo '===进入对应路径:/0g-storage-node/run/log,使用tail -f logs文件名,查看logs 即可========================'
|
2024-04-08 07:15:52 +00:00
|
|
|
|
|
2024-04-08 07:10:22 +00:00
|
|
|
|
}
|
2024-04-08 01:53:37 +00:00
|
|
|
|
|
2024-04-09 13:02:15 +00:00
|
|
|
|
|
|
|
|
|
function install_storage_kv() {
|
|
|
|
|
|
|
|
|
|
# 克隆仓库
|
|
|
|
|
git clone https://github.com/0glabs/0g-storage-kv.git
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#进入对应目录构建
|
|
|
|
|
cd 0g-storage-kv
|
|
|
|
|
git submodule update --init
|
|
|
|
|
|
|
|
|
|
# 构建代码
|
|
|
|
|
cargo build --release
|
|
|
|
|
|
|
|
|
|
#后台运行
|
|
|
|
|
cd run
|
|
|
|
|
|
2024-04-10 04:51:24 +00:00
|
|
|
|
echo "请输入RPC节点信息: "
|
2024-04-09 13:02:15 +00:00
|
|
|
|
read blockchain_rpc_endpoint
|
|
|
|
|
|
2024-04-10 04:51:24 +00:00
|
|
|
|
|
2024-04-09 13:02:15 +00:00
|
|
|
|
cat > config.toml <<EOF
|
|
|
|
|
stream_ids = ["000000000000000000000000000000000000000000000000000000000000f2bd", "000000000000000000000000000000000000000000000000000000000000f009", "00000000000000000000000000"]
|
|
|
|
|
|
|
|
|
|
db_dir = "db"
|
|
|
|
|
kv_db_dir = "kv.DB"
|
|
|
|
|
|
|
|
|
|
rpc_enabled = true
|
|
|
|
|
rpc_listen_address = "127.0.0.1:6789"
|
|
|
|
|
zgs_node_urls = "http://127.0.0.1:5678"
|
|
|
|
|
|
|
|
|
|
log_config_file = "log_config"
|
|
|
|
|
|
|
|
|
|
blockchain_rpc_endpoint = "$blockchain_rpc_endpoint"
|
|
|
|
|
log_contract_address = "0x22C1CaF8cbb671F220789184fda68BfD7eaA2eE1"
|
|
|
|
|
log_sync_start_block_number = 670000
|
|
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
echo "配置已成功写入 config.toml 文件"
|
|
|
|
|
screen -dmS storage_kv ../target/release/zgs_kv --config config.toml
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-09 07:41:24 +00:00
|
|
|
|
# 给自己地址验证者质押
|
|
|
|
|
function delegate_self_validator() {
|
2024-05-09 04:16:23 +00:00
|
|
|
|
read -p "请输入质押代币数量(单位为ua0gai,比如你有1000000个ua0gai,留点水给自己,输入900000回车就行): " math
|
2024-04-09 07:41:24 +00:00
|
|
|
|
read -p "请输入钱包名称: " wallet_name
|
2024-05-09 04:16:23 +00:00
|
|
|
|
0gchaind tx staking delegate $(0gchaind keys show $wallet_name --bech val -a) ${math}ua0gi --from $wallet_name --gas=auto --gas-adjustment=1.4 -y
|
2024-04-09 07:41:24 +00:00
|
|
|
|
|
2024-04-09 08:52:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-04-11 14:51:57 +00:00
|
|
|
|
# 查看存储节点同步状态
|
|
|
|
|
function check_storage_status() {
|
|
|
|
|
tail -f "$(find ~/0g-storage-node/run/log/ -type f -printf '%T+ %p\n' | sort -r | head -n 1 | cut -d' ' -f2-)"
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-14 09:18:56 +00:00
|
|
|
|
# 查看存储节点同步状态
|
|
|
|
|
function start_storage() {
|
|
|
|
|
cd 0g-storage-node/run && screen -dmS zgs_node_session ../target/release/zgs_node --config config.toml
|
2024-04-22 07:32:17 +00:00
|
|
|
|
echo '====================== 启动成功,请通过screen -r zgs_node_session 查询 ==========================='
|
|
|
|
|
|
2024-04-14 09:18:56 +00:00
|
|
|
|
}
|
2024-04-11 14:51:57 +00:00
|
|
|
|
|
2024-04-22 07:32:17 +00:00
|
|
|
|
# 转换ETH地址
|
2024-04-15 13:50:20 +00:00
|
|
|
|
function transfer_EIP() {
|
|
|
|
|
read -p "请输入你的钱包名称: " wallet_name
|
2024-05-08 05:52:03 +00:00
|
|
|
|
echo "0x$(0gchaind debug addr $(0gchaind keys show $wallet_name -a) | grep hex | awk '{print $3}')"
|
2024-04-15 13:50:20 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-08 06:40:51 +00:00
|
|
|
|
# 卸载节点功能
|
|
|
|
|
function uninstall_old_node() {
|
|
|
|
|
echo "你确定要卸载0g ai 节点程序吗?这将会删除所有相关的数据。[Y/N]"
|
|
|
|
|
read -r -p "请确认: " response
|
|
|
|
|
|
|
|
|
|
case "$response" in
|
|
|
|
|
[yY][eE][sS]|[yY])
|
|
|
|
|
echo "开始卸载节点程序..."
|
2024-05-16 05:03:45 +00:00
|
|
|
|
pm2 stop 0gchaind && pm2 delete 0gchaind
|
|
|
|
|
rm -rf $HOME/.0gchain $HOME/0gchain $(which 0gchaind) && rm -rf 0gchaind
|
2024-05-08 06:40:51 +00:00
|
|
|
|
echo "节点程序卸载完成。"
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
echo "取消卸载操作。"
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-16 05:03:45 +00:00
|
|
|
|
# 导出验证者key
|
|
|
|
|
function export_priv_validator_key() {
|
|
|
|
|
echo "====================请将下方所有内容备份到自己的记事本或者excel表格中记录==========================================="
|
|
|
|
|
cat ~/.0gchaind/config/priv_validator_key.json
|
|
|
|
|
|
|
|
|
|
}
|
2024-05-08 06:40:51 +00:00
|
|
|
|
|
2024-04-08 01:53:37 +00:00
|
|
|
|
# 主菜单
|
|
|
|
|
function main_menu() {
|
|
|
|
|
while true; do
|
|
|
|
|
clear
|
|
|
|
|
echo "脚本以及教程由推特用户大赌哥 @y95277777 编写,免费开源,请勿相信收费"
|
2024-04-22 02:36:53 +00:00
|
|
|
|
echo "=======================验证节点功能================================"
|
2024-04-08 01:53:37 +00:00
|
|
|
|
echo "节点社区 Telegram 群组:https://t.me/niuwuriji"
|
2024-04-13 08:25:37 +00:00
|
|
|
|
echo "节点社区 Discord 社群:https://discord.gg/GbMV5EcNWF"
|
2024-04-08 01:53:37 +00:00
|
|
|
|
echo "退出脚本,请按键盘ctrl c退出即可"
|
|
|
|
|
echo "请选择要执行的操作:"
|
|
|
|
|
echo "1. 安装节点"
|
|
|
|
|
echo "2. 创建钱包"
|
|
|
|
|
echo "3. 导入钱包"
|
|
|
|
|
echo "4. 查看钱包地址余额"
|
|
|
|
|
echo "5. 查看节点同步状态"
|
|
|
|
|
echo "6. 查看当前服务状态"
|
|
|
|
|
echo "7. 运行日志查询"
|
2024-04-10 02:58:15 +00:00
|
|
|
|
echo "9. 创建验证者"
|
2024-04-22 02:36:53 +00:00
|
|
|
|
echo "10. 给自己验证者地址质押代币"
|
|
|
|
|
echo "11. 转换ETH地址"
|
|
|
|
|
echo "=======================存储节点功能================================"
|
|
|
|
|
echo "12. 创建存储节点"
|
|
|
|
|
echo "13. 查看存储节点日志"
|
|
|
|
|
echo "14. 单独启动存储节点代码,适用于需要修改存储路径等功能修改过后使用"
|
2024-05-08 06:40:51 +00:00
|
|
|
|
echo "=======================卸载evmos测试网节点功能================================"
|
2024-05-16 05:06:26 +00:00
|
|
|
|
echo "8. 卸载0gchain验证者节点"
|
|
|
|
|
echo "15. 卸载旧evmos验证者节点"
|
|
|
|
|
echo "=======================备份功能================================"
|
|
|
|
|
echo "16. 备份验证者私钥"
|
2024-05-08 06:40:51 +00:00
|
|
|
|
read -p "请输入选项(1-15): " OPTION
|
2024-04-08 01:53:37 +00:00
|
|
|
|
|
|
|
|
|
case $OPTION in
|
|
|
|
|
1) install_node ;;
|
|
|
|
|
2) add_wallet ;;
|
|
|
|
|
3) import_wallet ;;
|
|
|
|
|
4) check_balances ;;
|
|
|
|
|
5) check_sync_status ;;
|
|
|
|
|
6) check_service_status ;;
|
|
|
|
|
7) view_logs ;;
|
|
|
|
|
8) uninstall_node ;;
|
2024-04-10 02:58:15 +00:00
|
|
|
|
9) add_validator ;;
|
2024-04-22 02:36:53 +00:00
|
|
|
|
10) delegate_self_validator ;;
|
|
|
|
|
11) transfer_EIP ;;
|
|
|
|
|
12) install_storage_node ;;
|
|
|
|
|
13) check_storage_status ;;
|
|
|
|
|
14) start_storage ;;
|
2024-05-08 06:40:51 +00:00
|
|
|
|
15) uninstall_old_node ;;
|
2024-05-16 05:06:26 +00:00
|
|
|
|
16) export_priv_validator_key ;;
|
2024-04-22 02:36:53 +00:00
|
|
|
|
|
2024-04-08 01:53:37 +00:00
|
|
|
|
*) echo "无效选项。" ;;
|
|
|
|
|
esac
|
|
|
|
|
echo "按任意键返回主菜单..."
|
|
|
|
|
read -n 1
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# 显示主菜单
|
|
|
|
|
main_menu
|