Last active
May 11, 2023 14:04
-
-
Save dzianisv/838a98dc18a0ba419ce6100ea1ceba1b to your computer and use it in GitHub Desktop.
Register Cosmos Consumer Chain Validator
This file contains hidden or 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
| #!/bin/bash | |
| set -euo pipefail | |
| `` | |
| OS=$(uname -s) | |
| ARCH=$(uname -m) | |
| require_gaiad() { | |
| if command -v gaiad &> /dev/null; then | |
| return 0 | |
| fi | |
| # Check if curl is installed | |
| if ! command -v curl &> /dev/null | |
| then | |
| echo "curl could not be found, trying to install..." | |
| if [ "$OS" = "Linux" ]; then | |
| sudo apt-get update | |
| sudo apt-get install -y curl | |
| elif [ "$OS" = "Darwin" ]; then | |
| brew install curl | |
| fi | |
| fi | |
| # Download the correct binary | |
| if [ "$OS" = "Linux" ]; then | |
| if [ "$ARCH" = "x86_64" ]; then | |
| curl -LO https://github.com/cosmos/gaia/releases/download/v9.1.0/gaiad-v9.1.0-linux-amd64 | |
| sudo install -m 0755 gaiad-v9.1.0-linux-amd64 /usr/local/bin/gaiad | |
| else | |
| echo "Unsupported architecture." | |
| return 1 | |
| fi | |
| elif [ "$OS" = "Darwin" ]; then | |
| if [ "$ARCH" = "x86_64" ]; then | |
| curl -LO https://github.com/cosmos/gaia/releases/download/v9.1.0/gaiad-v9.1.0-darwin-amd64 | |
| install -m 0755 gaiad-v9.1.0-darwin-amd64 /usr/local/bin/gaiad | |
| else | |
| echo "Unsupported architecture." | |
| return 1 | |
| fi | |
| else | |
| echo "Unsupported operating system." | |
| return 1 | |
| fi | |
| } | |
| require_gaiad | |
| echo -n "Input a Neutron validator key: " | |
| read KEY | |
| exec gaiad tx provider assign-consensus-key neutron-1 '$KEY' --from ledger --ledger --keyring-backend=test --chain-id=cosmoshub-4 --node=https://cosmos-rpc.polkachu.com --gas-prices=0.025uatom --gas-adjustment=3.0 --gas=auto --output=json --yes |
This file contains hidden or 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
| #!/bin/bash | |
| set -euo pipefail | |
| if [[ -z "${NEUTRON_VALIDATOR_KEY:-}" ]]; then | |
| echo "Set NEUTRON_VALIDATOR_KEY" | |
| exit 1 | |
| fi | |
| VERSION=v9.1.0 | |
| DOCKER_IMAGE=gaiad:$VERSION | |
| cat << EOF > gaiad.Dockerfile | |
| FROM golang:1.18.5-alpine3.16 | |
| RUN apk add --no-cache make git libc-dev bash gcc linux-headers eudev-dev vim bind-tools | |
| RUN git clone https://github.com/cosmos/gaia /gaia | |
| WORKDIR /gaia | |
| RUN git checkout tags/$VERSION && make install | |
| EOF | |
| docker build -f gaiad.Dockerfile -t "$DOCKER_IMAGE" . | |
| docker run -ti --rm -v $(pwd):$(pwd) -w $(pwd) "$DOCKER_IMAGE" bash -c "\ | |
| echo Importing an account; \ | |
| gaiad keys add account1 --recover --home .gaia && \ | |
| gaiad tx provider assign-consensus-key neutron-1 '$NEUTRON_VALIDATOR_KEY' --home .gaia --from ledger --ledger --keyring-backend=test --chain-id=cosmoshub-4 --node=https://cosmos-rpc.polkachu.com --gas-prices=0.025uatom --gas-adjustment=3.0 --gas=auto --output=json --yes" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment