Generate a Session Key
Generate the key
Make the request from your VM (where your validator node container is running) using the following command:
curl -X 'POST' \
-H "Content-Type: application/json" \
-d '{"id":1, "jsonrpc":"2.0", "method": "author_rotateKeys", "params":[]}' http://localhost:9944
Copy the key from the response:
{"jsonrpc":"2.0","result":"0xf22d82cfcf4402990a0bef3abefd1e58217ff3a86c548d30f1495fd529460d76","id":1}
In this case, the key is:
"0xf22d82cfcf4402990a0bef3abefd1e58217ff3a86c548d30f1495fd529460d76"
Associate your session key with your validator account
Open the Developer tab, and click Extrinsics, there you'll need to submit the following extrinsic
Developer -> Extrinsics -> session -> setKeys(keys, proof)
NOTE
You can use any peaq endpoint to submit setKeys sxtrinsic, including the endpoint from your VM with validator node.
- Paste your session key into the
aura: SpConsensusAuraSr25519AppSr25519Public field
- Paste 0x00 into the field
proof: Bytes
- Click
Submit Transaction
NOTE
After using setKeys
extrinsic, you can connect back to the public endpoint.
Double-check that your session key is associated with your wallet address
Open the Developer tab, and click Chain state. There, you'll need to submit the following state query:
- Developer → Chain state → Session → nextKeys
- Toggle the switch
include option
and select your validator address in theAccountId32
field. - Click the
+
button. - Confirm that your key is displayed.
Remove unsafe rpc methods from your node
Remove --unsafe-rpc-external
and --rpc-methods=unsafe
methods, which we needed in the beginning, and rerun the container.
sudo docker run -d -v peaq-storage:/chain-data -p 9944:9944 peaq/parachain:peaq-v0.0.102 \
--collator \
--parachain-id 3338 \
--chain ./node/src/chain-specs/peaq-raw.json \
--base-path chain-data \
--port 30333 \
--rpc-port 9944 \
--rpc-cors=all \
--execution=wasm \
--out-peers 50 \
--in-peers 50 \
-- \
--execution wasm \
--port 30343 \
--sync fast \
--rpc-port 9977