7

The Goal:

Deploying a Relay Chain with Custom Validator Keys, that a Parachain can start collation successfully.

The Issue:

Using the key subcommand in the Relay, I wasn't able to properly insert the Session Keys to the Relay nodes' keystore.

The Relay with 2 validators was working fine, producing and finalizing blocks, but when I deployed a Parachain it outputted a WARN: collation wasn't advertised to any validator.

And it started to output the WARN for 5 minutes +- until it started to output an error. Finally I haven't found any mention whatsoever in how to do so.

9
  • 1
    I read your comment about using --alice, I think something could be wrong in the chain-spec. Can you trying with zombienet (github.com/paritytech/zombienet) ?
    – pepoviola
    Commented Oct 18, 2022 at 13:14
  • 1
    Deleting the question text makes the post not that valuable :/ please do update or delete yge post completely?
    – Nuke
    Commented Oct 20, 2022 at 22:46
  • 1
    Would you mind providing the solution anytime soon? We have the same issue, asked here: substrate.stackexchange.com/questions/5696/… Commented Nov 4, 2022 at 14:49
  • 1
    I've submitted the solution, soon they'll review and approve so you can solve your problem as well. Commented Nov 7, 2022 at 16:11
  • 1
    Thanks @AlexandreRibeiro đŸ˜»
    – Nuke
    Commented Nov 7, 2022 at 17:32

2 Answers 2

6

The Solution:

After trying a lot of things, I've found from an RPC call that there's 7 keys needed for each Validator node. Those are, gran babe imon para asgn audi beef. And for each key-type there's a scheme, there's a table to reference.

Key-Type Scheme
gran ed25519
babe sr25519
imon sr25519
para sr25519
asgn sr25519
audi sr25519
beef ecdsa

Insert them like this,

./target/release/polkadot key insert \
--base-path <path for this validator> \
--chain <raw relay chainSpec> \
--scheme <see table> \
--suri "<mnemonic of this validator>" \
--key-type <see table>

Pay attention to the base-path you're choosing, you need separate paths for different validators. And to each path, you insert 7 keys using the same validators' private seed.

Parachain Session Keys:

In the Para, run the node and specify a RPC port to make a call later on.

./target/release/<parachain binary> --collator \
--force-authoring \
--chain <raw parachainSpec> \
--base-path /tmp/<para>/<path> \
--port 40333 \
--ws-port 8844 \
--rpc-port 9022 \
--unsafe-ws-external \
--rpc-methods=unsafe \
--rpc-external \
--rpc-cors=all \
-- \
--execution wasm \
--chain relay-raw.json \
--port 30343 \
--ws-port 9977 \
--bootnodes /ip4/<relay bootnode ip>/tcp/30333/p2p/<bootnode peerId>

Using this command as an example, the port open for RPC was 9022 so the insert key call should be:

curl -vH 'Content-Type: application/json' --data '{ "jsonrpc":"2.0", "method":"author_insertKey", "params":["aura", "<private seed in hex>", "<public key in hex>"],"id":1 }' http://127.0.0.1:9022

The private and public key here should be the collator keys. And it's for aura. So it is using the sr25519 scheme.

And it's output:

* Connection #0 to host 127.0.0.1 left intact
{"jsonrpc":"2.0","result":null,"id":1}
1

I think this warning is not related to the session keys. Try add more validators to the relaychain.


And if you are using --alice or something like that. You don't need to insert the key manually. These are well-known keys.


And if you want to insert your custom keys, check the runtime session keys configurations.

https://github.com/paritytech/cumulus/blob/220bc559f064d38485d5a21e2ba91a8a237e9d16/parachain-template/runtime/src/lib.rs#L168-L172

Let's take parachain-template as an example. As you can see from the link, you only need to insert the Aura key.

6
  • When I used the --alice flag on the parachain, I didn't insert the keys manually. I'm saying that, something must be wrong on the Relay Chain side (on the session keys probably?) because I got the same error Collation wasn't advertised to any validator. Commented Oct 18, 2022 at 12:03
  • Did you try adding more validators to the relaychain. If the validators count too low, it won't assign validators to the parachain.
    – aurexav
    Commented Oct 18, 2022 at 14:02
  • Yes, I have tried with 3 validators on the Relay Chain but got the same error. Should I need to insert on the Relay validator nodes any kind/type of keys from my Collator? Commented Oct 18, 2022 at 14:20
  • 1
    No, you don't need to do that.
    – aurexav
    Commented Oct 18, 2022 at 15:02
  • Could you share your relaychain and parachain code?
    – aurexav
    Commented Oct 18, 2022 at 15:03

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.