ARCHWAY

安装教程

image-1679896503835

Archway 是基于 Cosmos 生态系的智能合约平台,平台旨在使开发人员能够启动创新项目并围绕他们建立强大的社区。

借助 Archway,开发者可以将智能合约无缝部署到 Cosmos,然后这些合约由开发者社区拥有、运营和管理。

Archway 与其他智能合约平台的区别之一是其以开发人员为中心的经济。与许多其他仅专注于奖励验证者的平台不同,Archway 还向开发人员分发奖励。

image-1679896618514

据公开资料显示,Archway 在种子轮融资中筹集了 2100 万美元,由 Hashed 和 CoinFund 共同领投。

现在我们可以参与 constantine-1 测试网,为后期领取用户奖励做好准备。

由于 Archway 生态还处于非常早期,我能参与的板块非常有限,如果想成为项目早期用户,除了发布Dapp外,我们可以成为他的节点,为生态做贡献。

运行一个节点: CPU:2vCore,内存:2GB,SDD:20GB,操作系统:Ubuntu 20.04

运行验证者: CPU:8/16 vCore,内存:32GB,SDD:80GB,操作系统:Ubuntu 20.04

[crypto-connect label=”Connect to Login” class=”fl-button fl-is-info fl-is-light”]

[crypto-block]

更新和安装包

sudo apt update && sudo apt upgrade -y && \
sudo apt install curl tar wget clang pkg-config libssl-dev libleveldb-dev jq build-essential bsdmainutils git make ncdu htop screen unzip bc fail2ban htop -y

安装 Go

cd $HOME && \
ver="1.19.4" && \
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" >> $HOME/.bash_profile && \
source $HOME/.bash_profile && \
go version
 

设置变量

echo "export MONIKER=$MONIKER" >> $HOME/.bash_profile && \
echo "export WALLET=$WALLET" >> $HOME/.bash_profile && \
echo "export WEBSITE=$WEBSITE" >> $HOME/.bash_profile && \
echo "export IDENTITY=$IDENTITY" >> $HOME/.bash_profile && \
echo "export DETAILS=$DETAILS" >> $HOME/.bash_profile && \
echo "export SECURITY_CONTACT=$SECURITY_CONTACT" >> $HOME/.bash_profile && \
source $HOME/.bash_profile

构建文件

git clone https://github.com/archway-network/archway.git archway && \
cd archway && \
git checkout v0.2.0 && \
make install
archwayd version --long | grep -e version -e commit
# version: 0.2.0
# commit: 532f53724bf477c5c8826fae376906526a09ed2d

配置

archwayd init $MONIKER --chain-id constantine-1 && \
archwayd config chain-id constantine-1 && \
archwayd config keyring-backend os

添加新钱包或恢复旧钱包

archwayd keys add $WALLET
archwayd keys add $WALLET

设置变量

VALOPER=$(archwayd keys show $WALLET --bech val -a) # ENTER PASSWORD
ADDRESS=$(archwayd keys show $WALLET --address) # ENTER PASSWORD
echo  "export VALOPER= $VALOPER " >> $HOME /.bash_profile && \ 
echo  "export ADDRESS= $ADDRESS " >> $HOME /.bash_profile && \ 
source  $HOME /.bash_profile

添加同行和种子

sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"5c10d3d84adb970474eff3c9b5d8fe50fd2dbbfb@144.76.18.199:26656,802993601906fae95a19e96f2e8bd538b0d209d5@35.222.155.3:26656,1570fd9b344af3bf77ec7eefffe485033f412080@65.109.112.178:26656,a2ad516c5301fb1a9793b0c9bd2195e16721ed73@34.170.18.34 :26656\"/; s/^seeds *=.*/seeds = \"$SEEDS\"/" $HOME/.archway/config/config.toml

下载创世区块

wget -O $HOME /.archway/config/genesis.json https://raw.githubusercontent.com/archway-network/networks/main/constantine-1/genesis.json
 

更改端口

