I am writing a custom gRPC server(not in runtime) and i want to retrieve the public keys of the validators to verify messages signed by them, but i need their public key addresses, how to do that in substrate?

  • What public key do you want? GRANDPA? BABE? Stash?
    – AurevoirXavier
    Commented Nov 13, 2022 at 11:56
  • @AurevoirXavier aura !
    – dadzerlaze
    Commented Nov 13, 2022 at 12:09

1 Answer 1


I think you have the session pallet in your runtime.

PolkadotApps -> chain state -> session -> queuedKeys

enter image description here

If you want to do this in code.

Query the twox128(b"Session") + twox128(b"QueuedKeys").

  • i want to do it in rust though?
    – dadzerlaze
    Commented Nov 13, 2022 at 13:30
  • You could use Subalfred to calculate the storage key. Then query the storage key through rpc use reqwest or whatever you like. Or you could use subxt. Please check its document for more detail.
    – AurevoirXavier
    Commented Nov 13, 2022 at 14:35
  • what do you mean by Sublfred and storage key, ps: i can use subxt
    – dadzerlaze
    Commented Nov 13, 2022 at 14:48
  • 1. Use it to calculate the storage key 2. Pass the storage key to rpc endpint state_getStorage 3. Get the result
    – AurevoirXavier
    Commented Nov 13, 2022 at 14:55

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.