4

Let's say I wanted to store an entire article or a manifest on the Tezos blockchain. Something that is bigger than 100kB. How would I go about doing that?

2
  • I am well aware that you for any useful app would store hashes of data/strings, and big amounts of data do not belong on any public blockchain. This is however, a one-time project that is made for aesthetical reasons, not to create a well-functioning app. Hence the question. – Thorkil Værge Sep 4 '20 at 14:38
  • You should provide more details in order to receive a proper technical answer, though there is general agreement it is not a best practice to put all this data on the blockchain. In particular, do you mean at contract origination (not possible), do you mean for contract to read it on invocation (not possible), how do you want to access it later – cousinit Sep 4 '20 at 18:36
3

You actually answered the question in the comments, but for those who don't read comments:

There are two limitations:

  1. max_operation_data_length: 16384 bytes
  2. hard_storage_limit_per_operation: 60000 bytes

This means that you can't send more than ~16KB per transaction, so the only way is to split the "really long string" into chunks and store those chunks in lazy storage (bigmap).


Or, as @FFF mentioned, you might want to store large data somwhere else and store its hash(+link) in the blockchain

1
  • Thank you for the clear answer. This is excellent. So the data structure would be big_map(nat, string), where each string can maximum be around 16kB. Reading from this storage could then be done by trying the keys 0 to N, until the empty result was returned. – Thorkil Værge Sep 7 '20 at 11:17
2

You shouldn't do it. It's very expensive and a total waste of resources.

What you can definitely do is store a hash of your string or a ipfs address for example (which is more or less the same).

8
  • Thanks for your considerations but you are not answering my question. Your consideration is better suited as a comment than an answer. – Thorkil Værge Sep 4 '20 at 13:20
  • That being said, for any serious/useful app, I fully and wholeheartedly agree with you. But this is something different, where aesthetics is the main purpose ... – Thorkil Værge Sep 4 '20 at 13:45
  • I agree with the answer, with a string of this size, the gas storage limit would be exceeded very quickly. You can find more information here => tezos.stackexchange.com/questions/2183/… – Claude Barde Sep 4 '20 at 14:00
  • Then I can store the big string through multiple operations, and store each part of the string in a big_map, adding 16kB or 60kB in each transaction. – Thorkil Værge Sep 4 '20 at 14:05
  • 1
    I've just tried on KT1M4hGQa7YdYBi7ovBkoWVouHGPtDKR7r9b on Delphinet, a contract that doubles its string several times and we get a storage exhausted operation. You can see block BMNwN31Rggxy8aHsMgk7kekcV7KRDNdK7p5EyyRopGvRpsHucop on smartpy.io/… with delphinet.smartpy.io. The big map would work. – FFF Sep 4 '20 at 16:37

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.