Is there a way to convert from Big_map to map ? (Use case : send the storage to another contract that need to parse it)

1 Answer 1


Hmm, the only way I can think of is to iterate through your big map and copy each individual entry into a map. This means you have a way to easily retrieve all the keys within your big map (for instance it is easy if the big map is based on an incremental index key and you store the last index). However, be cautious about gas exhaustion if the big map is too extensive; you might need to process it in chunks. I’m not sure if there’s an alternative method.

But it doesn't work for arbitrary key. I am wondering what should be the best practice there. Store the data as a map, i.e. more expensive storage and less conveniant usage (big_map have special access on indexers) or ask the Michelson team to add a cast.

I don’t think casting is possible as the big map structure doesn’t hold the information that a map need. If you have arbitrary keys, you can maybe store these arbitrary keys in another big_map. You will end-up with two big maps.

type storage = {
   data : (arbitrary_key_type, data_type) big_map;
   indexer : (nat, arbitrary_key_type) big_map;
   index_max: nat;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.