Quasar测试网节点

Quasar是Cosmos生态的去中心化资管平台,两轮融资了1150万美元。其公共测试网刚刚开放。测试网可以交互,并运行节点。

运行两天正常,可多个项目同跑,资源占用并不大。

进入DC接水,!faucet QSR 钱包地址,代码已自动保存该信息,cat qianbao.txt
DC:https://discord.gg/quasarfi
区块浏览器 :https://testnet.ping.pub/quasar
以下为自动部署脚本代码:

#!/bin/bash
name=$(cat /dev/urandom | tr -dc 'a-zA-Z' | fold -w 3 | head -n 1)$(cat /dev/urandom | tr -dc 'a-zA-Z' | fold -w $(($RANDOM % 5 + 8)) | head -n 1)
echo "安装go"
if ! command -v go > /dev/null; then
  apt-get update
  wget https://go.dev/dl/go1.20.1.linux-amd64.tar.gz
  rm -rf /usr/local/go && tar -C /usr/local -xzf go1.20.1.linux-amd64.tar.gz
  export PATH=$PATH:/usr/local/go/bin
  go version
fi
cat <<'EOF' >>$HOME/.profile
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export GO111MODULE=on
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
EOF
source $HOME/.profile
echo "安装必要环境"
programs=("git" "build-essential" "jq" "wget" "curl")
for program in "${programs[@]}"; do
  if ! command -v "$program" > /dev/null; then
    apt-get update
    apt-get install -y "$program"
  fi
done
echo "安装quasarnoded"
cd $HOME
wget https://github.com/quasar-finance/binary-release/raw/main/v0.0.2-alpha-11/quasarnoded-linux-amd64
chmod +x quasarnoded-linux-amd64
mkdir -p $HOME/go/bin
mv quasarnoded-linux-amd64 $HOME/go/bin/quasarnoded
echo "验证"
quasarnoded version
echo "初始节点"
moniker=$name
quasarnoded init $moniker --chain-id=qsr-questnet-04 --home $HOME/.quasarnode
quasarnoded config chain-id qsr-questnet-04

echo "下载Genesis 文件"
wget -O $HOME/.quasarnode/config/genesis.json https://raw.githubusercontent.com/quasar-finance/questnet/main/v04/definitive-genesis.json

echo "设置peer和seed"
PEERS="8a19aa6e874ed5720aad2e7d02567ec932d92d22@141.94.248.63:26656,444b80ce750976df59b88ac2e08d720e1dbbf230@68.183.75.239:26666,20b4f9207cdc9d0310399f848f057621f7251846@222.106.187.13:40606,7ef67269c8ec37ff8a538a5ae83ca670fd2da686@137.184.192.123:26656,19afe579cc0a2b38ca87143f779f45e9a7f18a2f@18.134.191.148:26656,a23f002bda10cb90fa441a9f2435802b35164441@38.146.3.203:18256,bba6e85e3d1f1d9c127324e71a982ddd86af9a99@88.99.3.158:18256,966acc999443bae0857604a9fce426b5e09a7409@65.108.105.48:18256 ,177144bed1e280a6f2435d253441e3e4f1699c6d@65.109.85.226:8090,769ebaa9942375e70cebc21a75a2cfda41049d99@135.181.210.186:26656,8937bdacf1f0c8b2d1ffb4606554eaf08bd55df4@5.75.255.107:26656,99a0695a7358fa520e6fcd46f91492f7cf205d4d@34.175.159.249:26656,47401f4ac3f934afad079ddbe4733e66b58b67da@34.175.244.202:26656"
seeds="7ed8e233e5fdb21bf70ac7f635130c7a8b0a4967@quasar-testnet-seed.swiss-staking.ch:10056"
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.quasarnode/config/config.toml
sed -i.bak -e "s/^seeds *=.*/seeds = \"$seeds\"/" ~/.quasarnode/config/config.toml

echo "Pruning设置"
pruning="custom" && \
pruning_keep_recent="100" && \
pruning_keep_every="0" && \
pruning_interval="10" && \
sed -i -e "s/^pruning *=.*/pruning = \"$pruning\"/" $HOME/.quasarnode/config/app.toml && \
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"$pruning_keep_recent\"/" $HOME/.quasarnode/config/app.toml && \
sed -i -e "s/^pruning-keep-every *=.*/pruning-keep-every = \"$pruning_keep_every\"/" $HOME/.quasarnode/config/app.toml && \
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"$pruning_interval\"/" $HOME/.quasarnode/config/app.toml

echo "创建节点服务"
tee <<EOF >/dev/null /etc/systemd/system/quasarnoded.service
[Unit]
Description=quasarnoded daemon
After=network-online.target
[Service]
User=$USER
ExecStart=$(which quasarnoded) start --home $HOME/.quasarnode
Restart=on-failure
RestartSec=3
LimitNOFILE=10000
[Install]
WantedBy=multi-user.target
EOF

 systemctl daemon-reload && \
 systemctl enable quasarnoded && \
 systemctl start quasarnoded

echo "查看日志"
#自动部署时需要注释掉
journalctl -u quasarnoded -f

