5

I've added Staking to substrate-node-template and just explored the feature. I've managed to add validators and nominators and it looks like everything is working well.

One thing I'm not able to figure out is how the rewards are being distributed. I've been watching the events at the end of every era and it looks like only Staking.EraPaid is being fired.

From what I understand from the discussion here, What does the Staking.EraPaid event mean? , I should be getting the events Staking.PayoutStarted and Staking.Rewarded as well.

I guess I'm trying to figure out the following

  1. Which pallet is actually distributing the rewards? pallet_election_provider_multi_phase or pallet_staking
  2. Is there anything I need to define for the Payouts to happen?
2
  • pallet-staking is in charge to distributing the awards, and it does so using a staking-reward-curve that's defined in the documentation. As far as Payouts are concerned, an extrinsic needs to be fired before payouts can occur so I am not sure if that is default behaviour because from my experience, I don't remember seeing EraPaid at the end of every era. Mar 24, 2022 at 5:25
  • @Purple_Turtle I see. I do see the EraPaid event at the end of every era though. But, nothing else.
    – Kanishka
    Mar 24, 2022 at 5:54

1 Answer 1

4

So, validators are paid proportionally to the amount of era points they have collected. Payments occur at the end of every era.

  • end_era triggers the payout for the finished era.

  • do_payout_stakers for checking out how the payment calculation starts so validators get fraction of the era reward that belongs to the validator and which part of the reward goes to its nominators, between other things.

  • make_payout where the payments to stakers are done.

If you check those methods you will see that the interesting events to follow, and very well pointed out in the linked discussion are PayoutStarted and Rewarded

Now, nominators, as @Purple_Turtle mentions, need to call payout_stakers so all nominators behind a specific validator get their rewards. This can be called by anyone, and triggers do_payout_stakers mentioned above.

2
  • Thank you for the detailed explanation! I was using polkadot.js.org/apps and the balances weren't being updated. We checked it in substrate-front-end-template and we could see the payouts.
    – Kanishka
    Mar 24, 2022 at 12:19
  • 1
    Keep in mind that the front_end_template is a very minimal front_end, and you will laverage much more by using polkadot.js apps directly connected to your node Mar 24, 2022 at 12:34

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.