regen-ledger
regen-ledger copied to clipboard
Specification for Postgres Indexer
For indexing ORM Modules in Cosmos SDK to postgres.
Maybe get architectural review from Ethan.
For a proof of concept Postgres indexer, I propose we start with some proof of concept credit metadata as outlined in #178.
Then we could either poll tendermint for new blocks or use websockets to listen for specific events, see: https://docs.tendermint.com/master/rpc/
The basic way I see this working is:
- we receive an event, ex.
EventCreateBatch
- run the corresponding query to get all the data, ex.
Query/BatchInfo
-
INSERT
orUPDATE
corresponding tables in postgres, ex.batch_info
. In postgres, however, maybe thebatch_info
table could also have columns forpolygon
and dates as specified in #178 when those can be parsed from metadata
I don't think this is necessarily a substitute for listening at the store level as Ian is working on, but I think it can work for now.
What do you think @robert-zaremba ?