Stride中继链间查询(任务9)教程

Stride是Cosmos 生态的多链流动质押协议,其近期宣布完成了由投资者North Island VC、Distributed Global 和Pantera Capital 共同牵头的670 万美元种子轮融资。

目前Stride有一个激励性测试网正在进行。该激励性测试网包含面向开发者,验证人和用户的任务。以下为任务列表。

其中任务9为relay interchain queries using the new v2 go relayer

使用go relayer v2中继链间查询

前提条件:服务器上已经安装好stride和gaia节点,并同步到最新区块,已经运行go relayer v2。(可参考 任务8教程

下载并编译二进制文件

cd 
git clone https://github.com/Stride-Labs/interchain-queries.git
cd interchain-queries
go build
sudo mv interchain-queries /usr/local/bin/icq

设置变量(根据你自己的情况)

STRIDE_RPC_ADDR='127.0.0.1:26657'    # 填你的Stride RPC
STRIDE_GRPC_ADDR='127.0.0.1:9090'    # 填你的Stride GRPC
GAIA_RPC_ADDR='127.0.0.1:23657'      # 填你的Gaia RPC
GAIA_GRPC_ADDR='127.0.0.1:23090'      # 填你的Gaia GRPC

设置配置文件

cd && mkdir .icq
sudo tee $HOME/.icq/config.yaml > /dev/null <<EOF
default_chain: stride-testnet
chains:
  gaia-testnet:
    key: wallet
    chain-id: GAIA
    rpc-addr: http://${GAIA_RPC_ADDR}
    grpc-addr: http://${GAIA_GRPC_ADDR}
    account-prefix: cosmos
    keyring-backend: test
    gas-adjustment: 1.2
    gas-prices: 0.000uatom
    key-directory: $HOME/.icq/keys
    debug: false
    timeout: 20s
    block-timeout: ""
    output-format: json
    sign-mode: direct
  stride-testnet:
    key: wallet
    chain-id: STRIDE-TESTNET-4
    rpc-addr: http://${STRIDE_RPC_ADDR}     
    grpc-addr: http://${STRIDE_GRPC_ADDR}     
    account-prefix: stride
    keyring-backend: test
    gas-adjustment: 1.2
    gas-prices: 0.000ustrd
    key-directory: $HOME/.icq/keys
    debug: false
    timeout: 20s
    block-timeout: ""
    output-format: json
    sign-mode: direct
cl: {}
EOF

导入钱包

注意: 请务必使用与relayer任务相同的钱包。只有这种方法才能证明是你本人在中继链间查询。

icq keys restore --chain stride-testnet wallet
icq keys restore --chain gaia-testnet wallet

建立系统服务

sudo tee /etc/systemd/system/icqd.service > /dev/null <<EOF
[Unit]
Description=Interchain Query Service
After=network-online.target

[Service]
User=$USER
ExecStart=$(which icq) run --debug
Restart=on-failure
RestartSec=3
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target
EOF

开启服务,运行链间中继

sudo systemctl daemon-reload
sudo systemctl enable icqd
sudo systemctl restart icqd

查看icq日志

journalctl -u icqd -f -o cat

等待5到15分钟后(也可能几小时),你将看到如下日志。这说明你中继链间查询成功了。

Requerying lightblock
ICQ RELAYER | query.Height= 0
ICQ RELAYER | res.Height= 73007
Send batch of 4 messages
1 ClientUpdate message
1 SubmitResponse message
1 ClientUpdate message
1 SubmitResponse message
Sent batch of 2 (deduplicated) messages

之后,你可以在区块浏览器查询你的地址。在Transactions处找到SubmitQueryResponse的交易。例如

Submit Query Response示例
Submit Query Response示例

记录该交易的浏览器链接,例如我的:https://stride.explorers.guru/transaction/D14C3C397E82FF75B74D4C9CFDF1A34224E6BF9D04B0C459729B410329F4F0AB

接下来,github fork https://github.com/Stride-Labs/interchain-queries

在你fork的库中新建config.yaml。内容复制$HOME/.icq/config.yaml的内容。

例如。

default_chain: stride-testnet
chains:
  gaia-testnet:
    key: wallet
    chain-id: GAIA
    rpc-addr: http://127.0.0.1:23657
    grpc-addr: http://127.0.0.1:23090
    account-prefix: cosmos
    keyring-backend: test
    gas-adjustment: 1.2
    gas-prices: 0.000uatom
    key-directory: /home/gorelayer/.icq/keys
    debug: false
    timeout: 20s
    block-timeout: ""
    output-format: json
    sign-mode: direct
  stride-testnet:
    key: wallet
    chain-id: STRIDE-TESTNET-4
    rpc-addr: http://127.0.0.1:26657
    grpc-addr: http://127.0.0.1:9090
    account-prefix: stride
    keyring-backend: test
    gas-adjustment: 1.2
    gas-prices: 0.000ustrd
    key-directory: /home/gorelayer/.icq/keys
    debug: false
    timeout: 20s
    block-timeout: ""
    output-format: json
    sign-mode: direct
cl: {}

之后,填写任务提交表

Include your evidence of completing the task. See the task table for instructions on what evidence to submit. 处填写你刚刚记录的交易的浏览器链接和你刚刚fork的你的github仓库链接。

欢迎关注 https://silentvalidator.com

Subscribe to Silent ⚛| validator
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.