New answers tagged

1

The main benefit of big_maps with respect to maps is that the gas costs of big_map operations don't depend on the number of elements stored in the big_map. Regarding storage size, when you store a key-value mapping in a big_map, you store the value but not the key; instead you store the hash of the key. This hash always takes exactly 32 bytes. The rest of ...


2

big_map is extremely expensive. It allows you to put as much data as you want in the contract, but you end up paying more in counterpart. Check this example: It produces 2 identical contacts, one uses a map and the other uses a big map. import smartpy as sp class MyContract(sp.Contract): def __init__(self, **kargs): self.init(**kargs) @sp....


1

You have 2 solutions for this problem: Use an indexer to get the values contained in the big map; Use an off-chain view to paginate the values if they can be accessed sequentially Off-chain example: Code with tests: https://smartpy.io/ide?cid=QmNeBqAbS4yotpDpdv7SPb7G3a3aHZpEoeKyzHnGuMHtcT&k=cb7d23e3d4856e707cba Explorer: https://tzcomet.io/#/explorer%...


0

The recommended way is to use an indexer API to fetch all the active key/value bindings in the big map. Querying the values one by one using their associated keys may be fine if you have a few entries but is going to be extremely slow when your big map starts to grow.


Top 50 recent answers are included