echo "Snapshot同步"
cd $HOME
apt install snap -y
snap install lz4
systemctl stop quasarnoded
cp $HOME/.quasarnode/data/priv_validator_state.json $HOME/.quasarnode/priv_validator_state.json.backup
#这里有个坑,需要每次去查询最新的快照,会变。下载速度堪忧,执行下载到自己资源服务器,
wget -O quasar.tar.lz4 https://snapshot.silentvalidator.com/testnet/quasar/quasar-2023-02-18T09%3A11.tar.lz4 --inet4-only
quasarnoded tendermint unsafe-reset-all --home $HOME/.quasarnode --keep-addr-book
lz4 -c -d quasar.tar.lz4 | tar -x -C $HOME/.quasarnode
mv $HOME/.quasarnode/priv_validator_state.json.backup $HOME/.quasarnode/data/priv_validator_state.json
systemctl restart quasarnoded
#自动部署时需要注释掉
journalctl -u quasarnoded -f -o cat

echo "检查同步状态"
curl -s localhost:26657/status | jq .result | jq .sync_info

echo "创建钱包"
expect <<- DONE >> add.txt
    spawn quasarnoded keys add dannywiki
    expect "Enter keyring passphrase:"
    send "88888888\r"
    expect "Re-enter keyring passphrase:"
    send "88888888\r"
    sleep 15
    interact
DONE
expect <<- DONE >> qianbao.txt
    spawn quasarnoded keys list
    expect "Enter keyring passphrase:"
    send "88888888\r"
    sleep 15
    interact
DONE

address=$(awk '/address:/ {print $2}' qianbao.txt)
echo "检查日志:sudo journalctl -u quasarnoded -f"

echo "运行/重启节点:sudo systemctl restart quasarnoded"

echo "停止节点:sudo systemctl stop quasarnoded"

echo "同步信息:quasarnoded status 2>&1 | jq .SyncInfo"

echo "验证人信息:quasarnoded status 2>&1 | jq .ValidatorInfo"

echo "节点信息:quasarnoded status 2>&1 | jq .NodeInfo"

echo "获取节点id:quasarnoded tendermint show-node-id"

echo "显示所有钱包:quasarnoded keys list"

echo "恢复钱包:quasarnoded keys add $name --recover"

echo "删除钱包:quasarnoded keys delete $name"

echo "查询余额:quasarnoded query bank balances $name"

echo "发送代币:quasarnoded tx bank send $name <quasar> 数量uqsr --from $name --chain-id qsr-questnet-04 -y"

echo "投票:quasarnoded tx gov vote <提案编号> <投票选项> --from $name --chain-id qsr-questnet-04 -y"

echo "质押:quasarnoded tx staking delegate <你要质押的验证人地址> 数量uqsr --from $name -y"

echo "quasarnoded debug addr $name"

echo "解除质押:quasarnoded tx staking unbond <你要解除质押的验证人地址> 数量uqsr --from $name -y"

echo "提取质押奖励和验证人佣金:quasarnoded tx distribution withdraw-rewards <你的验证人地址> --commission --from $name -y"

echo "提取所有奖励:quasarnoded tx distribution withdraw-all-rewards --from=$name -y"

echo "修改验证人信息"

quasarnoded tx staking edit-validator \
--moniker=<节点名> \
--identity=<你的keybase id> \
--website="<你的网站>" \
--details="<你的验证人描述>" \
--from=<你的钱包名>

钱包配置

添加新钱包

quasard keys add $WALLET

恢复钱包

quasard keys add $WALLET --recover

钱包清单

quasard keys list

查看余额

quasard query bank balances $(quasard keys show wallet -a)

删除钱包

quasard keys delete $WALLET

验证器配置

创建验证器

quasard tx staking create-validator \
    --amount=500000000000$DENOM \
    --pubkey=$(dymd tendermint show-validator) \
    --moniker="$NODENAME" \
    --chain-id=$CHAIN \
    --from=$WALLET \
    --commission-rate="0.10" \
    --commission-max-rate="0.20" \
    --commission-max-change-rate="0.01" \
    --min-self-delegation="1"

检查验证者地址

quasard keys show wallet --bech val -a

编辑验证器

quasard tx staking edit-validator \
  --moniker=$NODENAME \
  --identity=<your_keybase_id> \
  --website="<your_website>" \
  --details="<your_validator_description>" \
  --chain-id=$CHAIN \
  --from=$WALLET

委托给验证者

quasard tx staking delegate $(dymd tendermint show-validator) 1000000uqsr --from $WALLET --chain-id qsr-questnet-04 --fees 5000uqsr

解狱验证器

quasard tx slashing unjail \
  --broadcast-mode=block \
  --from=$WALLET \
  --chain-id=qsr-questnet-04 \
  --gas=auto --gas-adjustment 1.4

有用的命令

  1. 同步信息

quasard status 2>&1 | jq .SyncInfo

  1. 验证者信息

quasard status 2>&1 | jq .ValidatorInfo

  1. 节点信息

quasard status 2>&1 | jq .NodeInfo

  1. 显示节点 ID

quasard tendermint show-node-id

  1. 删除节点
systemctl stop quasard
systemctl disable quasard
rm -rvf .quasarnode
rm -rvf quasar.sh
rm -rvf quasar
rm -rf ${which quasard}

《Quasar测试网节点》有1条评论

评论已关闭。