diff --git a/.gitignore b/.gitignore index 0bbd89e..e9df4f4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .subnet-cli.pk +rpc/__pycache__/ diff --git a/README.md b/README.md index c207e4b..9ff3493 100644 --- a/README.md +++ b/README.md @@ -342,7 +342,7 @@ Before validation staking expires, any wallet can not stake to a validator again Validator version distributions: [mainnet](https://explorer-xp.avax.network/validators), [testnet](https://explorer-xp.avax-test.network/validators) -[Renew Numbers Validators](https://app.asana.com/0/1202305127727547/1202919355642524/f) (internal task) +Renew Numbers Validators (see internal task tracker) ## Import Existing L1 in Avalanche CLI @@ -461,7 +461,7 @@ Notes 1. When upgrading node, you need to upgrade EVM and plugins as well. - > [jpop32 — 05/12/2021](https://discord.com/channels/578992315641626624/757576823570825316/841775940706762762) + > [Community discussion — 05/12/2021](https://discord.com/invite/numprotocol) > Plugin is the part of the installation. And it has to be upgraded along with the main executable, yes. Since `avalanchego v1.9.6`, there are two breaking changes @@ -950,4 +950,4 @@ Make a Full Node instance to be an Archive Node instance: --data '{"method":"debug_traceTransaction","params":["0x7d2dec6c3e7ce2a387d988a0603ce7de6d487d6aeaf6b58eabdb123161cee0a2"],"id":1,"jsonrpc":"2.0"}' ``` - [Discord discussion](https://discord.com/channels/578992315641626624/905684871731634196/1026850988042244247) + [Discord discussion](https://discord.com/invite/numprotocol) diff --git a/api/env.sh b/api/env.sh index bbb7296..950717b 100644 --- a/api/env.sh +++ b/api/env.sh @@ -1 +1,2 @@ +set -euo pipefail URL="127.0.0.1:9650" diff --git a/api/health.health.sh b/api/health.health.sh index f1c51d2..959506e 100755 --- a/api/health.health.sh +++ b/api/health.health.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail curl -X POST --data '{ "jsonrpc":"2.0", diff --git a/api/info.getNetworkID.sh b/api/info.getNetworkID.sh index bfcdb81..8d169b6 100755 --- a/api/info.getNetworkID.sh +++ b/api/info.getNetworkID.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail source env.sh diff --git a/api/info.getNetworkName.sh b/api/info.getNetworkName.sh index 4a3b144..d3023a3 100755 --- a/api/info.getNetworkName.sh +++ b/api/info.getNetworkName.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail source env.sh diff --git a/api/info.getNodeID.sh b/api/info.getNodeID.sh index e3c6c95..282dc22 100755 --- a/api/info.getNodeID.sh +++ b/api/info.getNodeID.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail # # Pre-running a node on Chainstake # diff --git a/api/info.getVMs.sh b/api/info.getVMs.sh index af97938..9ea760d 100755 --- a/api/info.getVMs.sh +++ b/api/info.getVMs.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail source env.sh diff --git a/api/info.isBootstrapped.sh b/api/info.isBootstrapped.sh index 2940dfd..64695fe 100755 --- a/api/info.isBootstrapped.sh +++ b/api/info.isBootstrapped.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail # # 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/ diff --git a/api/info.peers.sh b/api/info.peers.sh index 7fa32b2..895e5dd 100755 --- a/api/info.peers.sh +++ b/api/info.peers.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail # Snow echo "========== Snow nodes information ==========" diff --git a/api/metrics.sh b/api/metrics.sh index a527772..5678da7 100755 --- a/api/metrics.sh +++ b/api/metrics.sh @@ -1,3 +1,4 @@ #!/bin/bash +set -euo pipefail curl -X POST 127.0.0.1:9650/ext/metrics diff --git a/api/platform.getBlockchainStatus.sh b/api/platform.getBlockchainStatus.sh index e6b1c25..19d064b 100755 --- a/api/platform.getBlockchainStatus.sh +++ b/api/platform.getBlockchainStatus.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail # # { # "id": "fdesjrz477ot2iuUKdrGUephzHEfMN6AayMaWGXxhnZfkGRYr", diff --git a/api/platform.getBlockchains.sh b/api/platform.getBlockchains.sh index 66ef57b..3b2e62a 100755 --- a/api/platform.getBlockchains.sh +++ b/api/platform.getBlockchains.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail source env.sh diff --git a/api/platform.getCurrentValidators.mainnet.sh b/api/platform.getCurrentValidators.mainnet.sh index fba79f6..07c0098 100755 --- a/api/platform.getCurrentValidators.mainnet.sh +++ b/api/platform.getCurrentValidators.mainnet.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail # # 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/ diff --git a/api/platform.getCurrentValidators.sh b/api/platform.getCurrentValidators.sh index 0e0f743..934033b 100755 --- a/api/platform.getCurrentValidators.sh +++ b/api/platform.getCurrentValidators.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail # # 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/ diff --git a/api/platform.getPendingValidators.sh b/api/platform.getPendingValidators.sh index 8c9402d..e22ec5f 100755 --- a/api/platform.getPendingValidators.sh +++ b/api/platform.getPendingValidators.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail # # 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/ diff --git a/api/platform.getSubnets.sh b/api/platform.getSubnets.sh index 3fde414..27d7447 100755 --- a/api/platform.getSubnets.sh +++ b/api/platform.getSubnets.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail # # 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/ diff --git a/api/platform.getValidatorsAt.sh b/api/platform.getValidatorsAt.sh index 66ee968..9983740 100755 --- a/api/platform.getValidatorsAt.sh +++ b/api/platform.getValidatorsAt.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail SUBNET_ID="$1" diff --git a/api/platform.validatedBy.sh b/api/platform.validatedBy.sh index 236114c..d50f0b8 100755 --- a/api/platform.validatedBy.sh +++ b/api/platform.validatedBy.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail BLOCKCHAIN_ID="$1" diff --git a/api/platform.validates.sh b/api/platform.validates.sh index a41d4a7..153a9a1 100755 --- a/api/platform.validates.sh +++ b/api/platform.validates.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail SUBNET_ID="$1" diff --git a/chains/backup-validator.sh b/chains/backup-validator.sh index a690c58..8ecf490 100755 --- a/chains/backup-validator.sh +++ b/chains/backup-validator.sh @@ -1,4 +1,5 @@ #!/bin/sh +set -eu # Backup Avalanche validator diff --git a/chains/devnet/README.md b/chains/devnet/README.md new file mode 100644 index 0000000..a061e9d --- /dev/null +++ b/chains/devnet/README.md @@ -0,0 +1,21 @@ +# DEVELOPMENT ONLY + +> ⚠️ **WARNING**: This directory contains devnet (development network) configuration files. Do NOT use these files for production (mainnet/testnet) deployments. + +## Chain ID + +- **Devnet chain ID**: `10509` +- **Testnet chain ID**: `10508` +- **Mainnet chain ID**: `10507` + +Verify the chain ID in deployment scripts before proceeding. Using the wrong genesis file could result in funds allocated to the wrong address or network. + +## Token Allocation + +The devnet genesis allocates a large token balance for development and testing purposes only. This allocation is intentionally disproportionate and must never be used in production. + +## Files + +| File | Description | +|------|-------------| +| `genesis.json` | Devnet genesis configuration (DEVELOPMENT ONLY, chain ID 10509) | diff --git a/chains/install-subnet-cli.sh b/chains/install-subnet-cli.sh index 9b01c83..fa25f1a 100755 --- a/chains/install-subnet-cli.sh +++ b/chains/install-subnet-cli.sh @@ -1,3 +1,5 @@ +#!/bin/bash +set -euo pipefail VERSION=0.0.2 # Populate latest here GOARCH=$(go env GOARCH) diff --git a/chains/update-validator-mainnet.sh b/chains/update-validator-mainnet.sh index f740697..e41f455 100755 --- a/chains/update-validator-mainnet.sh +++ b/chains/update-validator-mainnet.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail AVALANCHEGO_PREVIOUS_VERSION="1.10.7" AVALANCHEGO_VERSION="1.10.11" @@ -24,8 +25,16 @@ download_sunbet_evm() { update_subnet_evm() { echo "Step: update_subnet_evm" + EXPECTED_CHECKSUM="$(curl -sL https://github.com/ava-labs/subnet-evm/releases/download/v${SUBNET_EVM_VERSION}/subnet-evm_${SUBNET_EVM_VERSION}_checksums.txt | grep "subnet-evm_${SUBNET_EVM_VERSION}_linux_amd64.tar.gz" | awk '{print $1}')" + ACTUAL_CHECKSUM="$(sha256sum subnet-evm_${SUBNET_EVM_VERSION}_linux_amd64.tar.gz | awk '{print $1}')" + if [ "${EXPECTED_CHECKSUM}" != "${ACTUAL_CHECKSUM}" ]; then + echo "ERROR: Checksum mismatch for subnet-evm tarball. Aborting installation." + echo " Expected: ${EXPECTED_CHECKSUM}" + echo " Actual: ${ACTUAL_CHECKSUM}" + exit 1 + fi + echo "Checksum verified: ${ACTUAL_CHECKSUM}" 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() { diff --git a/chains/update-validator-testnet.sh b/chains/update-validator-testnet.sh index 6f2c22d..ef3f6f6 100755 --- a/chains/update-validator-testnet.sh +++ b/chains/update-validator-testnet.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail AVALANCHEGO_PREVIOUS_VERSION="1.10.7" AVALANCHEGO_VERSION="1.10.11" @@ -24,8 +25,16 @@ download_sunbet_evm() { update_subnet_evm() { echo "Step: update_subnet_evm" + EXPECTED_CHECKSUM="$(curl -sL https://github.com/ava-labs/subnet-evm/releases/download/v${SUBNET_EVM_VERSION}/subnet-evm_${SUBNET_EVM_VERSION}_checksums.txt | grep "subnet-evm_${SUBNET_EVM_VERSION}_linux_amd64.tar.gz" | awk '{print $1}')" + ACTUAL_CHECKSUM="$(sha256sum subnet-evm_${SUBNET_EVM_VERSION}_linux_amd64.tar.gz | awk '{print $1}')" + if [ "${EXPECTED_CHECKSUM}" != "${ACTUAL_CHECKSUM}" ]; then + echo "ERROR: Checksum mismatch for subnet-evm tarball. Aborting installation." + echo " Expected: ${EXPECTED_CHECKSUM}" + echo " Actual: ${ACTUAL_CHECKSUM}" + exit 1 + fi + echo "Checksum verified: ${ACTUAL_CHECKSUM}" 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() { diff --git a/genesis/README.md b/genesis/README.md new file mode 100644 index 0000000..84e126f --- /dev/null +++ b/genesis/README.md @@ -0,0 +1,21 @@ +# Genesis Files + +This directory contains historical and reference genesis configurations for the Numbers Network. The canonical genesis files reside in `chains//`. + +## Chain IDs + +| Network | Chain ID | +|---------|----------| +| Mainnet | `10507` | +| Testnet | `10508` | +| Devnet | `10509` | + +## Files + +| File | Network | Chain ID | Description | +|------|---------|----------|-------------| +| `genesis.json` | Testnet | 10508 | Base testnet genesis configuration | +| `genesis-nativecoin-feemgr.json` | Testnet | 10508 | Testnet genesis with native coin minter and fee manager | +| `genesis-nativecoin-feemgr-feerecv.json` | Testnet | 10508 | Testnet genesis with native coin minter, fee manager, and fee receiver | + +> ⚠️ These files use the **testnet** chain ID (10508). For production deployments, always use the genesis files in `chains/mainnet/`. Verify the chain ID before deploying. diff --git a/rpc/rpc_test.py b/rpc/rpc_test.py index c3561e8..2f453cc 100644 --- a/rpc/rpc_test.py +++ b/rpc/rpc_test.py @@ -2,6 +2,7 @@ import requests import json +from requests.exceptions import ConnectionError, Timeout, SSLError MAINNET_RPC_URL = "https://mainnetrpc.num.network" @@ -11,14 +12,24 @@ def test_connectivity(rpc_url): + payload = { + "jsonrpc": "2.0", + "method": "web3_clientVersion", + "params": [], + "id": 1 + } try: - response = requests.get(rpc_url) + response = requests.post(rpc_url, json=payload, verify=True) if response.status_code == 200: print("Node is reachable, HTTP Status Code: 200") else: print(f"Node is not reachable, HTTP Status Code: {response.status_code}") - except Exception as e: - print(f"Connection failed, Error: {str(e)}") + except SSLError as e: + print(f"TLS/SSL error: {str(e)}") + except ConnectionError as e: + print(f"Connection failed: {str(e)}") + except Timeout as e: + print(f"Request timed out: {str(e)}") def test_functionality(rpc_url): @@ -30,11 +41,17 @@ def test_functionality(rpc_url): } try: - response = requests.post(rpc_url, json=payload) + response = requests.post(rpc_url, json=payload, verify=True) response_data = response.json() print("RPC request successful, Response Data:", response_data) - except Exception as e: - print(f"RPC request failed, Error: {str(e)}") + except SSLError as e: + print(f"TLS/SSL error: {str(e)}") + except ConnectionError as e: + print(f"RPC request failed, Connection error: {str(e)}") + except Timeout as e: + print(f"RPC request timed out: {str(e)}") + except ValueError as e: + print(f"RPC response parse error: {str(e)}") def test_chain_id(rpc_url, chain_id): @@ -45,11 +62,17 @@ def test_chain_id(rpc_url, chain_id): } try: - response = requests.post(rpc_url, json=payload) + response = requests.post(rpc_url, json=payload, verify=True) response_data = response.json() print("RPC request successful, Response Data:", response_data) - except Exception as e: - print(f"RPC request failed, Error: {str(e)}") + except SSLError as e: + print(f"TLS/SSL error: {str(e)}") + except ConnectionError as e: + print(f"RPC request failed, Connection error: {str(e)}") + except Timeout as e: + print(f"RPC request timed out: {str(e)}") + except ValueError as e: + print(f"RPC response parse error: {str(e)}") if __name__ == '__main__': diff --git a/subnet-cli/install-subnet-cli.sh b/subnet-cli/install-subnet-cli.sh index 9b01c83..fa25f1a 100755 --- a/subnet-cli/install-subnet-cli.sh +++ b/subnet-cli/install-subnet-cli.sh @@ -1,3 +1,5 @@ +#!/bin/bash +set -euo pipefail VERSION=0.0.2 # Populate latest here GOARCH=$(go env GOARCH) diff --git a/subnet-cli/subnet-cli-add-subnet-validator-mainnet.sh b/subnet-cli/subnet-cli-add-subnet-validator-mainnet.sh index 3c12b5d..23b28dc 100755 --- a/subnet-cli/subnet-cli-add-subnet-validator-mainnet.sh +++ b/subnet-cli/subnet-cli-add-subnet-validator-mainnet.sh @@ -1,5 +1,6 @@ #!/bin/bash -# Validator ID source: https://app.asana.com/0/1202305127727547/1202919355642524/f +set -euo pipefail +# Validator ID source: see internal task tracker NODE_ID="NodeID-BXTBUqX8gitUDtVam4fhRWGD1SfeHGoBx" SUBNET_ID="2gHgAgyDHQv7jzFg6MxU2yyKq5NZBpwFLFeP8xX2E3gyK1SzSQ" diff --git a/subnet-cli/subnet-cli-add-subnet-validator-testnet.sh b/subnet-cli/subnet-cli-add-subnet-validator-testnet.sh index e1abefd..97a541f 100755 --- a/subnet-cli/subnet-cli-add-subnet-validator-testnet.sh +++ b/subnet-cli/subnet-cli-add-subnet-validator-testnet.sh @@ -1,5 +1,6 @@ #!/bin/bash -# Validator ID source: https://app.asana.com/0/1202305127727547/1202919355642524/f +set -euo pipefail +# Validator ID source: see internal task tracker NODE_ID="NodeID-A2Z8m7egVLhKf1Qj14uvXadhExM5zrB7p" SUBNET_ID="81vK49Udih5qmEzU7opx3Zg9AnB33F2oqUTQKuaoWgCvFUWQe" diff --git a/subnet-cli/subnet-cli-create-vmid.sh b/subnet-cli/subnet-cli-create-vmid.sh index 3a7fca3..665f3ae 100755 --- a/subnet-cli/subnet-cli-create-vmid.sh +++ b/subnet-cli/subnet-cli-create-vmid.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail # # https://docs.avax.network/subnets/create-a-fuji-subnet-subnet-cli#build-binary diff --git a/subnet-cli/subnet-cli-status-blockchain.sh b/subnet-cli/subnet-cli-status-blockchain.sh index 9a87251..9ae3e12 100755 --- a/subnet-cli/subnet-cli-status-blockchain.sh +++ b/subnet-cli/subnet-cli-status-blockchain.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail # Numbers devnet BLOCKCHAIN_ID="$1" diff --git a/subnet-cli/subnet-cli-wizard-mainnet.sh b/subnet-cli/subnet-cli-wizard-mainnet.sh index 9a8fc89..6ecd736 100755 --- a/subnet-cli/subnet-cli-wizard-mainnet.sh +++ b/subnet-cli/subnet-cli-wizard-mainnet.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail # # --node-ids: If you have multiple nodes, use comma to separate them. # Ex: NodeID-8CGJYaRLChC79CCRnvd7sh5eB9E9L9dVF,NodeID-24WK7qiKXAumya1kKEktwj2ubBbRyq5UW diff --git a/subnet-cli/subnet-cli-wizard.sh b/subnet-cli/subnet-cli-wizard.sh index bdf42e3..9ca7741 100755 --- a/subnet-cli/subnet-cli-wizard.sh +++ b/subnet-cli/subnet-cli-wizard.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail # # --node-ids: If you have multiple nodes, use comma to separate them. # Ex: NodeID-8CGJYaRLChC79CCRnvd7sh5eB9E9L9dVF,NodeID-24WK7qiKXAumya1kKEktwj2ubBbRyq5UW