2

I want to be able to get all the validators on the network, not just the active ones.

api.query.session.validators() only gets validators in the active set, how can I get every validator in existence?

2 Answers 2

1

enter image description here

It might be api.query.staking.validators(). But this is a map. You might need to iterate it.

1
  • 1
    To complete this answer: const entries = await api.query.staking.validators.entries(); const validators = entries.map(([key]) => { return key.args.map((k) => k.toHuman()); });
    – James
    Dec 17, 2022 at 5:32
0

Completing @AurevoirXavier's answer, the plan is to add this functionality to API Sidecar once this PR is merged.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.