Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions api/env.sh
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# shellcheck shell=bash
URL="127.0.0.1:9650"
5 changes: 4 additions & 1 deletion api/health.health.sh
Original file line number Diff line number Diff line change
@@ -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"
3 changes: 2 additions & 1 deletion api/info.getNetworkID.sh
Original file line number Diff line number Diff line change
@@ -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"
3 changes: 2 additions & 1 deletion api/info.getNetworkName.sh
Original file line number Diff line number Diff line change
@@ -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"
5 changes: 3 additions & 2 deletions api/info.getNodeID.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
3 changes: 2 additions & 1 deletion api/info.getVMs.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/bash

# shellcheck source=env.sh
source env.sh

curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"info.getVMs",
"params" :{}
}' -H 'content-type:application/json;' ${URL}/ext/info
}' -H 'content-type:application/json;' "${URL}/ext/info"
5 changes: 3 additions & 2 deletions api/info.isBootstrapped.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "{
Expand All @@ -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"
39 changes: 17 additions & 22 deletions api/info.peers.sh
Original file line number Diff line number Diff line change
@@ -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 .

5 changes: 4 additions & 1 deletion api/metrics.sh
Original file line number Diff line number Diff line change
@@ -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"
6 changes: 6 additions & 0 deletions api/peers.conf
Original file line number Diff line number Diff line change
@@ -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"]'
5 changes: 3 additions & 2 deletions api/platform.getBlockchainStatus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "{
Expand All @@ -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"
3 changes: 2 additions & 1 deletion api/platform.getBlockchains.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/bash

# shellcheck source=env.sh
source env.sh

curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"platform.getBlockchains",
"params" :{}
}' -H 'content-type:application/json;' ${URL}/ext/P
}' -H 'content-type:application/json;' "${URL}/ext/P"
5 changes: 3 additions & 2 deletions api/platform.getCurrentValidators.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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\",
Expand All @@ -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"
5 changes: 3 additions & 2 deletions api/platform.getPendingValidators.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"

Expand All @@ -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"
5 changes: 3 additions & 2 deletions api/platform.getSubnets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"

Expand All @@ -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"
4 changes: 3 additions & 1 deletion api/platform.getValidatorsAt.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

# shellcheck source=env.sh
source env.sh
SUBNET_ID="$1"

curl -X POST --data "{
Expand All @@ -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"
4 changes: 3 additions & 1 deletion api/platform.validatedBy.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

# shellcheck source=env.sh
source env.sh
BLOCKCHAIN_ID="$1"

curl -X POST --data "{
Expand All @@ -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"
4 changes: 3 additions & 1 deletion api/platform.validates.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

# shellcheck source=env.sh
source env.sh
SUBNET_ID="$1"

curl -X POST --data "{
Expand All @@ -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"

24 changes: 0 additions & 24 deletions chains/install-subnet-cli.sh

This file was deleted.

67 changes: 2 additions & 65 deletions chains/update-validator-mainnet.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"

Loading