diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml new file mode 100644 index 0000000..e08e5df --- /dev/null +++ b/.github/workflows/shellcheck.yml @@ -0,0 +1,17 @@ +name: Shell Linting + +on: + push: + pull_request: + +jobs: + shellcheck: + name: ShellCheck + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + + - name: Run ShellCheck + run: find . -name "*.sh" -not -path "./.git/*" | xargs shellcheck --severity=error -x diff --git a/api/env.sh b/api/env.sh index bbb7296..ec146e4 100644 --- a/api/env.sh +++ b/api/env.sh @@ -1 +1,2 @@ +# shellcheck shell=bash URL="127.0.0.1:9650" diff --git a/api/health.health.sh b/api/health.health.sh index f1c51d2..805ad15 100755 --- a/api/health.health.sh +++ b/api/health.health.sh @@ -1,7 +1,10 @@ #!/bin/bash +# shellcheck source=env.sh +source env.sh + curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, "method" :"health.health" - }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/health + }' -H 'content-type:application/json;' "${URL}/ext/health" diff --git a/api/info.getNetworkID.sh b/api/info.getNetworkID.sh index bfcdb81..e6e636c 100755 --- a/api/info.getNetworkID.sh +++ b/api/info.getNetworkID.sh @@ -1,9 +1,10 @@ #!/bin/bash +# shellcheck source=env.sh source env.sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, "method" :"info.getNetworkID" -}' -H 'content-type:application/json;' ${URL}/ext/info +}' -H 'content-type:application/json;' "${URL}/ext/info" diff --git a/api/info.getNetworkName.sh b/api/info.getNetworkName.sh index 4a3b144..ffc6da5 100755 --- a/api/info.getNetworkName.sh +++ b/api/info.getNetworkName.sh @@ -1,9 +1,10 @@ #!/bin/bash +# shellcheck source=env.sh source env.sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, "method" :"info.getNetworkName" -}' -H 'content-type:application/json;' ${URL}/ext/info +}' -H 'content-type:application/json;' "${URL}/ext/info" diff --git a/api/info.getNodeID.sh b/api/info.getNodeID.sh index e3c6c95..3907db4 100755 --- a/api/info.getNodeID.sh +++ b/api/info.getNodeID.sh @@ -5,10 +5,11 @@ # Expected Output # {"jsonrpc":"2.0","result":{"nodeID":"NodeID-JRhJd4Qn4WTjP28RUFDQa2NC59deo7tT6"},"id":1} -URL="127.0.0.1:9650" +# shellcheck source=env.sh +source env.sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, "method" :"info.getNodeID" -}' -H 'content-type:application/json;' ${URL}/ext/info +}' -H 'content-type:application/json;' "${URL}/ext/info" diff --git a/api/info.getVMs.sh b/api/info.getVMs.sh index af97938..38c2903 100755 --- a/api/info.getVMs.sh +++ b/api/info.getVMs.sh @@ -1,5 +1,6 @@ #!/bin/bash +# shellcheck source=env.sh source env.sh curl -X POST --data '{ @@ -7,4 +8,4 @@ curl -X POST --data '{ "id" :1, "method" :"info.getVMs", "params" :{} -}' -H 'content-type:application/json;' ${URL}/ext/info +}' -H 'content-type:application/json;' "${URL}/ext/info" diff --git a/api/info.isBootstrapped.sh b/api/info.isBootstrapped.sh index 2940dfd..4d4dac6 100755 --- a/api/info.isBootstrapped.sh +++ b/api/info.isBootstrapped.sh @@ -3,7 +3,8 @@ # Note: The bootstrapping process takes approximately 50–100 hours and requires 100 GB of space. # https://chainstack.com/avalanche-subnet-tutorial-series-running-a-local-avalanche-node-on-fuji-testnet/ -URL="127.0.0.1:9650" +# shellcheck source=env.sh +source env.sh CHAIN_ID="$1" curl -X POST --data "{ @@ -13,4 +14,4 @@ curl -X POST --data "{ \"chain\":\"${CHAIN_ID}\" }, \"id\": 1 -}" -H 'content-type:application/json;' ${URL}/ext/info +}" -H 'content-type:application/json;' "${URL}/ext/info" diff --git a/api/info.peers.sh b/api/info.peers.sh index 7fa32b2..63cb17d 100755 --- a/api/info.peers.sh +++ b/api/info.peers.sh @@ -1,32 +1,27 @@ #!/bin/bash +# shellcheck source=peers.conf +source peers.conf + # Snow echo "========== Snow nodes information ==========" -curl -X POST --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"info.peers", - "params": { - "nodeIDs": [ - "NodeID-7TwAjiRpTbNcqUx6F9EoyXRBLAfeoQXRq", - "NodeID-JbeonHKqomERomXgCiXr9oC9vfynkBupj", - "NodeID-BffXkmzM8EwrBZgpqFp9pwgE9DbDgYKG2", - "NodeID-24WK7qiKXAumya1kKEktwj2ubBbRyq5UW", - "NodeID-A2Z8m7egVLhKf1Qj14uvXadhExM5zrB7p" - ] +curl -X POST --data "{ + \"jsonrpc\":\"2.0\", + \"id\":1, + \"method\":\"info.peers\", + \"params\": { + \"nodeIDs\": ${SNOW_NODE_IDS} } -}' -H 'content-type:application/json;' https://api.avax-test.network/ext/info | jq . +}" -H 'content-type:application/json;' https://api.avax-test.network/ext/info | jq . # Jade echo "========== Jade nodes information ==========" -curl -X POST --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"info.peers", - "params": { - "nodeIDs": [ - "NodeID-BXTBUqX8gitUDtVam4fhRWGD1SfeHGoBx" - ] +curl -X POST --data "{ + \"jsonrpc\":\"2.0\", + \"id\":1, + \"method\":\"info.peers\", + \"params\": { + \"nodeIDs\": ${JADE_NODE_IDS} } -}' -H 'content-type:application/json;' https://api.avax.network/ext/info | jq . +}" -H 'content-type:application/json;' https://api.avax.network/ext/info | jq . diff --git a/api/metrics.sh b/api/metrics.sh index a527772..00c87a4 100755 --- a/api/metrics.sh +++ b/api/metrics.sh @@ -1,3 +1,6 @@ #!/bin/bash -curl -X POST 127.0.0.1:9650/ext/metrics +# shellcheck source=env.sh +source env.sh + +curl -X POST "${URL}/ext/metrics" diff --git a/api/peers.conf b/api/peers.conf new file mode 100644 index 0000000..3182b29 --- /dev/null +++ b/api/peers.conf @@ -0,0 +1,6 @@ +# shellcheck shell=bash +# Snow (testnet) node IDs +SNOW_NODE_IDS='["NodeID-7TwAjiRpTbNcqUx6F9EoyXRBLAfeoQXRq","NodeID-JbeonHKqomERomXgCiXr9oC9vfynkBupj","NodeID-BffXkmzM8EwrBZgpqFp9pwgE9DbDgYKG2","NodeID-24WK7qiKXAumya1kKEktwj2ubBbRyq5UW","NodeID-A2Z8m7egVLhKf1Qj14uvXadhExM5zrB7p"]' + +# Jade (mainnet) node IDs +JADE_NODE_IDS='["NodeID-BXTBUqX8gitUDtVam4fhRWGD1SfeHGoBx"]' diff --git a/api/platform.getBlockchainStatus.sh b/api/platform.getBlockchainStatus.sh index e6b1c25..47ca617 100755 --- a/api/platform.getBlockchainStatus.sh +++ b/api/platform.getBlockchainStatus.sh @@ -7,7 +7,8 @@ # "vmID": "kmYb53NrmqcW7gfV2FGHBHWXNA6YhhWf7R7LoQeGj9mdDYuaT" # } -URL="127.0.0.1:9650" +# shellcheck source=env.sh +source env.sh BLOCKCHAIN_ID="$1" curl -X POST --data "{ @@ -17,4 +18,4 @@ curl -X POST --data "{ \"blockchainID\":\"${BLOCKCHAIN_ID}\" }, \"id\": 1 -}" -H 'content-type:application/json;' ${URL}/ext/P +}" -H 'content-type:application/json;' "${URL}/ext/P" diff --git a/api/platform.getBlockchains.sh b/api/platform.getBlockchains.sh index 66ef57b..c3b556d 100755 --- a/api/platform.getBlockchains.sh +++ b/api/platform.getBlockchains.sh @@ -1,5 +1,6 @@ #!/bin/bash +# shellcheck source=env.sh source env.sh curl -X POST --data '{ @@ -7,4 +8,4 @@ curl -X POST --data '{ "id" :1, "method" :"platform.getBlockchains", "params" :{} -}' -H 'content-type:application/json;' ${URL}/ext/P +}' -H 'content-type:application/json;' "${URL}/ext/P" diff --git a/api/platform.getCurrentValidators.sh b/api/platform.getCurrentValidators.sh index 0e0f743..12d3f24 100755 --- a/api/platform.getCurrentValidators.sh +++ b/api/platform.getCurrentValidators.sh @@ -3,7 +3,8 @@ # Note: The bootstrapping process takes approximately 50–100 hours and requires 100 GB of space. # https://chainstack.com/avalanche-subnet-tutorial-series-running-a-local-avalanche-node-on-fuji-testnet/ -URL="127.0.0.1:9650" +# shellcheck source=env.sh +source env.sh SUBNET_ID="$1" curl -X POST --data "{ \"jsonrpc\": \"2.0\", @@ -12,4 +13,4 @@ curl -X POST --data "{ \"subnetID\": \"${SUBNET_ID}\" }, \"id\": 1 -}" -H 'content-type:application/json;' ${URL}/ext/bc/P +}" -H 'content-type:application/json;' "${URL}/ext/bc/P" diff --git a/api/platform.getPendingValidators.sh b/api/platform.getPendingValidators.sh index 8c9402d..11f047a 100755 --- a/api/platform.getPendingValidators.sh +++ b/api/platform.getPendingValidators.sh @@ -3,7 +3,8 @@ # Note: The bootstrapping process takes approximately 50–100 hours and requires 100 GB of space. # https://chainstack.com/avalanche-subnet-tutorial-series-running-a-local-avalanche-node-on-fuji-testnet/ -URL="127.0.0.1:9650" +# shellcheck source=env.sh +source env.sh echo "URL: ${URL}" @@ -12,4 +13,4 @@ curl -X POST --data '{ "method": "platform.getPendingValidators", "params": {}, "id": 1 - }' -H 'content-type:application/json;' ${URL}/ext/bc/P + }' -H 'content-type:application/json;' "${URL}/ext/bc/P" diff --git a/api/platform.getSubnets.sh b/api/platform.getSubnets.sh index 3fde414..2d3b670 100755 --- a/api/platform.getSubnets.sh +++ b/api/platform.getSubnets.sh @@ -3,7 +3,8 @@ # Note: The bootstrapping process takes approximately 50–100 hours and requires 100 GB of space. # https://chainstack.com/avalanche-subnet-tutorial-series-running-a-local-avalanche-node-on-fuji-testnet/ -URL="127.0.0.1:9650" +# shellcheck source=env.sh +source env.sh echo "URL: ${URL}" @@ -12,4 +13,4 @@ curl -X POST --data '{ "method": "platform.getSubnets", "params": {}, "id": 1 - }' -H 'content-type:application/json;' ${URL}/ext/bc/P + }' -H 'content-type:application/json;' "${URL}/ext/bc/P" diff --git a/api/platform.getValidatorsAt.sh b/api/platform.getValidatorsAt.sh index 66ee968..7e2f039 100755 --- a/api/platform.getValidatorsAt.sh +++ b/api/platform.getValidatorsAt.sh @@ -1,5 +1,7 @@ #!/bin/bash +# shellcheck source=env.sh +source env.sh SUBNET_ID="$1" curl -X POST --data "{ @@ -10,4 +12,4 @@ curl -X POST --data "{ \"subnetID\": \"${SUBNET_ID}\" }, \"id\": 1 -}" -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P +}" -H 'content-type:application/json;' "${URL}/ext/bc/P" diff --git a/api/platform.validatedBy.sh b/api/platform.validatedBy.sh index 236114c..678d2ae 100755 --- a/api/platform.validatedBy.sh +++ b/api/platform.validatedBy.sh @@ -1,5 +1,7 @@ #!/bin/bash +# shellcheck source=env.sh +source env.sh BLOCKCHAIN_ID="$1" curl -X POST --data "{ @@ -9,4 +11,4 @@ curl -X POST --data "{ \"blockchainID\": \"${BLOCKCHAIN_ID}\" }, \"id\": 1 -}" -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P +}" -H 'content-type:application/json;' "${URL}/ext/bc/P" diff --git a/api/platform.validates.sh b/api/platform.validates.sh index a41d4a7..176edcf 100755 --- a/api/platform.validates.sh +++ b/api/platform.validates.sh @@ -1,5 +1,7 @@ #!/bin/bash +# shellcheck source=env.sh +source env.sh SUBNET_ID="$1" curl -X POST --data "{ @@ -9,5 +11,5 @@ curl -X POST --data "{ \"subnetID\":\"${SUBNET_ID}\" }, \"id\": 1 -}" -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P +}" -H 'content-type:application/json;' "${URL}/ext/bc/P" diff --git a/chains/install-subnet-cli.sh b/chains/install-subnet-cli.sh deleted file mode 100755 index 9b01c83..0000000 --- a/chains/install-subnet-cli.sh +++ /dev/null @@ -1,24 +0,0 @@ -VERSION=0.0.2 # Populate latest here - -GOARCH=$(go env GOARCH) -GOOS=$(go env GOOS) -DOWNLOAD_PATH=/tmp/subnet-cli.tar.gz -DOWNLOAD_URL=https://github.com/ava-labs/subnet-cli/releases/download/v${VERSION}/subnet-cli_${VERSION}_linux_${GOARCH}.tar.gz -if [[ ${GOOS} == "darwin" ]]; then - DOWNLOAD_URL=https://github.com/ava-labs/subnet-cli/releases/download/v${VERSION}/subnet-cli_${VERSION}_darwin_${GOARCH}.tar.gz -fi - -rm -f ${DOWNLOAD_PATH} -rm -f /tmp/subnet-cli - -echo "downloading subnet-cli ${VERSION} at ${DOWNLOAD_URL}" -curl -L ${DOWNLOAD_URL} -o ${DOWNLOAD_PATH} - -echo "extracting downloaded subnet-cli" -tar xzvf ${DOWNLOAD_PATH} -C /tmp - -/tmp/subnet-cli -h - -# OR -# mv /tmp/subnet-cli /usr/bin/subnet-cli -# subnet-cli -h diff --git a/chains/update-validator-mainnet.sh b/chains/update-validator-mainnet.sh index f740697..b14b67e 100755 --- a/chains/update-validator-mainnet.sh +++ b/chains/update-validator-mainnet.sh @@ -1,68 +1,5 @@ #!/bin/bash -AVALANCHEGO_PREVIOUS_VERSION="1.10.7" -AVALANCHEGO_VERSION="1.10.11" -SUBNET_EVM_VERSION="0.5.6" -# Numbers Mainnet -VM_ID="qeX7kcVMMkVLB9ZJKTpvtSjpLbtYooNEdpFzFShwRTFu76qdx" -SUBNET_ID="2gHgAgyDHQv7jzFg6MxU2yyKq5NZBpwFLFeP8xX2E3gyK1SzSQ" - - -download_avalanchego() { - echo "Step: download_avalanchego" - wget https://github.com/ava-labs/avalanchego/releases/download/v${AVALANCHEGO_VERSION}/avalanchego-linux-amd64-v${AVALANCHEGO_VERSION}.tar.gz - tar xzf avalanchego-linux-amd64-v${AVALANCHEGO_VERSION}.tar.gz - cp avalanchego-v${AVALANCHEGO_PREVIOUS_VERSION}/run.sh avalanchego-v${AVALANCHEGO_VERSION}/ -} - -download_sunbet_evm() { - echo "Step: download_sunbet_evm" - mkdir subnet-evm-${SUBNET_EVM_VERSION} - wget https://github.com/ava-labs/subnet-evm/releases/download/v${SUBNET_EVM_VERSION}/subnet-evm_${SUBNET_EVM_VERSION}_linux_amd64.tar.gz - tar xzf subnet-evm_${SUBNET_EVM_VERSION}_linux_amd64.tar.gz -C subnet-evm-${SUBNET_EVM_VERSION} -} - -update_subnet_evm() { - echo "Step: update_subnet_evm" - cp subnet-evm-${SUBNET_EVM_VERSION}/subnet-evm ~/.avalanchego/plugins/${VM_ID} - sha256sum subnet-evm-${SUBNET_EVM_VERSION}/subnet-evm ~/.avalanchego/plugins/${VM_ID} -} - -show_validator_files() { - echo "Step: show_validator_files" - tree avalanchego-v${AVALANCHEGO_VERSION} - tree ~/.avalanchego/plugins/ -} - -show_configs() { - echo "Step: show_configs" - echo "AVALANCHEGO_PREVIOUS_VERSION: ${AVALANCHEGO_PREVIOUS_VERSION}" - echo "AVALANCHEGO_VERSION: ${AVALANCHEGO_VERSION}" - echo "SUBNET_EVM_VERSION: ${SUBNET_EVM_VERSION}" - echo "VM_ID (Mainnet): ${VM_ID}" - echo "SUBNET_ID (Mainnet): ${SUBNET_ID}" -} - -show_next_action_reminder() { - echo "Step: show_next_action_reminder" - echo "Now, you are ready to start the validator" - echo "$ cd ~/avalanchego-v${AVALANCHEGO_VERSION}" - echo "$ ./run.sh" - echo "" - echo "Check validators" - echo "$ cd ~/avalanchego-api-scripts/api" - echo "$ ./platform.getCurrentValidators.sh ${SUBNET_ID} | jq ." - echo "$ ./info.peers.sh | jq ." -} - -main() { - show_configs - download_avalanchego - download_sunbet_evm - update_subnet_evm - show_validator_files - show_next_action_reminder -} - -main +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +exec "${SCRIPT_DIR}/update-validator.sh" --network mainnet "$@" diff --git a/chains/update-validator-testnet.sh b/chains/update-validator-testnet.sh index 6f2c22d..5615ff3 100755 --- a/chains/update-validator-testnet.sh +++ b/chains/update-validator-testnet.sh @@ -1,68 +1,5 @@ #!/bin/bash -AVALANCHEGO_PREVIOUS_VERSION="1.10.7" -AVALANCHEGO_VERSION="1.10.11" -SUBNET_EVM_VERSION="0.5.6" -# Numbers Testnet -VM_ID="kmYb53NrmqcW7gfV2FGHBHWXNA6YhhWf7R7LoQeGj9mdDYuaT" -SUBNET_ID="81vK49Udih5qmEzU7opx3Zg9AnB33F2oqUTQKuaoWgCvFUWQe" - - -download_avalanchego() { - echo "Step: download_avalanchego" - wget https://github.com/ava-labs/avalanchego/releases/download/v${AVALANCHEGO_VERSION}/avalanchego-linux-amd64-v${AVALANCHEGO_VERSION}.tar.gz - tar xzf avalanchego-linux-amd64-v${AVALANCHEGO_VERSION}.tar.gz - cp avalanchego-v${AVALANCHEGO_PREVIOUS_VERSION}/run.sh avalanchego-v${AVALANCHEGO_VERSION}/ -} - -download_sunbet_evm() { - echo "Step: download_sunbet_evm" - mkdir subnet-evm-${SUBNET_EVM_VERSION} - wget https://github.com/ava-labs/subnet-evm/releases/download/v${SUBNET_EVM_VERSION}/subnet-evm_${SUBNET_EVM_VERSION}_linux_amd64.tar.gz - tar xzf subnet-evm_${SUBNET_EVM_VERSION}_linux_amd64.tar.gz -C subnet-evm-${SUBNET_EVM_VERSION} -} - -update_subnet_evm() { - echo "Step: update_subnet_evm" - cp subnet-evm-${SUBNET_EVM_VERSION}/subnet-evm ~/.avalanchego/plugins/${VM_ID} - sha256sum subnet-evm-${SUBNET_EVM_VERSION}/subnet-evm ~/.avalanchego/plugins/${VM_ID} -} - -show_validator_files() { - echo "Step: show_validator_files" - tree avalanchego-v${AVALANCHEGO_VERSION} - tree ~/.avalanchego/plugins/ -} - -show_configs() { - echo "Step: show_configs" - echo "AVALANCHEGO_PREVIOUS_VERSION: ${AVALANCHEGO_PREVIOUS_VERSION}" - echo "AVALANCHEGO_VERSION: ${AVALANCHEGO_VERSION}" - echo "SUBNET_EVM_VERSION: ${SUBNET_EVM_VERSION}" - echo "VM_ID (Testnet): ${VM_ID}" - echo "SUBNET_ID (Testnet): ${SUBNET_ID}" -} - -show_next_action_reminder() { - echo "Step: show_next_action_reminder" - echo "Now, you are ready to start the validator" - echo "$ cd ~/avalanchego-v${AVALANCHEGO_VERSION}" - echo "$ ./run.sh" - echo "" - echo "Check validators" - echo "$ cd ~/avalanchego-api-scripts/api" - echo "$ ./platform.getCurrentValidators.sh ${SUBNET_ID} | jq ." - echo "$ ./info.peers.sh | jq ." -} - -main() { - show_configs - download_avalanchego - download_sunbet_evm - update_subnet_evm - show_validator_files - show_next_action_reminder -} - -main +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +exec "${SCRIPT_DIR}/update-validator.sh" --network testnet "$@" diff --git a/chains/update-validator.sh b/chains/update-validator.sh new file mode 100644 index 0000000..9be930d --- /dev/null +++ b/chains/update-validator.sh @@ -0,0 +1,92 @@ +#!/bin/bash +set -euo pipefail + +AVALANCHEGO_PREVIOUS_VERSION="1.10.7" +AVALANCHEGO_VERSION="1.10.11" +SUBNET_EVM_VERSION="0.5.6" + +# Parse --network argument +NETWORK="" +while [[ $# -gt 0 ]]; do + case "$1" in + --network) + NETWORK="$2" + shift 2 + ;; + *) + echo "Unknown argument: $1" + exit 1 + ;; + esac +done + +if [[ "${NETWORK}" == "mainnet" ]]; then + VM_ID="qeX7kcVMMkVLB9ZJKTpvtSjpLbtYooNEdpFzFShwRTFu76qdx" + SUBNET_ID="2gHgAgyDHQv7jzFg6MxU2yyKq5NZBpwFLFeP8xX2E3gyK1SzSQ" +elif [[ "${NETWORK}" == "testnet" ]]; then + VM_ID="kmYb53NrmqcW7gfV2FGHBHWXNA6YhhWf7R7LoQeGj9mdDYuaT" + SUBNET_ID="81vK49Udih5qmEzU7opx3Zg9AnB33F2oqUTQKuaoWgCvFUWQe" +else + echo "Usage: $0 --network mainnet|testnet" + exit 1 +fi + + +download_avalanchego() { + echo "Step: download_avalanchego" + wget "https://github.com/ava-labs/avalanchego/releases/download/v${AVALANCHEGO_VERSION}/avalanchego-linux-amd64-v${AVALANCHEGO_VERSION}.tar.gz" + tar xzf "avalanchego-linux-amd64-v${AVALANCHEGO_VERSION}.tar.gz" + cp "avalanchego-v${AVALANCHEGO_PREVIOUS_VERSION}/run.sh" "avalanchego-v${AVALANCHEGO_VERSION}/" +} + +download_subnet_evm() { + echo "Step: download_subnet_evm" + mkdir "subnet-evm-${SUBNET_EVM_VERSION}" + wget "https://github.com/ava-labs/subnet-evm/releases/download/v${SUBNET_EVM_VERSION}/subnet-evm_${SUBNET_EVM_VERSION}_linux_amd64.tar.gz" + tar xzf "subnet-evm_${SUBNET_EVM_VERSION}_linux_amd64.tar.gz" -C "subnet-evm-${SUBNET_EVM_VERSION}" +} + +update_subnet_evm() { + echo "Step: update_subnet_evm" + cp "subnet-evm-${SUBNET_EVM_VERSION}/subnet-evm" "${HOME}/.avalanchego/plugins/${VM_ID}" + sha256sum "subnet-evm-${SUBNET_EVM_VERSION}/subnet-evm" "${HOME}/.avalanchego/plugins/${VM_ID}" +} + +show_validator_files() { + echo "Step: show_validator_files" + tree "avalanchego-v${AVALANCHEGO_VERSION}" + tree "${HOME}/.avalanchego/plugins/" +} + +show_configs() { + echo "Step: show_configs" + echo "AVALANCHEGO_PREVIOUS_VERSION: ${AVALANCHEGO_PREVIOUS_VERSION}" + echo "AVALANCHEGO_VERSION: ${AVALANCHEGO_VERSION}" + echo "SUBNET_EVM_VERSION: ${SUBNET_EVM_VERSION}" + echo "NETWORK: ${NETWORK}" + echo "VM_ID: ${VM_ID}" + echo "SUBNET_ID: ${SUBNET_ID}" +} + +show_next_action_reminder() { + echo "Step: show_next_action_reminder" + echo "Now, you are ready to start the validator" + echo "$ cd ~/avalanchego-v${AVALANCHEGO_VERSION}" + echo "$ ./run.sh" + echo "" + echo "Check validators" + echo "$ cd ~/avalanchego-api-scripts/api" + echo "$ ./platform.getCurrentValidators.sh ${SUBNET_ID} | jq ." + echo "$ ./info.peers.sh | jq ." +} + +main() { + show_configs + download_avalanchego + download_subnet_evm + update_subnet_evm + show_validator_files + show_next_action_reminder +} + +main diff --git a/subnet-cli/install-subnet-cli.sh b/subnet-cli/install-subnet-cli.sh index 9b01c83..47537ae 100755 --- a/subnet-cli/install-subnet-cli.sh +++ b/subnet-cli/install-subnet-cli.sh @@ -1,3 +1,5 @@ +#!/bin/bash + VERSION=0.0.2 # Populate latest here GOARCH=$(go env GOARCH)