2

How do you discover the indexes of the big maps of a contract? It seems you would have to inspect the storage, and correlate with the type of the storage, and pick out the numbers that correspond to big_maps. Not so fun to do programmatically.

  • Why? For example, consider a contract with storage (pair (big_map %debits address tez) (big_map %credits address tez)). Why do you want to know which big_maps they are, without knowing which is which? – Tom Dec 2 '19 at 13:29
  • Consider the following use case: I want to write a script that 1) originates a contract with big_maps and then 2) query these big maps. Between step 1 and 2, I will have to obtain the storage of the originated contract, parse it and pick out the integers that corresponds to indices. If there was an RPC / client command that lists the big_maps of a contract and their indices, then this task would be simplified. – arvidj Dec 3 '19 at 13:44
  • Why query the maps without knowing which is which? I guess you intend discover which is which by e.g. examining the (typically different looking) data in the maps? – Tom Dec 4 '19 at 14:47
  • Motivation aside, you answered your own question, in my opinion. The way to find the big_maps is to look for them in the storage value. Because big_maps have no 'tag' in the Micheline (like Big_map 1), this means you need to consider the storage type, in order to distinguish the big_maps from other values which are encoded as integers. Unless you are willing to delegate this task to someone else (like tzstats), that's it, I think. – Tom Dec 4 '19 at 14:56
  • Consider the case where there is only one big_map in the contract. The method i described works, of course. What I'm asking for is a simpler way. Users can interact with the node directly using RPCs. But there is also the more user-friendly tezos-client. It would not be absurd to want such a feature in the client. – arvidj Dec 5 '19 at 9:46
4

The tezos-client and tezos-node RPC have no such feature.

If you don't mind using an API other then the node RPC you can find this in the new version of the tzstats indexer (GET /explorer/contract/{hash} returns an object with a key bigmap_ids which is an array) see https://api.babylonnet.tzstats.com/explorer/contract/KT1E5toJrALhVPuKpHWTbRVjgEvWWR98sVKj for an example, the id is also part of the decoded/unboxed storage endpoint at https://api.babylonnet.tzstats.com/explorer/contract/KT1E5toJrALhVPuKpHWTbRVjgEvWWR98sVKj/storage

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.