0

How can I index the substrate storage maps of pallets and ipfs content of cids, to have filters and build custom search queries?

Is it a good idea to use subxt for querying storage through rpc from the blockchain and putting it in a database?

Not sure if I can use indexing services like hydra or subquery to do that.

1 Answer 1

3

Subxt is geared around interacting with the tip of a chain, and will run into issues trying to obtain and index older entries (and will need custom metadata to be provided to go back through older blocks that use V14 metadata, too).

If you want to index the storage in a chain more fully, I'd probably suggest looking into using Polkadot.js directly or a higher level interface like https://github.com/paritytech/substrate-api-sidecar offhand (which is already used for accessing and indexing older blocks and so should be up to the task.

3
  • I was looking at doing it using rust, fetching raw storage data of desired format from rpc and feeding it to any database I like. If possible can this feature be build on subxt? Commented Feb 9, 2023 at 19:52
  • I don't need the index of older entries that has been updated, only storage map data during latest block . But the problem is when blockchain goes to next block I have to refetch all data again to check if any data is updated, if it would be possible to only add new data based on subscribed event. Commented Feb 9, 2023 at 20:28
  • Block events will be enough I think to get the id of storage map, and knowing data update, delete or new data entry. Commented Feb 9, 2023 at 20:39

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.