8

Starting a PoS network, I realised that my local node requires keys to start producing blocks. Unlike in test networks where I could simply pass --alice and have the validator keys inserted into the keystore and start block production, how do I go about doing it for a different account? In PoS we have controller and stash accounts, so if I am going to insert my keys like this :

./target/release/node-template key insert --base-path /tmp/node01 \
--chain customSpecRaw.json \
--scheme Sr25519 \
--suri <your-secret-seed> \
--password-interactive \
--key-type babe

whose suri should this be? Stash? Controller? Or just my regular seed from which I have derived both stash and controller addresses?

2 Answers 2

3

The authority key is neither the controller nor the stash key.

What you call authority key, is actually called session key. Such a session key can be changed once per session. For the genesis you need to specify the keys of the genesis authorities. You only specify the public key in the chain spec. This public key should be unique and not belong to the stash or controller. How you generate the public key is up to you, as long as you use the correct crypto.

6
  • To start my node at genesis, I would have to insert the keys into the keystore right to produce blocks. Only then can I generate session keys with a call to rotate_keys(). How do I make sure then that my original secret keys are removed from my validator's keystore? Commented Apr 5, 2022 at 5:21
  • 1
    There is no automatic way. The keystore is just a directory on your file system. So, you can just delete the old keys.
    – bkchr
    Commented Apr 5, 2022 at 9:19
  • any way to generate session keys with subkey or do we have to run a node for it? Commented Apr 5, 2022 at 14:40
  • For sure you can subkey. Just generate a private public key as you would do it for an on chain account. The only thing you need to take care of is that you are using the correct crypto :)
    – bkchr
    Commented Apr 5, 2022 at 15:37
  • I'm afraid I don't understand. The keys I get from rotate_keys is usually a long string of keys. Do you mean if I have 4 session keys in my struct I have to generate 4 keys (with correct Crypto) and concatenate them in the same order as defined? Commented Apr 6, 2022 at 4:46
7

You should create a new identity/keys each node.

The actual "controller" or "Authority" are defined in the chains genesis block. You can see an example of this in the substrate node template:
https://github.com/substrate-developer-hub/substrate-node-template/blob/main/node/src/chain_spec.rs

For information on how to create keys for your nodes:
https://docs.substrate.io/tutorials/v3/private-network/#generate-your-own-keys

1
  • So the controller account of any staker acts as an authority? Or can the controller be a derived account from some secret just as staker would be? Commented Apr 4, 2022 at 6:40

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.