0

I'm very new to Etherium. I have a dapp requirement to store 40 key / value pairs for each of our customers.

I was thinking to create a contract that had a mapping between addresses and an array of structs. The address keys being for each of our customers and the array of structures storing key value pairs.

The data will be frequently read and infrequently updated.

When updates occur they will be done by the customers, either adding a new keypair or modifying / deleting an exisiting one.

There could potentially be hundreds of thousands of customers.

My question is, would this be a suitable data structure?

Specifically, would the gas fee payable by a customer to update a key / value pair increase with the number of customers / records stored?

If the answer to that question is yes and the structure is prohibitive, is there another suggested pattern I should look into?

This post is similar however I didn't see a clear answer for this specific question.

Thanks very much for your help! :-)

3
  • Hi DamienSawyer! Welcome to Ethereum Stackexchange! Do you really need the data on the blockchain? If you don't need the data on-chain I'd suggest storing data off-chain and only submitting a fingerprint on-chain.
    – Ismael
    Nov 10, 2021 at 13:58
  • Hi. That could work, but in essense it's still the same question. If we stored a fingerprint of users' 80 pieces of data (40 keypairs) then we reduce storage by (roughly approx) 80 times. However, 1000 users vs 80000 users affects data quantity by the same amount. I'm trying to get my head around the economics of Eth, specifically if costs increase with the amount of data in a single contract. Thanks :-) Nov 10, 2021 at 19:50
  • For more data you could use a merkle tree or similar structure.
    – Ismael
    Nov 10, 2021 at 23:07

0

Your Answer

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

Browse other questions tagged or ask your own question.