This script helps you upload your validator's metadata and image to IPFS, then update the StakeManager contract on Polygon with the new metadata URI.
- Validator private key from file:
./test-chain-5/consensus/validator.keyin your validator node installation directory. - Polygon funds: Some $POL (MATIC) in the validator wallet
- Node.js: v18.20.x
- npm
- Switch to Node 18
nvm use 18-
Configure environment
- Update the
.envfile in the project root - Set your Polygon RPC endpoint (or use the default public RPC provided)
- Update the
-
Add your validator image
- Place a
PNGimage (256ร256px) in this directory alongside the script - Example:
my-logo.png
- Place a
-
Install dependencies
npm installRun the updateValidatorInfo.js script with the following arguments:
node updateValidatorInfo.js <VALIDATOR_PRIVATE_KEY> "<VALIDATOR_NAME>" "<METADATA_JSON_OR_EMPTY>" <PATH_TO_VALIDATOR_IMAGE>
<VALIDATOR_PRIVATE_KEY>: Your node's private key (hex string)<VALIDATOR_NAME>: A descriptive name for your validator (wrapped in quotes)<METADATA_JSON_OR_EMPTY>: Any additional metadata as a JSON string, or" "for none<PATH_TO_VALIDATOR_IMAGE>: Path to your 256ร256 PNG image
node updateValidatorInfo.js c9617b2f1dabf9f5501eba795008f587ecab164aeb31217a7b76448d62157209 "My Validator Node" " " ./my-logo.pngThis project is licensed under the MIT License. Feel free to use and modify it as you see fit.