I am currently working on a project implementation on the ethereum blockchain and had to create big structs with nearly 200 attributes. I want to know if that would make handling those structs more expensive (with respect to time and gas). If so, is there any way I can mitigate the effects of the size of the structs?

I know about IPFS and how it helps manipulate large data files when using ethereum blockchain, but I want to know if there is any other solution that I may have missed.

Thank you.


If your contract doesn't need to do calculations on the data, store it on IPFS and only keep the IPFS address in the contract.

If it isn't practical to use IPFS, for example because you need to ensure that all users have access to the data, store it in the event logs along with its hash, and store the hash in contract storage.

If your contract does need to do calculations on the data, it may be cheaper to store the data in event logs or IPFS, with only its hash in contract storage, and have users resupply the data needed to recreate that hash when you need to access the data.

  • 1
    I also thought about the data needed for calculations being the decisive variable to think about. I did start with IPFS because i didn't know about it before, but i still can't find any good tutorial about it, it would be nice if you can link me to one. Feb 14 '18 at 7:33

Saving big data in ethereum is costly. So I'll recommend to save into off chain and maintain state changes in eth.

I feel struct and json almost same structure.

Use ipfs sdk to upload json, once its success save the same into contract. When you want to perform some operation like retrieve data then get the value from contract get the json.

If you want to perform some calculation then you need to save data in onchain.

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.