diff --git a/.gitignore b/.gitignore index c065350c8..05be36dc8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ build/ -data/ +examples/demo/data coverage.out release.tar.gz .env @@ -15,6 +15,7 @@ test/keys/ _test/setup/valkeys/*.json _test/keys/ .DS_Store +.vscode/ # Don't commit the vendor directory if anyone runs 'go mod vendor'. /vendor \ No newline at end of file diff --git a/Makefile b/Makefile index ee70c7cc7..9f3255123 100644 --- a/Makefile +++ b/Makefile @@ -96,28 +96,6 @@ get-gaia: @git clone --branch $(GAIA_VERSION) --depth=1 https://github.com/cosmos/gaia.git ./chain-code/gaia build-gaia: - @./scripts/build-gaia - -build-akash: - @./scripts/build-akash - -get-akash: - @mkdir -p ./chain-code/ - @git clone --branch $(AKASH_VERSION) git@github.com:ovrclk/akash.git ./chain-code/akash - -get-chains: get-gaia get-akash get-wasmd - -get-wasmd: - @mkdir -p ./chain-code/ - @git clone --branch $(WASMD_VERSION) git@github.com:CosmWasm/wasmd.git ./chain-code/wasmd - -build-wasmd: - @./scripts/build-wasmd - -build-chains: build-akash build-gaia build-wasmd - -delete-chains: - @echo "Removing the ./chain-code/ directory..." - @rm -rf ./chain-code + @./examples/demo/scripts/build-gaia .PHONY: two-chains test test-integration ibctest install build lint coverage clean diff --git a/cmd/paths.go b/cmd/paths.go index 8dec779dc..cad96d5a5 100644 --- a/cmd/paths.go +++ b/cmd/paths.go @@ -214,9 +214,9 @@ func pathsAddDirCmd(a *appState) *cobra.Command { Short: `Add path configuration data in bulk from a directory. Example dir: 'configs/demo/paths'`, Long: `Add path configuration data in bulk from a directory housing individual path config files. This is useful for spinning up testnets. - See 'configs/demo/paths' for an example of individual path config files.`, + See 'examples/demo/configs/paths' for an example of individual path config files.`, Example: strings.TrimSpace(fmt.Sprintf(` -$ %s config add-paths configs/paths`, appName)), +$ %s config add-paths examples/demo/configs/paths`, appName)), RunE: func(cmd *cobra.Command, args []string) (err error) { if err := addPathsFromDirectory(cmd.Context(), cmd.ErrOrStderr(), a, args[0]); err != nil { return err diff --git a/configs/agoric.json b/configs/agoric.json deleted file mode 100644 index e910d5d49..000000000 --- a/configs/agoric.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "description": "Agoric Cosmos Chain", - "url": "https://testnet.agoric.com", - "daemon": "ag-chain-cosmos", - "cli": "ag-cosmos-helper", - "daemon-testnet": "ag-nchainz testnet $chainid -o $chainid --v 1 --chain-id $chainid --node-dir-prefix n --keyring-backend test", - "daemon-start": "ag-nchainz start-daemon $chainid --home \"$DAEMON_HOME\" start --pruning=nothing --log_level=warn", - "post-light-client": "ag-nchainz start-solos $chainid", - "link": { - "account-prefix": "agoric", - "gas-adjustment": 1.0, - "trusting-period": "336h" - } -} diff --git a/configs/agoric/chains/ibc-0.json b/configs/agoric/chains/ibc-0.json deleted file mode 100644 index 3b78db7ae..000000000 --- a/configs/agoric/chains/ibc-0.json +++ /dev/null @@ -1 +0,0 @@ -{"key":"testkey","chain-id":"ibc-0","rpc-addr":"http://localhost:26657","account-prefix":"agoric","gas":200000,"gas-adjustment":1.0,"gas-prices":"","default-denom":"uagstake","trusting-period":"336h"} diff --git a/configs/agoric/chains/ibc-1.json b/configs/agoric/chains/ibc-1.json deleted file mode 100644 index ddfaa3663..000000000 --- a/configs/agoric/chains/ibc-1.json +++ /dev/null @@ -1 +0,0 @@ -{"key":"testkey","chain-id":"ibc-1","rpc-addr":"http://localhost:26557","account-prefix":"agoric","gas":200000,"gas-adjustment":1.0,"gas-prices":"","default-denom":"uagstake","trusting-period":"336h"} diff --git a/configs/agoric/paths/demo.json b/configs/agoric/paths/demo.json deleted file mode 100644 index 5f24ef6ad..000000000 --- a/configs/agoric/paths/demo.json +++ /dev/null @@ -1 +0,0 @@ -{"src":{"chain-id":"ibc-0","client-id":"ibconeclient","connection-id":"ibconeconnection","channel-id":"ibconexfer","port-id":"transfer","version":"ics20-1"},"dst":{"chain-id":"ibc-1","client-id":"ibczeroclient","connection-id":"ibczeroconnection","channel-id":"ibczeroxfer","port-id":"transfer","version":"ics20-1"},"strategy":{"type":"naive"}} diff --git a/configs/akash/chains/ibc-0.json b/configs/akash/chains/ibc-0.json deleted file mode 100644 index a5b51cead..000000000 --- a/configs/akash/chains/ibc-0.json +++ /dev/null @@ -1 +0,0 @@ -{"key":"testkey","chain-id":"ibc-0","rpc-addr":"http://localhost:26657","account-prefix":"cosmos","gas-adjustment":1.5,"gas-prices":"0.025stake","trusting-period":"336h"} diff --git a/configs/akash/chains/ibc-1.json b/configs/akash/chains/ibc-1.json deleted file mode 100644 index 50c8b91ca..000000000 --- a/configs/akash/chains/ibc-1.json +++ /dev/null @@ -1 +0,0 @@ -{"key":"testkey","chain-id":"ibc-1","rpc-addr":"http://localhost:26557","account-prefix":"akash","gas-adjustment":1.5,"gas-prices":"0.025stake", "trusting-period":"336h"} diff --git a/configs/akash/paths/demo.json b/configs/akash/paths/demo.json deleted file mode 100644 index 26942c74d..000000000 --- a/configs/akash/paths/demo.json +++ /dev/null @@ -1 +0,0 @@ -{"src":{"chain-id":"ibc-0","client-id":"","connection-id":"","channel-id":"","port-id":"transfer","order":"unordered","version":"ics20-1"},"dst":{"chain-id":"ibc-1","client-id":"","connection-id":"","channel-id":"","port-id":"transfer","order":"unordered","version":"ics20-1"},"strategy":{"type":"naive"}} diff --git a/configs/four/chains/ibc-0.json b/configs/four/chains/ibc-0.json deleted file mode 100644 index 07f5e02b2..000000000 --- a/configs/four/chains/ibc-0.json +++ /dev/null @@ -1 +0,0 @@ -{"key":"testkey","chain-id":"ibc-0","rpc-addr":"http://localhost:46657","account-prefix":"cosmos","gas-adjustment":1.0,"trusting-period":"336h"} diff --git a/configs/four/chains/ibc-1.json b/configs/four/chains/ibc-1.json deleted file mode 100644 index efef17309..000000000 --- a/configs/four/chains/ibc-1.json +++ /dev/null @@ -1 +0,0 @@ -{"key":"testkey","chain-id":"ibc-1","rpc-addr":"http://localhost:46658","account-prefix":"cosmos","gas-adjustment":1.0,"trusting-period":"336h"} \ No newline at end of file diff --git a/configs/four/chains/ibc-2.json b/configs/four/chains/ibc-2.json deleted file mode 100644 index d803e2ec2..000000000 --- a/configs/four/chains/ibc-2.json +++ /dev/null @@ -1 +0,0 @@ -{"key":"testkey","chain-id":"ibc-2","rpc-addr":"http://localhost:46659","account-prefix":"cosmos","gas-adjustment":1.0,"trusting-period":"336h"} \ No newline at end of file diff --git a/configs/four/chains/ibc-3.json b/configs/four/chains/ibc-3.json deleted file mode 100644 index 27e6461aa..000000000 --- a/configs/four/chains/ibc-3.json +++ /dev/null @@ -1 +0,0 @@ -{"key":"testkey","chain-id":"ibc-3","rpc-addr":"http://localhost:46660","account-prefix":"cosmos","gas-adjustment":1.0,"trusting-period":"336h"} \ No newline at end of file diff --git a/configs/four/paths/onetwo.json b/configs/four/paths/onetwo.json deleted file mode 100644 index 2981c395f..000000000 --- a/configs/four/paths/onetwo.json +++ /dev/null @@ -1 +0,0 @@ -{"src":{"chain-id":"ibc-1","client-id":"acvfuvmoyy","connection-id":"pvsadpxocj","channel-id":"gxigiquvdc","port-id":"transfer","version":"ics20-1"},"dst":{"chain-id":"ibc-2","client-id":"vnsqzxwsfs","connection-id":"ikmrjehlzn","channel-id":"kzeiryubgz","port-id":"transfer","version":"ics20-1"},"strategy":{"type":"naive"}} diff --git a/configs/four/paths/threezero.json b/configs/four/paths/threezero.json deleted file mode 100644 index f52549dda..000000000 --- a/configs/four/paths/threezero.json +++ /dev/null @@ -1 +0,0 @@ -{"src":{"chain-id":"ibc-3","client-id":"zjyshingti","connection-id":"kygrljuplq","channel-id":"hdiooxmgry","port-id":"transfer","version":"ics20-1"},"dst":{"chain-id":"ibc-0","client-id":"vddpwioaua","connection-id":"wmvxarvtdj","channel-id":"mytxyocvdk","port-id":"transfer","version":"ics20-1"},"strategy":{"type":"naive"}} diff --git a/configs/four/paths/twothree.json b/configs/four/paths/twothree.json deleted file mode 100644 index e4565b585..000000000 --- a/configs/four/paths/twothree.json +++ /dev/null @@ -1 +0,0 @@ -{"src":{"chain-id":"ibc-2","client-id":"jluiqkandb","connection-id":"mfyxyvmogc","channel-id":"ckcplvbklp","port-id":"transfer","version":"ics20-1"},"dst":{"chain-id":"ibc-3","client-id":"kvhumysqxf","connection-id":"kejwjeluuz","channel-id":"pcqmpcbqgi","port-id":"transfer","version":"ics20-1"},"strategy":{"type":"naive"}} diff --git a/configs/four/paths/zeroone.json b/configs/four/paths/zeroone.json deleted file mode 100644 index 7c83cac50..000000000 --- a/configs/four/paths/zeroone.json +++ /dev/null @@ -1 +0,0 @@ -{"src":{"chain-id":"ibc-0","client-id":"ytwwxbikra","connection-id":"znruvklbwm","channel-id":"spqkreyyhp","port-id":"transfer","version":"ics20-1"},"dst":{"chain-id":"ibc-1","client-id":"unfkygnnyq","connection-id":"jighhjlxjf","channel-id":"dkqbmdcyuk","port-id":"transfer","version":"ics20-1"},"strategy":{"type":"naive"}} diff --git a/configs/gaia.json b/configs/gaia.json deleted file mode 100644 index ba7b9c403..000000000 --- a/configs/gaia.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "daemon": "gaiad", - "cli": "gaiad", - "link": { - "account-prefix": "cosmos", - "gas-adjustment": 1.2, - "gas-prices": "0.025stake", - "default-denom": "stake", - "trusting-period": "336h" - } -} diff --git a/configs/gaia/chains/ibc-0.json b/configs/gaia/chains/ibc-0.json deleted file mode 100644 index 87b599711..000000000 --- a/configs/gaia/chains/ibc-0.json +++ /dev/null @@ -1 +0,0 @@ -{"key":"testkey","chain-id":"ibc-0","rpc-addr":"http://localhost:26657","account-prefix":"cosmos","gas":200000,"gas-adjustment":1.0,"gas-prices":"0.025stake","default-denom":"stake","trusting-period":"336h"} diff --git a/configs/gaia/chains/ibc-1.json b/configs/gaia/chains/ibc-1.json deleted file mode 100644 index 23f84a4d8..000000000 --- a/configs/gaia/chains/ibc-1.json +++ /dev/null @@ -1 +0,0 @@ -{"key":"testkey","chain-id":"ibc-1","rpc-addr":"http://localhost:26557","account-prefix":"cosmos","gas":200000,"gas-adjustment":1.0,"gas-prices":"0.025stake","default-denom":"stake","trusting-period":"336h"} diff --git a/configs/gaia/paths/demo.json b/configs/gaia/paths/demo.json deleted file mode 100644 index 10f0a954d..000000000 --- a/configs/gaia/paths/demo.json +++ /dev/null @@ -1 +0,0 @@ -{"src":{"chain-id":"ibc-0","client-id":"","connection-id":"","channel-id":"","port-id":"transfer","version":"ics20-1"},"dst":{"chain-id":"ibc-1","client-id":"","connection-id":"","channel-id":"","port-id":"transfer","version":"ics20-1"},"strategy":{"type":"naive"}} diff --git a/configs/three/chains/ibc-0.json b/configs/three/chains/ibc-0.json deleted file mode 100644 index 593ad9592..000000000 --- a/configs/three/chains/ibc-0.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "type": "cosmos", - "value": { - "key": "testkey", - "chain-id": "ibc-0", - "rpc-addr": "http://localhost:26657", - "grpc-addr": "", - "account-prefix": "cosmos", - "keyring-backend": "test", - "gas-adjustment": 1.5, - "gas-prices": "0.025stake", - "debug": true, - "timeout": "10s", - "output-format": "json", - "sign-mode": "direct" - } - } - - \ No newline at end of file diff --git a/configs/three/chains/ibc-1.json b/configs/three/chains/ibc-1.json deleted file mode 100644 index 5adeb19f5..000000000 --- a/configs/three/chains/ibc-1.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "type": "cosmos", - "value": { - "key": "testkey", - "chain-id": "ibc-1", - "rpc-addr": "http://localhost:26557", - "grpc-addr": "", - "account-prefix": "cosmos", - "keyring-backend": "test", - "gas-adjustment": 1.5, - "gas-prices": "0.025stake", - "debug": true, - "timeout": "10s", - "output-format": "json", - "sign-mode": "direct" - } - } - - \ No newline at end of file diff --git a/configs/three/chains/ibc-2.json b/configs/three/chains/ibc-2.json deleted file mode 100644 index 9ed4b06b6..000000000 --- a/configs/three/chains/ibc-2.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "type": "cosmos", - "value": { - "key": "testkey", - "chain-id": "ibc-2", - "rpc-addr": "http://localhost:25557", - "grpc-addr": "", - "account-prefix": "cosmos", - "keyring-backend": "test", - "gas-adjustment": 1.5, - "gas-prices": "0.025stake", - "debug": true, - "timeout": "10s", - "output-format": "json", - "sign-mode": "direct" - } - } - - \ No newline at end of file diff --git a/configs/three/paths/demo.json b/configs/three/paths/demo.json deleted file mode 100644 index 26942c74d..000000000 --- a/configs/three/paths/demo.json +++ /dev/null @@ -1 +0,0 @@ -{"src":{"chain-id":"ibc-0","client-id":"","connection-id":"","channel-id":"","port-id":"transfer","order":"unordered","version":"ics20-1"},"dst":{"chain-id":"ibc-1","client-id":"","connection-id":"","channel-id":"","port-id":"transfer","order":"unordered","version":"ics20-1"},"strategy":{"type":"naive"}} diff --git a/configs/three/paths/demo2.json b/configs/three/paths/demo2.json deleted file mode 100644 index 3fac02a1f..000000000 --- a/configs/three/paths/demo2.json +++ /dev/null @@ -1 +0,0 @@ -{"src":{"chain-id":"ibc-1","client-id":"","connection-id":"","channel-id":"","port-id":"transfer","order":"unordered","version":"ics20-1"},"dst":{"chain-id":"ibc-2","client-id":"","connection-id":"","channel-id":"","port-id":"transfer","order":"unordered","version":"ics20-1"},"strategy":{"type":"naive"}} diff --git a/configs/wasmd/chains/ibc-0.json b/configs/wasmd/chains/ibc-0.json deleted file mode 100644 index c44ce9d01..000000000 --- a/configs/wasmd/chains/ibc-0.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "type": "cosmos", - "value": { - "key": "testkey", - "chain-id": "ibc-0", - "rpc-addr": "http://localhost:26657", - "grpc-addr": "", - "account-prefix": "wasm", - "keyring-backend": "test", - "gas-adjustment": 1.5, - "gas-prices": "0.025stake", - "debug": true, - "timeout": "10s", - "output-format": "json", - "sign-mode": "direct" - } -} \ No newline at end of file diff --git a/configs/wasmd/chains/ibc-1.json b/configs/wasmd/chains/ibc-1.json deleted file mode 100644 index b00519d6e..000000000 --- a/configs/wasmd/chains/ibc-1.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "type": "cosmos", - "value": { - "key": "testkey", - "chain-id": "ibc-1", - "rpc-addr": "http://localhost:26557", - "grpc-addr": "", - "account-prefix": "wasm", - "keyring-backend": "test", - "gas-adjustment": 1.5, - "gas-prices": "0.025stake", - "debug": true, - "timeout": "10s", - "output-format": "json", - "sign-mode": "direct" - } -} \ No newline at end of file diff --git a/configs/wasmd/paths/demo.json b/configs/wasmd/paths/demo.json deleted file mode 100644 index 14175cedb..000000000 --- a/configs/wasmd/paths/demo.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "src": { - "chain-id": "ibc-0" - }, - "dst": { - "chain-id": "ibc-1" - }, - "src-channel-filter": { - "rule": null, - "channel-list": [] - } -} diff --git a/dev-env b/dev-env index 0337f76fb..4243a6599 100755 --- a/dev-env +++ b/dev-env @@ -15,11 +15,12 @@ fi cd $RELAYER_DIR rm -rf $RELAYER_CONF &> /dev/null pwd -bash scripts/two-chainz-wasmd "skip" +bash scripts/two-chainz "skip" echo "waiting for blocks..." sleep 3 +# creates client, connection, and channel all in one command rly tx link demo -d -t 3s sleep 2 echo "Initial balances" @@ -28,8 +29,10 @@ echo "balance 1 $(rly q bal ibc-1)" rly tx transfer ibc-0 ibc-1 100000samoleans "$(rly keys show ibc-1)" channel-0 -d rly tx transfer ibc-1 ibc-0 100000samoleans "$(rly keys show ibc-0)" channel-0 -d sleep 5 +# relay remaining packets and then finishes as opposed to starting a continuous listening loop with `rly start` rly tx relay-packets demo channel-0 -d sleep 5 +# relay remaining acknowledgments and then finishes as opposed to starting a continuous listening loop with `rly start` rly tx relay-acknowledgements demo channel-0 -d sleep 5 echo "Balances after packets are sent" diff --git a/docs/demo.md b/docs/demo.md index 02067f097..ea681e0fa 100644 --- a/docs/demo.md +++ b/docs/demo.md @@ -19,7 +19,7 @@ $ make get-gaia build-gaia # two-chainz creates two gaia-based chains with data directories in this repo # it also builds and configures the relayer for operations with those chains -$ ./scripts/two-chainz +$ ./examples/demo/scripts/two-chainz # NOTE: If you want to stop the two gaia-based chains running in the background use `killall gaiad` # At this point the relayer --home directory is ready for normal operations between diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 000000000..6fd5ff81a --- /dev/null +++ b/examples/README.md @@ -0,0 +1,39 @@ +## Demo/Dev-Environment + +The demo environment is a series of bash scripts that: + +1) Spins up two IBC enabled blockchains chains (gaia) in your local environment +2) Creates an IBC connection between both chains +3) Sends an IBC transaction between both chains + +This can be used to learn about the inter workings of IBC. Follow along with the commands inside of the bash scripts to get a better idea. + +This can also be used to spin up a quick testing environment. + +To run: + +```bash +cd examples/demo/ +./dev-env +``` + +This script creates a folder called "data": `examples/demo/data/`. +Logs and config info for each chain can be found here. + + +Note: After running, two `gaiad` instances will be running on your machine. +To kill ALL `gaiad` instances run: +```bash +killall gaiad +``` + +--- + +## Example Config: [examples/config.yaml](./config_EXAMPLE.yaml) + +This is an example of a config file with: + +- Three chains added: `cosmoshub`, `juno`, and `osmosis` +- Three paths configured: `cosmoshub-juno`, `cosmoshub-osmosis`, `juno-osmosis` + - Path `cosmoshub-juno` does not filter any channels while the other two paths have filters set. +- All three chains have a wallet/key called "default" \ No newline at end of file diff --git a/examples/config_EXAMPLE.yaml b/examples/config_EXAMPLE.yaml new file mode 100644 index 000000000..dd4ad343d --- /dev/null +++ b/examples/config_EXAMPLE.yaml @@ -0,0 +1,88 @@ +global: + api-listen-addr: :5183 + timeout: 10s + memo: "" + light-cache-size: 20 +chains: + cosmoshub: + type: cosmos + value: + key: default + chain-id: cosmoshub-4 + rpc-addr: http://cosmoshub.strange.love:26657/ + account-prefix: cosmos + keyring-backend: test + gas-adjustment: 1.2 + gas-prices: 0.01uatom + debug: false + timeout: 20s + output-format: json + sign-mode: direct + juno: + type: cosmos + value: + key: default + chain-id: juno-1 + rpc-addr: http://juno.strange.love:26657/ + account-prefix: juno + keyring-backend: test + gas-adjustment: 1.2 + gas-prices: 0.01ujuno + debug: false + timeout: 20s + output-format: json + sign-mode: direct + osmosis: + type: cosmos + value: + key: default + chain-id: osmosis-1 + rpc-addr: http://osmosis.strange.love:26657/ + account-prefix: osmo + keyring-backend: test + gas-adjustment: 1.2 + gas-prices: 0.01uosmo + debug: false + timeout: 20s + output-format: json + sign-mode: direct +paths: + cosmoshub-juno: + src: + chain-id: cosmoshub-4 + client-id: 07-tendermint-439 + connection-id: connection-372 + dst: + chain-id: juno-1 + client-id: 07-tendermint-3 + connection-id: connection-2 + src-channel-filter: + rule: "" + channel-list: [] + cosmoshub-osmosis: + src: + chain-id: cosmoshub-4 + client-id: 07-tendermint-259 + connection-id: connection-257 + dst: + chain-id: osmosis-1 + client-id: 07-tendermint-1 + connection-id: connection-1 + src-channel-filter: + rule: allowlist + channel-list: + - channel-141 + juno-osmosis: + src: + chain-id: juno-1 + client-id: 07-tendermint-0 + connection-id: connection-0 + dst: + chain-id: osmosis-1 + client-id: 07-tendermint-1457 + connection-id: connection-1142 + src-channel-filter: + rule: allowlist + channel-list: + - channel-0 + - wasm.juno1v4887y83d6g28puzvt8cl0f3cdhd3y6y9mpysnsp3k8krdm7l6jqgm0rkn diff --git a/configs/demo/chains/ibc-0.json b/examples/demo/configs/chains/ibc-0.json similarity index 100% rename from configs/demo/chains/ibc-0.json rename to examples/demo/configs/chains/ibc-0.json diff --git a/configs/demo/chains/ibc-1.json b/examples/demo/configs/chains/ibc-1.json similarity index 100% rename from configs/demo/chains/ibc-1.json rename to examples/demo/configs/chains/ibc-1.json diff --git a/configs/demo/paths/demo.json b/examples/demo/configs/paths/demo.json similarity index 100% rename from configs/demo/paths/demo.json rename to examples/demo/configs/paths/demo.json diff --git a/examples/demo/dev-env b/examples/demo/dev-env new file mode 100755 index 000000000..cf5c4ae5c --- /dev/null +++ b/examples/demo/dev-env @@ -0,0 +1,41 @@ +#!/bin/bash -e +RELAYER_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +RELAYER_CONF="$HOME/.relayer" +GAIA_CONF="$(pwd)/data" + +# Ensure user understands what will be deleted +if ([[ -d $RELAYER_CONF ]] || [[ -d $GAIA_CONF ]]) && [[ ! "$1" == "skip" ]]; then + read -p "$0 will delete \$HOME/.relayer and \$(pwd)/data folder. Do you wish to continue? (y/n): " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + exit 1 + fi +fi + +cd $RELAYER_DIR +rm -rf $RELAYER_CONF &> /dev/null +pwd +# spin up two ibc enabled chains and add relevant config info for relaying +bash scripts/two-chainz "skip" + +echo "waiting for blocks..." +sleep 3 + +# creates clients, connections and channels (all this happens in rly tx command) +rly tx link demo -d -t 3s +sleep 2 +echo "Initial balances" +echo "balance 0 $(rly q bal ibc-0)" +echo "balance 1 $(rly q bal ibc-1)" +rly tx transfer ibc-0 ibc-1 100000samoleans "$(rly keys show ibc-1)" channel-0 -d +rly tx transfer ibc-1 ibc-0 100000samoleans "$(rly keys show ibc-0)" channel-0 -d +sleep 5 +# relay remaining packets and then finishes as opposed to starting a continuous listening loop with `rly start` +rly tx relay-packets demo channel-0 -d +sleep 5 +# relay remaining acknowledgments and then finishes as opposed to starting a continuous listening loop with `rly start` +rly tx relay-acknowledgements demo channel-0 -d +sleep 5 +echo "Balances after packets are sent" +echo "balance 0 $(rly q bal ibc-0)" +echo "balance 1 $(rly q bal ibc-1)" \ No newline at end of file diff --git a/scripts/build-gaia b/examples/demo/scripts/build-gaia similarity index 100% rename from scripts/build-gaia rename to examples/demo/scripts/build-gaia diff --git a/scripts/one-chain b/examples/demo/scripts/one-chain similarity index 99% rename from scripts/one-chain rename to examples/demo/scripts/one-chain index b59b0ec9d..bc1921f47 100755 --- a/scripts/one-chain +++ b/examples/demo/scripts/one-chain @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash display_usage() { echo "\nMissing $1 parameter. Please check if all parameters were specified." diff --git a/scripts/two-chainz b/examples/demo/scripts/two-chainz similarity index 95% rename from scripts/two-chainz rename to examples/demo/scripts/two-chainz index 9f0593f37..1772e46e1 100755 --- a/scripts/two-chainz +++ b/examples/demo/scripts/two-chainz @@ -56,15 +56,17 @@ mkdir -p $GAIA_DATA && cd $GAIA_DATA && cd ../ cd $RELAYER_DIR echo "Building Relayer..." -make install +make -C ../../ install + +pwd echo "Generating rly configurations..." rly config init -rly chains add-dir configs/demo/chains +rly chains add-dir configs/chains SEED0=$(jq -r '.mnemonic' $GAIA_DATA/ibc-0/key_seed.json) SEED1=$(jq -r '.mnemonic' $GAIA_DATA/ibc-1/key_seed.json) echo "Key $(rly keys restore ibc-0 testkey "$SEED0") imported from ibc-0 to relayer..." echo "Key $(rly keys restore ibc-1 testkey "$SEED1") imported from ibc-1 to relayer..." -rly paths add-dir configs/demo/paths +rly paths add-dir configs/paths diff --git a/scripts/build-akash b/scripts/build-akash deleted file mode 100755 index 1239760a3..000000000 --- a/scripts/build-akash +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -AKASHDIR="$(dirname $SCRIPTDIR)/chain-code/akash" - -[ ! -d "$AKASHDIR" ] && echo "Repositry for akash does not exist at $AKASHDIR. Try running 'make get-akash'..." && exit 1 - -cd $AKASHDIR -echo "Building akash binary at branch($(git branch --show-current)) tag($(git describe --tags)) commit($(git rev-parse HEAD))" -make install &> /dev/null -akash version --long diff --git a/scripts/build-wasmd b/scripts/build-wasmd deleted file mode 100755 index e2b10a9f0..000000000 --- a/scripts/build-wasmd +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -WASMDDIR="$(dirname $SCRIPTDIR)/chain-code/wasmd" - -[ ! -d "$WASMDDIR" ] && echo "Repository for wasmd does not exist at $WASMDDIR. Try running 'make get-wasmd'..." && exit 1 - -cd $WASMDDIR -echo "Building wasmd binary at branch($(git branch --show-current)) tag($(git describe --tags)) commit($(git rev-parse HEAD))" -make install &> /dev/null -wasmd version --long diff --git a/scripts/four-chainz b/scripts/four-chainz deleted file mode 100755 index 98ce1d094..000000000 --- a/scripts/four-chainz +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/bash -# TODO: test again, don't think this is currently working - -# Ensure jq is installed -if [[ ! -x "$(which jq)" ]]; then - echo "jq (a tool for parsing json in the command line) is required..." - echo "https://stedolan.github.io/jq/download/" - exit 1 -fi - -# Ensure docker is installed -if [[ ! -x "$(which docker-compose)" ]]; then - echo "docker (a containerization tool) is required..." - echo "https://docs.docker.com/compose/install/" - exit 1 -fi - -RELAYER_DIR="$GOPATH/src/github.com/cosmos/relayer" -RELAYER_CONF="$HOME/.relayer" -ENV_FILE="$RELAYER_DIR/.env" - -# Ensure user understands what will be deleted -if [[ -d $RELAYER_CONF ]] && [[ ! "$1" == "skip" ]]; then - read -p "$0 will delete ~/.relayer folder and \$(pwd)/.env file. Do you wish to continue? (y/n): " -n 1 -r - echo - if [[ ! $REPLY =~ ^[Yy]$ ]]; then - exit 1 - fi -fi - -echo "Stopping any existing containers..." -docker-compose down &> /dev/null - -cd $RELAYER_DIR -rm -rf $RELAYER_CONF &> /dev/null -rm -rf $ENV_FILE &> /dev/null -touch $ENV_FILE - -make install - -echo "Generating rly configurations..." -rly cfg i - -echo "Adding configuration..." -rly cfg ad configs/four/ &> /dev/null - -echo "Generating keys..." -echo "IBC0ADDR=$(rly k a ibc-0 | jq -r '.address')" >> $ENV_FILE -echo "IBC1ADDR=$(rly k a ibc-1 | jq -r '.address')" >> $ENV_FILE -echo "IBC2ADDR=$(rly k a ibc-2 | jq -r '.address')" >> $ENV_FILE -echo "IBC3ADDR=$(rly k a ibc-3 | jq -r '.address')" >> $ENV_FILE - -echo "Creating containers..." -docker-compose up -d &> /dev/null - -echo "Waiting for blocks..." -sleep 8 - -echo "Creating light clients for chains..." -rly light init ibc-0 -f -rly light init ibc-1 -f -rly light init ibc-2 -f -rly light init ibc-3 -f - -echo "Starting 'rly tx link zeroone' (ibc-0<>ibc-1) logs in data/zeroone.log" -rly tx link zeroone -d -o 3s 2>&1 > data/zeroone.log & -sleep 1 -echo "Starting 'rly tx link twothree' (ibc-2<>ibc-3) logs in data/twothree.log" -rly tx link twothree -d -o 3s 2>&1 > data/twothree.log & -sleep 1 -echo "Starting 'rly tx link onetwo' (ibc-1<>ibc-2) logs in data/onetwo.log" -rly tx link onetwo -d -o 3s 2>&1 > data/onetwo.log & -sleep 2 -echo "Starting 'rly tx link threezero' (ibc-3<>ibc-0) logs in data/threezero.log" -rly tx link threezero -d -o 3s 2>&1 > data/threezero.log & -sleep 1 -echo "Check the state of the connections using 'rly paths list' to see when they are ready to relay over..." -rly paths list \ No newline at end of file diff --git a/scripts/nchainz b/scripts/nchainz deleted file mode 100755 index e723dd051..000000000 --- a/scripts/nchainz +++ /dev/null @@ -1,704 +0,0 @@ -#!/bin/bash -# nchainz - start an arbitrary number of chains and relayers - -progname=$(basename -- "$0") -thisdir=$(dirname -- ${BASH_SOURCE[0]}) - -trap 'kill $(jobs -p) 2>/dev/null' EXIT - -BASEDIR=$progname -DEFAULT_CONFIG=gaia -DEFAULT_PORT=transfer -SKIP=no - -RELAYER_DIR=$(cd "$thisdir/.." && pwd) -CONFIGS_DIR="$RELAYER_DIR/configs" - -CHAIN_RE='^([^=]+)=(.+)$' -LINK_RE='^([^:]+):([^:]+)$' -PORT_RE='^([^@]+)@(.*)$' - -CHAINS=() -LINKS=() - -# Ensure jq is installed -if [[ ! -x "$(which jq)" ]]; then - echo "jq (a tool for parsing json in the command line) is required..." - echo "https://stedolan.github.io/jq/download/" - exit 1 -fi - -nextID=0 -generate_id() { - config=$1 - while true; do - id="ibc$nextID" - found=no - for chain in ${CHAINS[@]}; do - case $chain in - "$id="*) - found=yes - break - esac - done - if [[ $found != yes ]]; then - return - fi - nextID=$(( $nextID + 1 )) - done -} - -IDS=() -CONFIGS=() -JSONS=() -SRCS=() -SRCPORTS=() -DSTS=() -DSTPORTS=() - -validate() { - status=0 - # Have at least one default. - if [[ ${#CHAINS[@]} -eq 0 ]]; then - generate_id "$DEFAULT_CONFIG" - CHAINS+=( "$id=$DEFAULT_CONFIG" ) - fi - - for chain in ${CHAINS[@]} LAST_CHAIN; do - if [[ $chain == LAST_CHAIN ]]; then - if [[ ${#CHAINS[@]} -ge 2 ]]; then - # Don't need more config - break - fi - # We need at least two chains, so use the same config. - config=${CONFIGS[0]} - generate_id "$config" - chain="$id=$config" - CHAINS+=( "$chain" ) - fi - if [[ $chain =~ $CHAIN_RE ]]; then - id=${BASH_REMATCH[1]} - config=${BASH_REMATCH[2]} - IDS+=( "$id" ) - json=$CONFIGS_DIR/$config.json - if [[ ! -f $json ]]; then - echo 1>&2 "$progname: error: CHAIN \`$chain' config \`$json' does not exist" - status=1 - fi - CONFIGS+=( "$config" ) - JSONS+=( "$json" ) - else - echo 1>&2 "$progname: error: invalid CHAIN specification \`$chain'" - status=1 - fi - done - - # Default links as a circuit around the chains. - if [[ ${#LINKS[@]} -eq 0 ]]; then - prior= - for id in ${IDS[@]}; do - if [[ -n $prior ]]; then - LINKS+=( "$prior:$id" ) - fi - prior=$id - done - if [[ -z $prior ]]; then - echo 1>&2 "$progname: error: no configured LINKS" - status=1 - elif [[ $prior != ${IDS[1]} ]]; then - LINKS+=( "$prior:${IDS[0]}" ) - fi - fi - - for link in ${LINKS[@]}; do - if [[ $link =~ $LINK_RE ]]; then - src=${BASH_REMATCH[1]} - dst=${BASH_REMATCH[2]} - if [[ $src =~ $PORT_RE ]]; then - srcport=${BASH_REMATCH[1]} - src=${BASH_REMATCH[2]} - else - srcport=$DEFAULT_PORT - fi - if [[ $dst =~ $PORT_RE ]]; then - dstport=${BASH_REMATCH[1]} - dst=${BASH_REMATCH[2]} - else - dstport=$DEFAULT_PORT - fi - found_src=no - found_dst=no - for id in ${IDS[@]}; do - [[ $id != $src ]] || found_src=yes - [[ $id != $dst ]] || found_dst=yes - done - if [[ $found_src != yes ]]; then - echo 1>&2 "$progname: error: LINK \`$link' source ID \`$src' does not match a CHAIN" - status=1 - fi - if [[ $found_dst != yes ]]; then - echo 1>&2 "$progname: error: LINK \`$link' destination ID \`$dst' does not match a CHAIN" - status=1 - fi - SRCS+=( "$src" ) - SRCPORTS+=( "$srcport" ) - DSTS+=( "$dst" ) - DSTPORTS+=( "$dstport" ) - else - echo 1>&2 "$progname: error: invalid LINK specification \`$link'" - status=1 - fi - done - [[ $status -eq 0 ]] || usage $status -} - -show_plan() { - echo "Here's the plan:" - for i in ${!IDS[@]}; do - id=${IDS[$i]} - json=${JSONS[$i]} - echo " create $id from $json" - done - for i in ${!SRCS[@]}; do - srcport=${SRCPORTS[$i]} - src=${SRCS[$i]} - dstport=${DSTPORTS[$i]} - dst=${DSTS[$i]} - echo " link $srcport@$src to $dstport@$dst" - done -} - -usage() { - status=$1 - if [[ $status -eq 0 ]]; then - cat <&2 "$progname: unrecognized option \`$1'" - usage 1 - ;; - *) - case $COMMAND in - "") COMMAND=$1 ;; - init) - case "$1" in - skip) SKIP=yes ;; - norun) SKIP=norun ;; - *=*) CHAINS+=( "$1" ) ;; - *:*) LINKS+=( "$1" ) ;; - *) - generate_id "$1" - CHAINS+=( "$id=$1" ) - ;; - esac - ;; - help) - do_help "$1" - ;; - *) - break - ;; - esac - esac - shift -done - -mkdir -p "$BASEDIR" -BASEDIR=$(cd "$BASEDIR" && pwd) -NCONFIG="$BASEDIR/nchainz.cfg" -DATA="$BASEDIR/data" -LOGS="$BASEDIR/logs" - -case $COMMAND in -"") - echo 1>&2 "$progname: you must specify a COMMAND" - usage 1 - ;; -help) - usage 0 - ;; -init) - # Just continue. - ;; -chains) - source "$NCONFIG" - - # Ensure user understands what will be deleted - if [[ -d $DATA ]] && [[ $1 != skip ]]; then - read -p "$progname: will delete $DATA folder. Do you wish to continue? (y/N): " -n 1 -r - echo - if [[ ! $REPLY =~ ^[Yy]$ ]]; then - exit 1 - fi - fi - rm -rf "$DATA" - - echo "mkdir $DATA" - mkdir -p "$DATA" - - set -e - - echo "Generating chain configurations..." - cd "$DATA" - - if [[ "$(uname)" == Darwin ]]; then - sedi() { - sed -i '' ${1+"$@"} - } - else - sedi() { - sed -i ${1+"$@"} - } - fi - - base=0 - for i in ${!IDS[@]}; do - ID=${IDS[$i]} - json=${JSONS[$i]} - DAEMON=$(jq -r .daemon $json) - CLI=$(jq -r .cli $json) - - DAEMON_TESTNET=$(jq -r '."daemon-testnet"' "$json") - [[ $DAEMON_TESTNET != null ]] || DAEMON_TESTNET='echo | $DAEMON testnet -o $chainid --v 1 --node-daemon-home=$DAEMON --chain-id $chainid --node-dir-prefix n --keyring-backend test' - - chainid="$ID" - p1317=$(( 1317 + $i )) - p26656=$(( 26656 - $i * 100 )) - p26657=$(( 26657 - $i * 100 )) - p26658=$(( 26658 - $i * 100 )) - p26660=$(( 26660 - $i * 100 )) - p6060=$(( 6060 + $i )) - p9090=$(( 9090 + $i )) - - eval $DAEMON_TESTNET || true - - cfgpth="$DATA/$chainid/n0/$DAEMON/config/config.toml" - # TODO: Just index *some* specified tags, not all - sedi 's/index_all_keys = false/index_all_keys = true/g' "$cfgpth" - - # Set proper defaults and change ports - sedi 's/"leveldb"/"goleveldb"/g' "$cfgpth" - sedi "s#:26656#:$p26656#g" "$cfgpth" - sedi "s#:26657#:$p26657#g" "$cfgpth" - sedi "s#:26658#:$p26658#g" "$cfgpth" - sedi "s#:26660#:$p26660#g" "$cfgpth" - sedi "s#:6060#:$p6060#g" "$cfgpth" - - # Make blocks run faster than normal - sedi 's/timeout_commit = "[0-9]*s"/timeout_commit = "1s"/g' "$cfgpth" - sedi 's/timeout_propose = "[0-9]*s"/timeout_propose = "1s"/g' "$cfgpth" - - apppth="$DATA/$chainid/n0/$DAEMON/config/app.toml" - sedi "s#:1317#:$p1317#g" "$apppth" - sedi "s#:9090#:$p9090#g" "$apppth" - done - - for i in ${!IDS[@]}; do - json=${JSONS[$i]} - CLI=$(jq -r .cli $json) - DAEMON=$(jq -r .daemon $json) - CONFIG=${CONFIGS[$i]} - ID=${IDS[$i]} - chainid=$ID - - # Allow the config to override the start command. - DAEMON_HOME="$DATA/$chainid/n0/$DAEMON" - DAEMON_START=$(jq -r '."daemon-start"' "$json") - [[ $DAEMON_START != null ]] || DAEMON_START='$DAEMON --home "$DAEMON_HOME" start --pruning=nothing' - - echo "'$DAEMON start' ($chainid) logs in $LOGS/$ID.log" - ( - eval $DAEMON_START - ) >> "$LOGS/$ID.log" 2>&1 & - done - - echo "Ctrl-C exits, or you can background this script..." - wait - exit 0 - ;; -clients) - source "$NCONFIG" - RELAYER_CONF="$HOME/.relayer" - - set -e - - # Ensure gopath is set and go is installed - GOBIN=${GOBIN-${GOPATH-$HOME/go}/bin} - if [[ ! -d $GOPATH ]] || [[ ! -d $GOBIN ]] || [[ ! -x "$(which go)" ]]; then - echo "Your \$GOPATH is not set or go is not installed," - echo "ensure you have a working installation of go before trying again..." - echo "https://golang.org/doc/install" - exit 1 - fi - - # Ensure user understands what will be deleted - if [[ -d $RELAYER_CONF ]] && [[ "$1" != "skip" ]]; then - read -p "$progname: will delete $RELAYER_CONF folder. Do you wish to continue? (y/n): " -n 1 -r - echo - if [[ ! $REPLY =~ ^[Yy]$ ]]; then - exit 1 - fi - fi - - ( - cd "$RELAYER_DIR" - rm -rf "$RELAYER_CONF" - - echo "Building Relayer..." - make install - ) - - echo "Generating rly configurations..." - rly config init - rly chains add-dir "$BASEDIR/config/chains" - - sleep 2 - - for i in ${!IDS[@]}; do - ID=${IDS[$i]} - json=${JSONS[$i]} - CLI=$(jq -r .cli $json) - DAEMON=$(jq -r .daemon $json) - chainid=$ID - ( - try=0 - f="$DATA/$chainid/n0/$DAEMON/key_seed.json" - while [[ ! -f $f ]]; do - try=$(( $try + 1 )) - echo "no $f" - echo "$chainid $CLI is not yet ready (try=$try)" - sleep 1 - done - SEED=$(jq -r '.secret' "$f") - echo "Key $(rly keys restore $chainid testkey "$SEED") imported from $chainid to relayer..." - - try=0 - f="$DATA/$chainid/n0/$DAEMON/config/genesis.json" - while [[ ! -f $f ]]; do - try=$(( $try + 1 )) - echo "no $f" - echo "$chainid is not yet ready (try=$try)" - sleep 1 - done - echo "Creating light client for $chainid ($DAEMON)..." - try=0 - while ! rly light init $chainid -f >> "$LOGS/light-$chainid.log" 2>&1; do - try=$(( $try + 1 )) - echo "$chainid light client not yet ready (try=$try)" - sleep 1 - done - try=$(( $try + 1 )) - echo "$chainid light client initialized (try=$try)" - ) & - done - - # Let all our chains initialise. - wait - rly paths add-dir "$BASEDIR/config/paths" - - for i in ${!IDS[@]}; do - ID=${IDS[$i]} - json=${JSONS[$i]} - - CMD=$(jq -r '."post-light-client"' $json) - - [[ $CMD != null ]] || continue - ( - chainid=$ID - eval $CMD - ) & - done - echo "Waiting for clients (Control-C to exit)..." - wait - exit 0 - ;; - -connect) - . "$NCONFIG" - - paths= - for i in ${!SRCS[@]}; do - src=${SRCS[$i]} - dst=${DSTS[$i]} - - path="path-$i" - paths="$paths $path" - echo "Starting 'rly tx conn $path' ($src<>$dst) logs in $LOGS/$path.log" - ( - try=0 - while ! rly tx conn $path --timeout=3s -d >> "$LOGS/$path.log" 2>&1; do - try=$(( $try + 1 )) - echo "$path tx conn not yet ready (try=$try)" - sleep 1 - done - try=$(( $try + 1 )) - echo "$path tx conn initialized (try=$try)" - ) & - done - - wait - echo "===============================" - echo "=== All connections initialized" - for path in $paths; do - tail -1 "$LOGS/$path.log" - done - echo "===============================" - exit 0 - ;; - -relay) - . "$NCONFIG" - - paths= - for i in ${!SRCS[@]}; do - src=${SRCS[$i]} - dst=${DSTS[$i]} - - path="path-$i" - paths="$paths $path" - echo "Starting 'rly tx link $path' ($src<>$dst) logs in $LOGS/$path.log" - ( - try=0 - while ! rly tx link $path --timeout=3s -d >> "$LOGS/$path.log" 2>&1; do - try=$(( $try + 1 )) - echo "$path tx link not yet ready (try=$try)" - sleep 1 - done - try=$(( $try + 1 )) - echo "$path tx link initialized (try=$try)" - - # Run the relayer for future packets. - rly start -d "$path" - ) & - done - - echo "Check the state of the links using 'rly paths list' to see when they are ready..." - echo "(Ctrl-C exits, or you can background this job)" - todo=$paths - while :; do - rly paths list - remaining=$todo - todo= - for path in $remaining; do - if [[ $(rly paths show "$path" --json | jq -r .status.channel) != true ]]; then - todo="$todo $path" - fi - done - if [[ -z $todo ]]; then - break - fi - sleep 5 - done - - echo "All paths initialized, waiting for relayers (Control-C to exit)..." - wait - exit 0 - ;; -run) - mv nchainz/logs nchainz/logs-$(date +%Y%m%dT%H:%M:%S) || true - mkdir -p nchainz/logs - "$0" chains skip & - "$0" clients skip & - wait - exit 0 - ;; -*) - echo 1>&2 "$progname: unrecognized COMMAND \`$COMMAND'" - usage 1 - ;; -esac - -# This is the "init" command: -validate -show_plan - -# Ensure user understands what will be deleted -echo -if [[ -e $BASEDIR ]] && [[ $SKIP != yes ]]; then - read -p "$progname: will delete $BASEDIR folder. Do you wish to continue? (y/n): " -n 1 -r - echo - if [[ ! $REPLY =~ ^[Yy]$ ]]; then - exit 1 - fi -fi - -rm -rf "$BASEDIR" -mkdir -p "$BASEDIR/config/paths" "$BASEDIR/config/chains" "$LOGS" - -echo "creating $NCONFIG" -cat <"$NCONFIG" -# $NCONFIG - $progname configuration script -# DO NOT EDIT - Automatically generated by $progname $args -DATA='$BASEDIR/data' -LOGS='$BASEDIR/logs' -IDS=( $(printf "'%s' " "${IDS[@]}")) -CONFIGS=( $(printf "'%s' " "${CONFIGS[@]}")) -JSONS=( $(printf "'%s' " "${JSONS[@]}")) -SRCS=( $(printf "'%s' " "${SRCS[@]}")) -SRCPORTS=( $(printf "'%s' " "${SRCPORTS[@]}")) -DSTS=( $(printf "'%s' " "${DSTS[@]}")) -DSTPORTS=( $(printf "'%s' " "${DSTPORTS[@]}")) -EOF - -for i in ${!IDS[@]}; do - id=${IDS[$i]} - json=${JSONS[$i]} - p26657=$(( 26657 - $i * 100 )) - out="$BASEDIR/config/chains/$id.json" - echo "creating $out" - jq ".link + { \"chain-id\": \"$id\", \"rpc-addr\": \"http://localhost:$p26657\", \"key\": \"testkey\" }" "$json" \ - > "$out" -done - -for i in ${!SRCS[@]}; do - src=${SRCS[$i]} - srcport=${SRCPORTS[$i]} - - dst=${DSTS[$i]} - dstport=${DSTPORTS[$i]} - - path="path-$i" - out="$BASEDIR/config/paths/$path.json" - echo "creating $out" - cat >"$out" </dev/null 2>&1 && pwd )" -GAIA_DATA="$(pwd)/data" -RELAYER_DIR="$(dirname $SCRIPTDIR)" -RELAYER_CONF="$HOME/.relayer" - -# Ensure gaiad is installed -if ! [ -x "$(which gaiad)" ]; then - echo "Error: gaiad is not installed. Try running 'make build-gaia'" >&2 - exit 1 -fi - -# Display software version for testers -echo "GAIA VERSION INFO:" -gaiad version --long - -# Ensure jq is installed -if [[ ! -x "$(which jq)" ]]; then - echo "jq (a tool for parsing json in the command line) is required..." - echo "https://stedolan.github.io/jq/download/" - exit 1 -fi - -# Ensure user understands what will be deleted -if [[ -d $GAIA_DATA ]] && [[ ! "$1" == "skip" ]]; then - read -p "$(basename $0) will delete \$(pwd)/data and \$HOME/.relayer folders. Do you wish to continue? (y/n): " -n 1 -r - echo - if [[ ! $REPLY =~ ^[Yy]$ ]]; then - exit 1 - fi -fi - -# Delete data from old runs -rm -rf $GAIA_DATA &> /dev/null -rm -rf $RELAYER_CONF &> /dev/null - -# Stop existing gaiad processes -killall gaiad &> /dev/null -killall akash &> /dev/null - -set -e - -chainid0=ibc-0 -chainid1=ibc-1 -chainid2=ibc-2 - -echo "Generating gaia configurations..." -mkdir -p $GAIA_DATA && cd $GAIA_DATA && cd ../ -./scripts/one-chain gaiad $chainid0 ./data 26657 26656 6060 9090 -./scripts/one-chain gaiad $chainid1 ./data 26557 26556 6061 9091 -./scripts/one-chain gaiad $chainid2 ./data 25557 25556 6062 9092 - -[ -f $GAIA_DATA/$chainid0.log ] && echo "$chainid0 initialized. Watch file $GAIA_DATA/$chainid0.log to see its execution." -[ -f $GAIA_DATA/$chainid1.log ] && echo "$chainid1 initialized. Watch file $GAIA_DATA/$chainid1.log to see its execution." -[ -f $GAIA_DATA/$chainid2.log ] && echo "$chainid2 initialized. Watch file $GAIA_DATA/$chainid2.log to see its execution." - -cd $RELAYER_DIR - -echo "Building Relayer..." -make install - -echo "Generating rly configurations..." -rly config init -rly chains add-dir configs/three/chains - -SEED0=$(jq -r '.mnemonic' $GAIA_DATA/ibc-0/key_seed.json) -SEED1=$(jq -r '.mnemonic' $GAIA_DATA/ibc-1/key_seed.json) -SEED2=$(jq -r '.mnemonic' $GAIA_DATA/ibc-2/key_seed.json) -echo "Key $(rly keys restore ibc-0 testkey "$SEED0") imported from ibc-0 to relayer..." -echo "Key $(rly keys restore ibc-1 testkey "$SEED1") imported from ibc-1 to relayer..." -echo "Key $(rly keys restore ibc-2 testkey "$SEED2") imported from ibc-2 to relayer..." - -rly paths add-dir configs/three/paths diff --git a/scripts/two-chainz-akash b/scripts/two-chainz-akash deleted file mode 100755 index c6fa1318f..000000000 --- a/scripts/two-chainz-akash +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash -# two-chainz creates two gaiad chains and configures the relayer to - -SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -GAIA_DATA="$(pwd)/data" -RELAYER_DIR="$(dirname $SCRIPTDIR)" -RELAYER_CONF="$HOME/.relayer" - -# Ensure gaiad is installed -if ! [ -x "$(which gaiad)" ]; then - echo "Error: gaiad is not installed. Try running 'make build-gaia'" >&2 - exit 1 -fi - -# Ensure akash is installed -if ! [ -x "$(which akash)" ]; then - echo "Error: akash is not installed. Try running 'make build-akash'" >&2 - exit 1 -fi - -# Display software version for testers -echo "GAIA VERSION INFO:" -gaiad version --long - -echo "AKASH VERSION INFO:" -akash version --long - -# Ensure jq is installed -if [[ ! -x "$(which jq)" ]]; then - echo "jq (a tool for parsing json in the command line) is required..." - echo "https://stedolan.github.io/jq/download/" - exit 1 -fi - -# Ensure user understands what will be deleted -if [[ -d $GAIA_DATA ]] && [[ ! "$1" == "skip" ]]; then - read -p "$(basename $0) will delete \$(pwd)/data and \$HOME/.relayer folders. Do you wish to continue? (y/n): " -n 1 -r - echo - if [[ ! $REPLY =~ ^[Yy]$ ]]; then - exit 1 - fi -fi - -# Delete data from old runs -rm -rf $GAIA_DATA &> /dev/null -rm -rf $RELAYER_CONF &> /dev/null - -# Stop existing gaiad processes -killall gaiad &> /dev/null -killall akash &> /dev/null - -set -e - -chainid0=ibc-0 -chainid1=ibc-1 - -echo "Generating chain configurations..." -mkdir -p $GAIA_DATA && cd $GAIA_DATA && cd ../ -./scripts/one-chain gaiad $chainid0 ./data 26657 26656 6060 9090 -./scripts/one-chain akash $chainid1 ./data 26557 26556 6061 9091 - -[ -f $GAIA_DATA/$chainid0.log ] && echo "$chainid0 (gaiad) initialized. Watch file $GAIA_DATA/$chainid0.log to see its execution." -[ -f $GAIA_DATA/$chainid1.log ] && echo "$chainid1 (akash) initialized. Watch file $GAIA_DATA/$chainid1.log to see its execution." - -cd $RELAYER_DIR - -echo "Building Relayer..." -make install - -echo "Generating rly configurations..." -rly config init -rly chains add-dir configs/akash/chains - -SEED0=$(jq -r '.mnemonic' $GAIA_DATA/ibc-0/key_seed.json) -SEED1=$(jq -r '.mnemonic' $GAIA_DATA/ibc-1/key_seed.json) -echo "Key $(rly keys restore ibc-0 testkey "$SEED0") imported from ibc-0 to relayer..." -echo "Key $(rly keys restore ibc-1 testkey "$SEED1") imported from ibc-1 to relayer..." - -rly paths add-dir configs/akash/paths diff --git a/scripts/two-chainz-wasmd b/scripts/two-chainz-wasmd deleted file mode 100755 index 412a8a9fd..000000000 --- a/scripts/two-chainz-wasmd +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash -# two-chainz creates two wasmd chains and configures the relayer to - -SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -WASMD_DATA="$(pwd)/data" -RELAYER_DIR="$(dirname $SCRIPTDIR)" -RELAYER_CONF="$HOME/.relayer" - -# Ensure wasmd is installed -if ! [ -x "$(which wasmd)" ]; then - echo "Error: wasmd is not installed. Try running 'make build-wasmd'" >&2 - exit 1 -fi - -# Display software version for testers -echo "WASMD VERSION INFO:" -wasmd version --long - -# Ensure jq is installed -if [[ ! -x "$(which jq)" ]]; then - echo "jq (a tool for parsing json in the command line) is required..." - echo "https://stedolan.github.io/jq/download/" - exit 1 -fi - -# Ensure user understands what will be deleted -if [[ -d $WASMD_DATA ]] && [[ ! "$1" == "skip" ]]; then - read -p "$(basename $0) will delete \$(pwd)/data and \$HOME/.relayer folders. Do you wish to continue? (y/n): " -n 1 -r - echo - if [[ ! $REPLY =~ ^[Yy]$ ]]; then - exit 1 - fi -fi - -# Delete data from old runs -rm -rf $WASMD_DATA &> /dev/null -rm -rf $RELAYER_CONF &> /dev/null - -# Stop existing wasmd processes -killall wasmd &> /dev/null - -set -e - -chainid0=ibc-0 -chainid1=ibc-1 - -echo "Generating wasmd configurations..." -mkdir -p $WASMD_DATA && cd $WASMD_DATA && cd ../ -./scripts/one-chain wasmd $chainid0 ./data 26657 26656 6060 9090 -./scripts/one-chain wasmd $chainid1 ./data 26557 26556 6061 9091 - -[ -f $WASMD_DATA/$chainid0.log ] && echo "$chainid0 initialized. Watch file $WASMD_DATA/$chainid0.log to see its execution." -[ -f $WASMD_DATA/$chainid1.log ] && echo "$chainid1 initialized. Watch file $WASMD_DATA/$chainid1.log to see its execution." - -cd $RELAYER_DIR - -echo "Building Relayer..." -make install - -echo "Generating rly configurations..." -rly config init -rly chains add-dir configs/wasmd/chains - -SEED0=$(jq -r '.mnemonic' $WASMD_DATA/ibc-0/key_seed.json) -SEED1=$(jq -r '.mnemonic' $WASMD_DATA/ibc-1/key_seed.json) -echo "Key $(rly keys restore ibc-0 testkey "$SEED0") imported from ibc-0 to relayer..." -echo "Key $(rly keys restore ibc-1 testkey "$SEED1") imported from ibc-1 to relayer..." - -rly paths add-dir configs/wasmd/paths \ No newline at end of file