Event Indexing

Smart contract events, also referred to as transaction logs, are used to signal to off-chain applications that a particular action has taken place within the smart contract.

Since the Ethereum blockchain is eventually consistent, and transactions sent to the blockchain are only considered to have been processed once they have been included in a block. A smart contract's state can grow quite large. One of the challenges of interacting with smart contracts is keeping track of the current state of a smart contract.

For example, the ERC20 token standard defines a balanceOf(address owner) returns (uint256) method for a given input address, but does not dictate how those balances are to be stored or computed. On a token smart contract with hundreds of thousands or millions of balances holders, it is impractical to call getBalance() for all accounts on every block.

MultiBaas implements a general solution called Event Queries, which allow a user to define a set of events and how they should be enumerated or aggregated, such as a list of balances or the most recent status per address.

Event Queries

Click blockchain Blockchain, then Event Queries. Event Queries are comprised of one or more events, select fields from those events, and filters that determine which events are used for the Event Query. Fields in a particular event can optionally be aggregated with one or more aggregator. Event Queries with aggregators defined can then be grouped by the field that is not aggregated. For example, if the tokenID field is not configued with an aggregator, it can be used to group by data returned from the Event Query.

Event Queries can be saved and executed, or generated and executed ad hoc by using the MultiBaas API or SDKs.

Create an event query

To create a new Event Query, click on the plus button on the top left sidebar.

Add an new event

To add an event to an Event Query, click the plus icon on the right side of Events. Select or type to filter for a named event.


Add event fields

Click on Add Event Field button and choose event an field from the drop down menu. This includes fields that are actual event parameters, along with related meta fields such as the smart contract address, transaction hash, and timestamp. Fields can be aliased to a different name, and aggregated in a number of different ways. If an aggregator is set on any field in the event query, then all fields but one must have an aggregator set.


Group by (optional)

  • Group by : The field under which to aggregate the results. This should be the one field that does not have an aggregator set.
  • Order by : The field by which the results should be ordered, by default ascending.
  • Order : This field is used with Order By to order the results in a specific order, and is one of DESC or ASC for descending and ascending, respectively


Add event filter

Click on Add Event Field and specify one or more multi-layered filters for each event to control what event data is evaluated as part of the Event Query.


Copyright © Curvegrid 2022. All right reserved.