sed -i.bak -e "\ 
s% ^proxy_app = \"tcp://127.0.0.1:26658\"%proxy_app = \"tcp://127.0.0.1:$((NODES_NUM+ 26 ))658\" %; \ 
s%^laddr = \"tcp://127.0.0.1:26657\"%laddr = \"tcp://0.0.0.0:$((NODES_NUM+ 26 ))657\"%; \ 
s%^ pprof_laddr = \"localhost:6060\"%pprof_laddr = \"localhost:$((NODES_NUM+ 6 ))060\"%; \ 
s%^laddr = \"tcp://0.0.0.0:26656\"%laddr = \"tcp://0.0.0.0:$((NODES_NUM+ 26 ))656\"%; \ 
s%^external_address = \"\"%external_address = \"` echo $(wget -qO- eth0.me): $((NODES_NUM+ 26 ))656`\"%; \ 
s%^prometheus_listen_addr = \":26660\"%prometheus_listen_addr = \":$((NODES_NUM+ 26 ))660\"%" $HOME /.archway/config/config.toml
sed -i.bak -e "\ 
s% ^address = \"tcp://0.0.0.0:1317\"%address = \"tcp://0.0.0.0:$((NODES_NUM+ 1 ))317\" %; \ 
s%^address = \":8080\"%address = \":$((NODES_NUM+ 8 ))080\"%; \ 
s%^address = \"0.0.0.0:9090\"%address = \"0.0.0.0:$((NODES_NUM+ 9 ))090\"%; \ 
s%^address = \"0.0.0.0:9091\"%address = \"0.0.0.0:$((NODES_NUM+ 9 ))091 \"% " $HOME /.archway/config/app.toml
echo "export NODE=http://localhost:$((NODES_NUM+26))657" >> $HOME/.bash_profile && \
source $HOME/.bash_profile && \
archwayd config node $NODE

更改变量 # 首选当前变量

indexer = "null" && \ 
min_retain_blocks = 1 && \ 
snapshot_interval = "100" && \ 
pruning = "custom" && \ 
pruning_keep_recent = "100" && \ 
pruning_keep_every = "0" && \ 
pruning_interval = "10" && \ 
min_retain_blocks = " 1" && \ 
inter_block_cache = "false"

设置变量

sed -i.bak -e "s/^indexer *=.*/indexer = \" $indexer \"/"  $HOME /.archway/config/config.toml && \ 
sed -i.bak -e "s/ ^min-retain-blocks *=.*/min-retain-blocks = \" $min_retain_blocks \"/"  $HOME /.archway/config/app.toml && \ 
sed -i.bak -e "s/^snapshot -interval *=.*/snapshot-interval = \" $snapshot_interval \"/"  $HOME /.archway/config/app.toml && \ 
sed -i.bak -e "s/^pruning *=.*/pruning = \" $pruning \"/"  $HOME /.archway/config/app.toml && \ 
sed -i.bak -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"$pruning_keep_recent \"/"  $HOME /.archway/config/app.toml && \
sed -i.bak -e "s/^pruning-keep-every *=.*/pruning-keep-every = \" $pruning_keep_every \"/"  $HOME /.archway/config/app.toml && \
sed -i.bak -e "s/^pruning-interval *=.*/pruning-interval = \" $pruning_interval \"/"  $HOME /.archway/config/app.toml && \
sed -i.bak -e "s/^min-retain-blocks *=.*/min-retain-blocks = \" $min_retain_blocks \"/"  $HOME /. archway/config/app.toml && \
sed -i.bak -e "s/^inter-block-cache *=.*/inter-block-cache = \" $inter_block_cache \"/"  $HOME/.archway/config/app.toml

改变变量

RPC = http://rpc-archway.testnet-pride.com: 40657

设置变量

LATEST_HEIGHT=$(curl -s $SNAP_RPC /block | jq -r .result.block.header.height); \ 
BLOCK_HEIGHT=$((LATEST_HEIGHT - 100 )); \ 
TRUST_HASH=$(curl -s " $SNAP_RPC /block?height= $BLOCK_HEIGHT " | jq -r .result.block_id.hash) 
echo $LATEST_HEIGHT $BLOCK_HEIGHT $TRUST_HASH

sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ; \
s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$SNAP_RPC,$SNAP_RPC\"| ; \
s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$BLOCK_HEIGHT| ; \
s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"| ; \
s|^(seeds[[:space:]]+=[[:space:]]+).*$|\1\"\"|" $HOME/.archway/config/config.toml

启动节点

创建服务

sudo tee /etc/systemd/system/archwayd.service > /dev/null <<EOF 
[Unit] 
Description=Archway Node 
After=network.target 
[Service]
User=$USER
Type=simple
ExecStart=$(which archwayd) start
Restart=on-failure
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target
EOF

开启服务

sudo systemctl daemon-reload && \
sudo systemctl enable archwayd && \
sudo systemctl restart archwayd && \
sudo journalctl -u archwayd -f -o cat

创建一个验证器

检查你的节点的同步 # 如果结果为FALSE,则节点已同步

curl -s $NODE/status | jq .result.sync_info.catching_up

检查余额 # 创建验证器的最小数量 1000000

archwayd q bank balances $ADDRESS

创建验证器

