tzgo
tzgo copied to clipboard
GetBigmapKeys returns empty array
Hi,
First, thanks for this awesome library. This actually saves me a lot of time.
I use the library to interact my contract on granadanet network. Everything goes well expects the call GetBigmapKeys
. It returns an empty array. However, when I use the API (https://api.granadanet.tzkt.io/v1/bigmaps/165079/keys) to get the keys, it actually returns values.
I trace a bit to the library and find that the RPC call returns empty array without an error. Is this because this API endpoint is deprecated or I do use it in a wrong manner. I try to find answer around but can not get it so I create this issue to seek you help.
Look forward to get back from you. Thanks for your patient and this library.
This seems to be an undesirable side-effect of changes in Hangzhou. TzGo uses an internal (undocumented) endpoint into the raw blockchain context /chains/main/blocks/head/context/raw/json/big_maps/index/165079/contents
which used to list all active keys but returns an empty list now.
The issue with these kinds of internal RPC calls is that there is no means to limit the amount of data returned or page through the result. Very large bigmaps would take too long to query and return too much data to efficiently use in production.
The only meaningful way is to use an indexer API like TzStats or TzKt to list bigmap keys/values in a scalable way. We have a second Go library to connect to TzStats here: https://github.com/blockwatch-cc/tzstats-go