I want to know, that storing JSON data in Blockchain is good idea or we can get some error? Beacuse if we enter all our data in struct we get "InternalCompilerError: Stack too deep, try removing local variables". Using Solidty compiler 0.4.26. By the way in blockchain have any limitation in string length? and how many bytes blockchain can store? Thank you very much for your answers! Cincerly, Mike!
1 Answer
No you should not store lots of data in Ethereum. Mostly because it gets very expensive. Here are some reference numbers: What is the cost to store 1KB, 10KB, 100KB worth of data into the ethereum blockchain?
Ethereum is not meant for storing large amount of data. What is typically done, is that you store the data somewhere else (for example IPFS or just your local hard drive) and store its hash value in Ethereum - then you can later prove which document generates that hash value and that the document hasn't been altered.
Otherwise, in theory, a string can store any amount of data: https://ethereum.stackexchange.com/questions/50241/is-there-a-solidity-string-limit-of-32-bytes#:~:text=A%20variable%20of%20type%20bytes32,a%20string%20of%20any%20size . But a contract size is also limited to 24kB: How big could a contract be?
Also you should update your Solidity version - the newest version is around 0.8.1.
-
Thanks, Lauri Peltonen! but how to work with 0.8.1. Just could you send me some info about working with converting storage to memory types. Thank you. Feb 1, 2021 at 10:04