That’s not my point; it would be impractical to get everything in one API call for most all projects. My point was in order to find what you wanted, less calls are needed when working with Event data than Calldata, and therefore searching through past history could be done live (possibly through a few iterations of eth_getLogs
) or through a fast indexing service.
Consider the example: a project creates a protocol that includes users being able to send messages of type A, B, and C, each message having tags that indicate sender, recipient, and some message data.
If built with Events: on a web interface showing a profile for Alice, to display “all messages from Alice”, a single eth_getLogs
call could get it (filtering for any message type, but where sender is Alice’s address) in one call, assuming Alice has sent less than 10,000 messages. A web interface wanting to show all recent activity for the whole project could query the latest 2,000 blocks as a “most recent actions” list, and load more if the user paginates through it.
If built with Calldata: on a web interface showing a profile for Alice, to display “all messages from Alice”, all transactions in all blocks from the launch of the project need to be inspected. There’s not a practical call to get that “live”, unless some custom indexer for the project has done the work already.
Consider creating a custom indexer for that theoretical project, to support a web interface wanting to do more complicated things like “list all messages to or from Alice, and any first-level replies to them”.
If built with Events: all events in transactions from the project’s smart contract need to be inspected and indexed. eth_getLogs
allows querying chunks of 2,000 blocks at a time for all events for the project. That response object is a much smaller payload than all transactions in those 2,000 blocks, so the indexer doesn’t have to iterate over as much data (all the data returned is relevant; no need to filter/cull it first).
If built with Calldata: all transactions that interact with the project’s smart contract need to be parsed. In order to get “all transactions for a contract”, there’s no RPC call for that. The indexing service would need to go by single blocks, using eth_getBlockByNumber
to fetch the block and the transactions in it, iterate over all the transactions and determine if they’re relevant, and then process them.
Am I missing something here that makes it easier to fetch calldata?
I’ve not heard that argument before; on what do you base that claim?
This discussion is about creating a potential standard. That is by its nature abstract, since a standard has a goal of being used by many different projects for different purposes. Standards are foundation layers that if built well, robust applications can be built upon them. “We’re already using it, and end-users like it” is not a stellar reason for a thing to become a standard.