November 26, 2022

Установка hermes Neutron , запуск validator_test !!!

Ретранслятор IBC - это автономный процесс, ответственный за ретрансляцию дейтаграмм IBC между любыми двумя цепочками. Способ, которым это делается, заключается в сканировании состояний цепочки, построении транзакций на основе этих состояний и отправке транзакций в цепочки, участвующие в сети.

переходим по ссылке и загружаем артифакт на свой сервер

https://github.com/neutron-org/neutron-contracts/blob/neutron_audit_oak_19_09_2022_fixes/artifacts/neutron_validators_test.wasm

загружаем и запускаем контракт

wget https://raw.githubusercontent.com/neutron-org/neutron-contracts/neutron_audit_oak_19_09_2022_fixes/validator_test_upload_contract.sh
chmod +x validator_test_upload_contract.sh
./validator_test_upload_contract.sh
./validator_test_upload_contract.sh /root/neutron_validators_test.wasm

пополняем баланс и сохраняем адрес контракта

устанавливаем hermes

curl -L "https://github.com/informalsystems/hermes/releases/download/v1.0.0/hermes-v1.0.0-x86_64-unknown-linux-gnu.tar.gz" > hermes.tar.gz && \
    tar -C ./ -vxzf hermes.tar.gz && \
    rm -f hermes.tar.gz  && \
    sudo mv ./hermes /usr/local/bin/ && \
    sudo chgrp root /usr/local/bin/hermes && \
    sudo chown root /usr/local/bin/hermes

проверяем версию

hermes --version

создаем папку для конфига

cd ~/
mkdir ~/.hermes

правим и создаем конфигурационный файл ( не забудьте указать свой контракт)

sudo tee $HOME/.hermes/config.toml > /dev/null <<EOF
# The global section has parameters that apply globally to the relayer operation.
[global]

# Specify the verbosity for the relayer logging output. Default: 'info'
# Valid options are 'error', 'warn', 'info', 'debug', 'trace'.
log_level = 'debug'

# Specify the mode to be used by the relayer. [Required]
[mode]

# Specify the client mode.
[mode.clients]

# Whether or not to enable the client workers. [Required]
enabled = true

# Whether or not to enable periodic refresh of clients. [Default: true]
# Note: Even if this is disabled, clients will be refreshed automatically if
#      there is activity on a connection or channel they are involved with.
refresh = true

# Whether or not to enable misbehaviour detection for clients. [Default: false]
misbehaviour = true

# Specify the connections mode.
[mode.connections]

# Whether or not to enable the connection workers for handshake completion. [Required]
enabled = true

# Specify the channels mode.
[mode.channels]

# Whether or not to enable the channel workers for handshake completion. [Required]
enabled = true

# Specify the packets mode.
[mode.packets]

# Whether or not to enable the packet workers. [Required]
enabled = true

# Parametrize the periodic packet clearing feature.
# Interval (in number of blocks) at which pending packets
# should be eagerly cleared. A value of '0' will disable
# periodic packet clearing. [Default: 100]
clear_interval = 100

# Whether or not to clear packets on start. [Default: false]
clear_on_start = true

# Toggle the transaction confirmation mechanism.
# The tx confirmation mechanism periodically queries the `/tx_search` RPC
# endpoint to check that previously-submitted transactions
# (to any chain in this config file) have delivered successfully.
# Experimental feature. Affects telemetry if set to false.
# [Default: true]
tx_confirmation = true

# The REST section defines parameters for Hermes' built-in RESTful API.
# https://hermes.informal.systems/rest.html
[rest]

# Whether or not to enable the REST service. Default: false
enabled = true

# Specify the IPv4/6 host over which the built-in HTTP server will serve the RESTful
# API requests. Default: 127.0.0.1
host = '127.0.0.1'

# Specify the port over which the built-in HTTP server will serve the restful API
# requests. Default: 3000
port = 3000

# The telemetry section defines parameters for Hermes' built-in telemetry capabilities.
# https://hermes.informal.systems/telemetry.html
[telemetry]

# Whether or not to enable the telemetry service. Default: false
enabled = false

# Specify the IPv4/6 host over which the built-in HTTP server will serve the metrics
# gathered by the telemetry service. Default: 127.0.0.1
host = '127.0.0.1'

# Specify the port over which the built-in HTTP server will serve the metrics gathered
# by the telemetry service. Default: 3001
port = 3001

# neutron quark-1 testnet
[[chains]]
id = 'quark-1'
# TODO: Enter your node's public RPC ADDRESS (ip OR host)
rpc_addr = 'http://127.0.0.1:26657'
# TODO: Enter your node's public GRPC ADDRESS (ip OR host)
grpc_addr = 'http://127.0.0.1:9090'
# TODO: Enter your node's public websocket ADDRESS (usually equals to ws://[rpc_addr]/websocket)
websocket_addr = 'ws://127.0.0.1:26657/websocket'
rpc_timeout = '10s'
account_prefix = 'neutron'
key_name = 'neutron-ibc-relayer'
store_prefix = 'ibc'
default_gas = 5000000
max_gas = 15000000
gas_price = { price = 0.004, denom = 'untrn' }
gas_multiplier = 1.1
max_msg_num = 30
max_tx_size = 2097152
clock_drift = '20s'
max_block_time = '10s'
trusting_period = '14days'
trust_threshold = { numerator = '1', denominator = '3' }
address_type = { derivation = 'cosmos' }

