Reputation: 59
I would like to add / remove validators from an already existing substrate private network.
Following the tutorial for starting aprivate network, I was able to create a raw customSpec and start a new chain with the validators.
However, I am not sure how to add new / remove old validators to the network. So these are the steps I tried:
I would like to get some pointers as to how to do this properly because I am still unable to set new validators with the steps I have taken.
Thanks!
Upvotes: 1
Views: 973
Reputation: 1405
You have various ways to add/remove validators. Using chain-spec is one of them, but you are on the wrong path trying to apply a runtime upgrade with the spec. A runtime upgrade will typically only update one storage item, :code
, which is the code of your runtime. On the other hand, your validators are stored in other storage items in the pallet_staking
and pallet_session
module. So indeed applying the runtime upgrade will not get you anywhere.
Indeed, if you are fine with restarting your node, you can alter the initial validators and run your chain again, after you have updated your step 1:
edit customSpecs.json to desired validators
To do it on the fly, you need to look into how staking pallet is working. You can bond
new accounts and if the ValidatorCount
is more than the current number of validators, the next election round will elect the new account. Of course, a node with the private key of this newly bonded account must be present in the network for everything to work well. You can use sudo to increase ValidatorCount
.
Upvotes: 4