-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
264 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
# Set up a relayer | ||
|
||
if [ $RELAYER == "hermes" ]; then | ||
echo "Downloading Hermes..." | ||
wget -q https://github.com/informalsystems/hermes/releases/download/$HERMES_VERSION/hermes-$HERMES_VERSION-x86_64-unknown-linux-gnu.tar.gz -O hermes-$HERMES_VERSION.tar.gz | ||
tar -xzvf hermes-$HERMES_VERSION.tar.gz | ||
mkdir -p ~/.hermes | ||
cp hermes ~/.hermes/hermes | ||
export PATH="$PATH:~/.hermes" | ||
|
||
echo "Setting up Hermes config..." | ||
cp templates/gaia-v16/hermes-config-ibc-fee.toml ~/.hermes/config.toml | ||
|
||
echo "Adding relayer keys..." | ||
echo $MNEMONIC_RELAYER > mnemonic.txt | ||
hermes keys add --chain $CHAIN_ID --mnemonic-file mnemonic.txt | ||
hermes keys add --chain host --mnemonic-file mnemonic.txt | ||
fi | ||
|
||
echo "Creating service..." | ||
sudo touch /etc/systemd/system/$RELAYER.service | ||
echo "[Unit]" | sudo tee /etc/systemd/system/$RELAYER.service | ||
echo "Description=Relayer service" | sudo tee /etc/systemd/system/$RELAYER.service -a | ||
echo "After=network-online.target" | sudo tee /etc/systemd/system/$RELAYER.service -a | ||
echo "" | sudo tee /etc/systemd/system/$RELAYER.service -a | ||
echo "[Service]" | sudo tee /etc/systemd/system/$RELAYER.service -a | ||
echo "User=$USER" | sudo tee /etc/systemd/system/$RELAYER.service -a | ||
|
||
if [ $RELAYER == "hermes" ]; then | ||
echo "ExecStart=$HOME/.hermes/$RELAYER start" | sudo tee /etc/systemd/system/$RELAYER.service -a | ||
elif [ $RELAYER == "rly" ]; then | ||
echo "ExecStart=$HOME/.relayer/$RELAYER start" | sudo tee /etc/systemd/system/$RELAYER.service -a | ||
fi | ||
echo "Restart=no" | sudo tee /etc/systemd/system/$RELAYER.service -a | ||
echo "LimitNOFILE=4096" | sudo tee /etc/systemd/system/$RELAYER.service -a | ||
echo "" | sudo tee /etc/systemd/system/$RELAYER.service -a | ||
echo "[Install]" | sudo tee /etc/systemd/system/$RELAYER.service -a | ||
echo "WantedBy=multi-user.target" | sudo tee /etc/systemd/system/$RELAYER.service -a | ||
|
||
sudo systemctl daemon-reload | ||
sudo systemctl enable $RELAYER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
[global] | ||
log_level = 'info' | ||
|
||
[mode] | ||
|
||
[mode.clients] | ||
enabled = true | ||
refresh = true | ||
misbehaviour = true | ||
|
||
[mode.connections] | ||
enabled = true | ||
|
||
[mode.channels] | ||
enabled = true | ||
|
||
[mode.packets] | ||
enabled = true | ||
clear_interval = 10 | ||
clear_on_start = true | ||
tx_confirmation = true | ||
|
||
[telemetry] | ||
enabled = true | ||
host = '127.0.0.1' | ||
port = 3001 | ||
|
||
[[chains]] | ||
id = 'testnet' | ||
rpc_addr = 'http://localhost:27001' | ||
grpc_addr = 'http://localhost:26001' | ||
event_source = { mode = 'push', url = 'ws://localhost:27001/websocket', batch_delay = '500ms' } | ||
rpc_timeout = '15s' | ||
account_prefix = 'cosmos' | ||
key_name = 'wallet' | ||
store_prefix = 'ibc' | ||
gas_price = { price = 0, denom = 'uatom' } | ||
gas_multiplier = 1.5 | ||
max_gas = 10000000 | ||
clock_drift = '10s' | ||
trusting_period = '5days' | ||
trust_threshold = { numerator = '1', denominator = '3' } | ||
type = "CosmosSdk" | ||
|
||
[[chains]] | ||
id = 'two' | ||
rpc_addr = 'http://localhost:27011' | ||
grpc_addr = 'http://localhost:26011' | ||
event_source = { mode = 'push', url = 'ws://localhost:27011/websocket', batch_delay = '500ms' } | ||
rpc_timeout = '15s' | ||
account_prefix = 'cosmos' | ||
key_name = 'wallet' | ||
store_prefix = 'ibc' | ||
gas_price = { price = 0, denom = 'uatom' } | ||
gas_multiplier = 1.5 | ||
max_gas = 10000000 | ||
clock_drift = '10s' | ||
trusting_period = '5days' | ||
trust_threshold = { numerator = '1', denominator = '3' } | ||
type = "CosmosSdk" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
balance_before=$($CHAIN_BINARY q bank balances $RELAYER_WALLET --home $HOME_1 -o json | jq -r --arg DENOM "$DENOM" '.balances[] | select(.denom == $DENOM).amount') | ||
|
||
$RELAYER --json create channel --order unordered --a-chain $CHAIN_ID --a-port transfer --b-port transfer --a-connection connection-0 --channel-version "{\"fee_version\":\"ics29-1\",\"app_version\":\"ics20-1\"}" | ||
|
||
txhash=$($CHAIN_BINARY tx ibc-transfer transfer transfer channel-0 $WALLET_1 1$DENOM --gas $GAS --gas-prices $GAS_PRICE$DENOM --gas-adjustment $GAS_ADJUSTMENT --from $WALLET_1 --output json -y --home $HOME_1 | jq -r '.txhash') | ||
sleep $TIMEOUT_COMMIT | ||
sequence=$($CHAIN_BINARY q tx $txhash --home $HOME_1 -o json | jq -r '.events[] | select(.type == "send_packet").attributes[] | select(.key == "packet_sequence").value') | ||
$CHAIN_BINARY tx ibc-fee pay-packet-fee transfer channel-0 $sequence --recv-fee 123uatom --ack-fee 456uatom --timeout-fee 789uatom --from $WALLET_1 --gas $GAS --gas-prices $GAS_PRICE$DENOM --gas-adjustment $GAS_ADJUSTMENT --home $HOME_1 -y | ||
|
||
sleep 30 | ||
balance_after=$($CHAIN_BINARY q bank balances $RELAYER_WALLET --home $HOME_1 -o json | jq -r --arg DENOM "$DENOM" '.balances[] | select(.denom == $DENOM).amount') | ||
|
||
difference=$(echo "$balance_after - $balance_before" | bc) | ||
echo "Difference: ${difference}$DENOM" |