3

I don't want to keep my keys on the server. I am concerned with best practices whenever it comes to running anything on the cloud, and as such, if I am running a validator node, I realise that I need to provide my keys or at least sign session keys and insert it into the keystore. Can someone show me the best way to go about this?

  1. Generate a stash/controller pair from a secret seed on local machine. Done.
  2. Start a node on a cloud instance with --validator flag. Done.
  3. Generate session keys by calling rotateKeys() like so : curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "author_rotateKeys", "params":[]}' http://localhost:9933. Done.
  4. How to sign this key and insert it into the keystore?
  5. Anything else that's required for the block production/validation to begin?

Edit #1 : I see this tool https://github.com/polkadot-js/tools/tree/master/packages/signer-cli for signing messages offline. Can it be used to sign a session key and send it to the chain keystore? Can someone show how if this is indeed possible?

1 Answer 1

3

You can insert the pre-generated session keys to the node by calling rpc author_insertKey. However you will need to take care of the encoding of the keys, since the content of the session keys in different chains may vary. I would suggest to insert the key with Polkadot.js. Here's an example:

https://github.com/Phala-Network/khala-parachain/blob/main/scripts/js/insert_session_key.js

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.