3

In this video Joe Petrowski demonstrates a command which allows us to set a stake and also choose a reward destination. But unfortunately some of the command gets obscured by their video picture.

As I've narrowed it down, I require a step-by-step procedure that shows us

  • How to use polkadot-api-cli to sign and submit a session key (set session keys)
  • The command for how to set validator prefernces i.e call staking.validate/chill

Edit #1 : I may have figured out how to set validator prefs: I get a json response with : yarn run:api --seed .. tx.staking.validate '["30", false]' --ws ..

However, I don't see a commission set to 30%. I've tried it with 30 and "30" both. I've also tried putting the second arg "No" instead of false and both seemed to work. However I'd like to set the commission % properly.

2 Answers 2

6

So here's the answer: To validate using polkadot-cli-api you need three things:

  1. Create a controller/stash pair and then tell your chain that they are a controller/stash pair using staking.bond
  2. State your intention to validate
  3. Generate session keys and insert them into your keystore.

You can use signer also, but I'll write for api.

--ws will take in the websocket address of your node for example --ws "ws://127.0.0.1:9944"

--seed will take the seed used to sign the transaction

  1. api --account <Stash account> --seed <stash seed> --ws <ws endpoint> tx.staking.bond <Controller bs58 address> <Amount to bond> <Payee destination>

  2. api --account <Controller account> --seed <controller seed> --ws <ws endpoint> tx.staking.validate '[<Commission in parts per billion>, <boolean to allow for nominations>]'

  3. api --account <Controller> --seed ... --ws .... tx.session.setKeys <Input from author_rotateKeys()> 0x

If you follow these steps you'll be able to validate without access to a GUI.

4
+50

Looks like you figured it out! I haven't used that CLI in a while.

And you mentioned it in the details, but commission is a PerBill. So 30% would be 300_000_000.

1
  • Yes indeed. I had trouble with it when I gave a % instead of a Perbill. Apr 22 at 11:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.