#getEvents for a single ledger
20 messages · Page 1 of 1 (latest)
where would you want to get this from? something needs to ingest, store and index the events by the ledger; then they will be accessible in that fashion.
@shy topaz Does the rpc not expose a method to retrieve events by ledger? this is very different from what other chains does, they usually allow us to query chain data by block height.
does soroban have a sort of archive endpoint that would expose a method to query historical data (mainly events) by ledger?
I don't know what's the plan here honestly, maybe @dreamy jay knows?
It would be pretty cool to have this, if you monitor a lot of (mostly inactive) addresses, the filter does not scale well.
the rpc's getEvents endpoint has the following request args:
type GetEventsRequest struct {
StartLedger int32 json:"startLedger,string,omitempty"
Filters []EventFilter json:"filters"
Pagination *PaginationOptions json:"pagination,omitempty"
}
which would allow you to specify a startLedger.
if you want the latest ledger, you could call getLatestLedger and use that.
But the real design consideration here was to allow the client to process series of ledgers by polling at a lower frequency.
Another advantage is that in case your computer reboots peridodically, it can still sync up without loosing any of the events.
The reason we avoided having a ledger range here was because it would create the expectation that the rpc-server have a long term backing storage. That is NOT the case. The rpc only stores a 24-hour worth of events. Consumers are encouraged to create their own customized data store that would retain the information that they need. That would provide better scaling for the ecosystem, preventing the creation of a huge, long-term, data store.
The filter is limited to five addresses, though
Could you describe the concrete use have you have in mind where you would require high number of addresses ?
@dreamy jay
If I want to build such a data store, where do I get the historical data from if all the RPCs only store events from past 24 hours? wouldn't it be possible only if I start tracking the chain within 24 hours of its creation?
(popular use case for such a data store: explorers)
checking the docs, I see it's updated with a historical archive: https://history-futurenet.stellar.org
I think that you've just pointed out the exact goal of the soroban-rpc : avoid facilitating large and generic data stores that aren't optimal for any particular purpose.
Instead, we would like to direct the development on the Blockchain toward creation of specific - purpose or application specific data store.
The history archives are used for catching up, and are being used by the core nodes - including the captive core used by the rpc.
fair enough, it throws a 403 for me. thanks for the clarifications @dreamy jay