archwayd tx staking create-validator \
  --amount=1000000uconst \
  --pubkey=$(archwayd tendermint show-validator) \
  --moniker=$MONIKER \
  --chain-id=jackal-1 \
  --commission-rate="0.10" \
  --commission-max-rate="0.20" \
  --commission-max-change-rate="0.01" \
  --min-self-delegation=1000000 \
  --fees=200uconst \
  --from=$WALLET \
  --identity=$IDENTITY \
  --website=$WEBSITE \
  --details=$DETAILS \
  --security-contact=$SECURITY_CONTACT \
  -y

更新节点

更改变量 # 例如 v.1.2.1

TAG_NAME = ""

更新节点

sudo systemctl stop archwayd && \ 
cd archway && \ 
git pull; \ 
git checkout tags/ $TAG_NAME && \ 
make clean; \ 
make install && \ 
sudo systemctl restart archwayd && \ 
journalctl -u archwayd -f -o cat

常用命令

(一)节点状态

服务日志

journalctl -u archwayd -f -o cat

服务状态

systemctl status archwayd

检查节点状态

curl -s $NODE/status

检查节点同步 # 如果结果为FALSE,则节点已同步

curl -s $NODE/status | jq .result.sync_info.catching_up

检查共识

curl -s $NODE/consensus_state  | jq '.result.round_state.height_vote_set[0].prevotes_bit_array'

链接PEERS

curl -s $NODE/net_info | jq -r '.result.peers[] | "\(.node_info.id)@\(.remote_ip):\(.node_info.listen_addr | split(":")[2])"' | wc -l
(二)验证者信息

获取验证者地址

echo $VALOPER

获取钱包地址

echo $ADDRESS

JAIL,TOMBSTONED,START_HEIGHT,INDEX_OFFSET

archwayd q slashing signing-info $(archwayd tendermint show-validator)

得到PEER

echo "$(archwayd tendermint show-node-id)@$(curl ifconfig.me):$(curl -s $NODE/status | jq -r '.result.node_info.listen_addr' | cut -d':' -f3)"
(三)钱包

取得BALANCE

archwayd q bank balances $ADDRESS
表决

投票

archwayd tx gov vote <PROPOSAL_ID> <yes|no> --from $WALLET --fees 200uconst -y

检查所有投票的提案

archwayd q gov proposals --voter $ADDRESS
Actions

编辑验证器

archwayd tx staking edit-validator --website= "<YOUR_WEBSITE>" --details= "<YOUR_DESCRIPTION>" --moniker= "<YOUR_NEW_MONIKER>" -- from =$WALLET --fees 200u const

UNJAIL

archwayd tx slashing unjail --from $WALLET --fees 200uconst

绑定更多代币(如果你想增加你的验证人股份,你应该为你的验证人地址提供更多的担保。):

archwayd tx staking delegate $VALOPER <TOKENS_COUNT>uconst--from $WALLET --fees 200uconst -y

取消委托

archwayd tx staking unbond $VALOPER <TOKENS_COUNT>uconst -- from  $WALLET --fees 200 uconst -y

发送代币,1 代币 = 1000000 (COSMOS)

archwayd tx bank send $WALLET <WALLET_TO> <TOKENS_COUNT>uconst --fees 200uconst --gas auto

改变PEERS和 SEEDS

peers = "<PEERS>"
 seeds = "<SEEDS>"
 sed - i.bak - e "s/^persistent_peers *=.*/persistent_peers = \" $peers \" /; s/^seeds *=.*/ seeds = \" $seeds \" /"  $HOME / .archway / config / config.toml

将私有验证器文件重置为创世状态并删除 ADDRBOOK.JSON

archwayd tendermint unsafe-reset-all --home $HOME/.archway
所有验证者信息

所有活跃验证者列表

archwayd q staking validators -o json --limit=1000 \
| jq '.validators[] | select(.status=="BOND_STATUS_BONDED")' \
| jq -r '.tokens + " - " + .description.moniker' \
| sort -gr | nl

所有不活跃的验证者列表

archwayd q staking validators -o json --limit=1000 \
| jq '.validators[] | select(.status=="BOND_STATUS_UNBONDED")' \
| jq -r '.tokens + " - " + .description.moniker' \
| sort -gr | nl
有用的命令

ROOT → 你的节点

su -l $USER_NAME

检查互联网连接

curl -sL yabs.sh | bash -s -- -fg

服务器负载

sudo htop

文件结构

ncdu
删除节点

使用命令

sudo systemctl stop archwayd && \
sudo systemctl disable archwayd; \
sudo rm /etc/systemd/system/archwayd.service; \
sudo systemctl daemon-reload && \
cd $HOME && \
rm -rf .archway archway; \
sudo rm $(which archwayd)

[/crypto-block]