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
    Commented Dec 2, 2019 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
    Commented Dec 3, 2019 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
    Commented Dec 4, 2019 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
    Commented Dec 4, 2019 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
    Commented Dec 5, 2019 at 9:46

2 Answers 2


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


If you are using the RPC you have to query all the block ids since the origination of the contract and collect the big_map_diff's from the contract's applied transactions. This is a slow process so you will need to store this data. This amounts to building an indexer around the contract.

The internal structure form the block RPC looks like this:

        [ { /* update */
            "action": "update",
            "big_map": $bignum,
            "key_hash": $script_expr,
            "key": $micheline.007-PsDELPH1.michelson_v1.expression,
            "value"?: $micheline.007-PsDELPH1.michelson_v1.expression }
          || { /* remove */
               "action": "remove",
               "big_map": $bignum }
          || { /* copy */
               "action": "copy",
               "source_big_map": $bignum,
               "destination_big_map": $bignum }
          || { /* alloc */
               "action": "alloc",
               "big_map": $bignum,
               "key_type": $micheline.007-PsDELPH1.michelson_v1.expression,
               "value_type": $micheline.007-PsDELPH1.michelson_v1.expression } ... ]

If you are not interested in building an indexer, a more practical approach is using the Better Call Dev API. There is a route /bigmap/{network}/{ptr}/keys which takes the network name and the big map id and returns the big map keys. It also has a few options that let you see the big map keys at a particular block height.

You can see an example in their UI: Dexter tzBTC/XTZ liquidity providers.

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.