0

The title is pretty much it. Can I use Polkadot API to stake dot programmatically?

Can't seem to find that in the docs.

1 Answer 1

2

Yes, of course.

You can read the documentation to learn how to submit extrinsics using Polkadot JS API:

https://polkadot.js.org/docs/api/start/api.tx

Then, you just need to submit two extrinsics from the Staking Pallet:

  1. Bond: https://paritytech.github.io/substrate/master/pallet_staking/pallet/enum.Call.html#variant.bond

    This will lock a users funds so they can start to stake as a validator or nominator.

  2. Either:

    1. Nominate: https://paritytech.github.io/substrate/master/pallet_staking/pallet/enum.Call.html#variant.nominate

      If you want to set up the account as a nominator.

    2. Validate: https://paritytech.github.io/substrate/master/pallet_staking/pallet/enum.Call.html#variant.validate

      If you want to set up the account as a validator.

There are more details needed specifically if you are setting up to be a validator which you can learn about here: https://wiki.polkadot.network/docs/maintain-guides-how-to-validate-polkadot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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