I am trying to get list events by filter for specific account(validator, nominator).

I can get list of events using api.query.system.events(). However, if I get events for a day, there will be much events.

So, I want to filter events by specific account.

How can I do it?

1 Answer 1


The events are stored on chain as a Vec<EventRecord> - this means that when you make a query (either for latest or for a specific blockHash), that you would get set for that specific block. The RPCs itself has no filtering mechanism, it simply returns what is available in the state.

With this in mind, any filtering would need to be performed once the Vec is returned, which mean on the client side. Additionally, since each runtime is different and events are specific to a pallet, specific per-account filtering is also left up to the client. The RPC returns really views this as "opaque", it just returns the data in the state, specific records are only understandable alongside the metadata.

With this in mind, what you can do is to filter for the specific events you are interested in. As an example using the JS API and looking at balances.Deposit events -

// retrieve all events
const all = await api.query.system.events();

// filter the balances.Deposit events
const deposits = all.filter(({ event }) =>

// display the recipient & amounts
for (let i = 0; i < deposits.length; i++) {
  const [recipient, amount] = deposits.event.data;

  console.log(recipient.toString() + ' received ' + amount.toString());

For each specific event type you are interested in, you would need to -

  • check for the specific event
  • extract the parameters as per the event specification

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.