# cosmos hub testnet
[[chains]]
id = 'theta-testnet-001'
rpc_addr = 'http://164.90.146.43:26657/'
grpc_addr = 'http://164.90.146.43:9090/'
websocket_addr = 'ws://164.90.146.43:26657/websocket'
rpc_timeout = '10s'
account_prefix = 'cosmos'
key_name = 'cosmoshub-ibc-relayer'
store_prefix = 'ibc'
default_gas = 100000
max_gas = 3000000
gas_price = { price = 0.0025, denom = 'uatom' }
gas_multiplier = 1.1
max_msg_num = 30
max_tx_size = 180000
clock_drift = '5s'
max_block_time = '10s'
trusting_period = '32hours'
trust_threshold = { numerator = '1', denominator = '3' }
address_type = { derivation = 'cosmos' }

# juno: comment out cosmoshub chain and uncomment block below to connect with it
[[chains]]
id = 'uni-5'
rpc_addr = 'https://juno-testnet-rpc.polkachu.com/'
grpc_addr = 'http://juno-testnet-grpc.polkachu.com:12690'
websocket_addr = 'wss://juno-testnet-rpc.polkachu.com/websocket'
rpc_timeout = '10s'
account_prefix = 'juno'
key_name = 'juno-ibc-relayer'
store_prefix = 'ibc'
default_gas = 100000
max_gas = 3000000
gas_price = { price = 0.1, denom = 'ujunox' }
gas_multiplier = 1.1
max_msg_num = 30
max_tx_size = 180000
clock_drift = '5s'
max_block_time = '10s'
trusting_period = '18days'
trust_threshold = { numerator = '1', denominator = '3' }
address_type = { derivation = 'cosmos' }

[chains.packet_filter]
policy = 'allow'
list = [
    # allow relaying only for channels created by a certain contract  
    # TODO: fill in your INTERCHAIN_TXS_CONTRACT_ADDRESS below AFTER you run the test script (not the updload contract script,
    # the tesRACT_ADDRESS below AFTER you run the test script (not the updload contract scripRACT_ADDRESS below AFTER you run the test script (not the updload contract script script) and rааestart the relayer.
    # will be something like `['icacontroller-neutron14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s5c2epq*', '*'],`
    ['*', '*'],
]
EOF

проверяем файл

hermes health-check

добавляем ключи в ретранслятор

export NEUTRON_MNEMONIC="mnemonic"
export COSMOS_MNEMONIC="mnemonic"
export JUNO_MNEMONIC="mnemonic"
export NEUTRON_CHAIN_ID="quark-1" 
export COSMOS_CHAIN_ID="theta-testnet-001" 
export JUNO_CHAIN_ID="uni-5" 
export NEUTRON_KEY_NAME="neutron-ibc-relayer" 
export COSMOS_KEY_NAME="cosmoshub-ibc-relayer" 
export JUNO_KEY_NAME="juno-ibc-relayer" 
hermes keys add --chain quark-1 --mnemonic-file <(echo "$NEUTRON_MNEMONIC") --key-name neutron-ibc-relayer
hermes keys add --chain theta-testnet-001 --mnemonic-file <(echo "$COSMOS_MNEMONIC") --key-name cosmoshub-ibc-relayer
hermes keys add --chain uni-5 --mnemonic-file <(echo "$JUNO_MNEMONIC") --key-name juno-ibc-relayer

создаем сервисный файл

sudo tee /etc/systemd/system/neutron-ibc-cosmoshub-relayer.service > /dev/null <<EOF
[Unit]
Description=Neutron IBC CosmosHub Relayer
After=network.target
[Service]
User=$USER
ExecStart=/usr/local/bin/hermes start
Restart=on-failure
RestartSec=3
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF

создаем связь между сетями ,выбираем одну (интересует только connection_id ( в связке а)

hermes create connection --a-chain quark-1 --b-chain theta-testnet-001
hermes create connection --a-chain quark-1 --b-chain uni-5

Сохраните где-нибудь вновь созданный нейтрон `connection_id` — он необходим для запуска тестового скрипта

стоп сервис ( использовать опционально)

systemctl stop neutron-ibc-cosmoshub-relayer.service

запускаем сервис

sudo systemctl daemon-reload
sudo systemctl enable neutron-ibc-cosmoshub-relayer.service
sudo systemctl start neutron-ibc-cosmoshub-relayer.service && journalctl -u neutron-ibc-cosmoshub-relayer -f -o cat

проверка статуса

sudo systemctl status neutron-ibc-cosmoshub-relayer.service

УСТАНАВЛИВАЕМ И ЗАПУСКАЕМ ICQ

https://teletype.in/@aktiv2332/8RjCKiOOcom

скачиваем скрипт

wget https://raw.githubusercontent.com/neutron-org/neutron-contracts/neutron_audit_oak_19_09_2022_fixes/validator_test.sh

делаем файл исполняемым

chmod +x validator_test.sh

запускаем

./validator_test.sh <YOUR_CONNECTION_ID>

если все прошло успешно , получаем 6 хешей , заполняем форму

удалить hermes

systemctl stop neutron-ibc-cosmoshub-relayer.service && \
systemctl disable neutron-ibc-cosmoshub-relayer.service && \
rm -rf /etc/systemd/system/neutron-ibc-cosmoshub-relayer.service && \
systemctl daemon-reload && \
cd $HOME && \
rm -rf /root/.hermes && \
rm -rf /usr/local/bin/hermes