I have Staking Rewarded event.

I can get stash address and reward amount from it.

How to use api.events.staking.Rewarded.is to get nominator reward?

How can I get validator address and era from event?

So, I can get know which validator did payout for which era.

  • What have you tried? How did you get the event? What technology are you coding in? E.g. What do you get when you console.debug(event.toJSON()).
    – DerekC
    Commented Dec 23, 2022 at 15:30
  • Using PolkadotJS, it says in the question is using this code example to get the event: substrate.stackexchange.com/a/5181/2762
    – Alex Bean
    Commented Dec 23, 2022 at 15:45
  • I got events from api.query.system.events() and when I log event, {"phase":{"applyExtrinsic":2},"event":{"index":"0x0601","data":["HALCY1MaPw6e2TeBjFg8DuABy9aWef6udFPdFnHiwXLkK2U",874758234]},"topics":[]}. There are two things in data, one is stash address, the other one is reward amount.
    – Heindrick
    Commented Dec 23, 2022 at 15:59

1 Answer 1


You can get the era of that event because you have the block hash where that event occurs:

const at = await api.at(blockHash);
const era = await at.query.staking.activeEra();

If you want the set of validators in that moment:

const validators = await at.query.session.validators();

If you want to see the list of the rewards for that eras:

const erasValidatorReward = await api.query.staking.erasRewardPoints(numberOfEra);
  • I know in which era event is produced. What I want to know is, which era's reward is triggered. According to my example, this reward event is produced in 4576. And 4575 era's reward is given to nominator. I want to get this 4575 value from event.
    – Heindrick
    Commented Dec 23, 2022 at 18:35
  • Would you like to join chat.stackexchange.com/rooms/133964/substrate-and-polkadot? @alexbean
    – Heindrick
    Commented Dec 23, 2022 at 19:19
  • Sorry, not sure I get it. In your example you have the era event 4576 and you want to get the 4575 era's reward ?
    – Alex Bean
    Commented Dec 27, 2022 at 11:35
  • My example Rewarded event was created in Era 4576. And this is 4575 era's reward. So, 4575 era's reward is paid to nominator in 4576 era. kusama.subscan.io/…. Please check top row. Era shows 4575, and event ID is 15836105-348. This block number is created in 4576,
    – Heindrick
    Commented Dec 27, 2022 at 11:42

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.