Validator Management
Initialize an L1's ValidatorManager and register new L1 validators
Two scripts exercise the L1's ValidatorManager contract — the on-chain component that tracks an L1's validator set. Run them in order: add-validator.ts assumes validator-manager-setup.ts has already initialized the manager.
Prerequisites
Boot a local network and build the contracts first:
pnpm run up # writes .interchain-kit/artifacts/network.json
forge build --root contracts # produces contracts/out/*.jsonadd-validator.ts also spawns a fresh AvalancheGo node, so it needs AVALANCHEGO_PATH set.
Run both scripts from the repo root — tmpnetjs walks up from your current directory to find .interchain-kit/ and contracts/out/.
1. Set Up the Validator Manager
pnpm --filter @interchain-kit/examples run validator-manager-setupThis script:
- Deploys a real
ValidatorManagerimplementation. - Upgrades the genesis proxy (pre-allocated at
0xfacade…) to point at it and runsinitialize(settings). - Calls
initializeValidatorSetso the bootstrap validator fromConvertSubnetToL1Txis reflected on-chain. - Prints
isValidatorSetInitialized, the total weight, and the validator list.
2. Add a Validator
AVALANCHEGO_PATH=$HOME/avalanchego/build/avalanchego pnpm --filter @interchain-kit/examples run add-validatorThis script:
- Spawns a fresh AvalancheGo node (on port
10750) tracking the L1's subnet, then reads its NodeID + BLS proof of possession. - Runs the SDK's
registerL1Validatorflow: EVM-initiate → signature aggregator → P-ChainRegisterL1ValidatorTx→ signature aggregator ACK → EVM-complete. - Verifies the new validator on both the L1's
ValidatorManagerand the P-Chain validator set.
The spawned node keeps running
add-validator.ts leaves the new validator node running so it can keep validating. Use pnpm run down (and pnpm run clean) to stop everything when you're done.
Next Steps
Is this guide helpful?