My function performs a write operation for each "Player" struct in my dapp.

However, I don't want to exceed the gas limit for the transaction.

Is there an upper limit to the number of writes I can make per tx?

For instance, how many structs can I edit per tx, just writing one uint256 per struct?


In mainnet the gas limit is around 6,7M. In the worst case the cost store 32 bytes to an unused storage address is 20000 gas, at that price you can write 335 times 32 bytes, around 10 KBytes.

But if you overwrite an existing storage address it will be cheaper 5000 gas instead. You will be able to execute 1340 writes to the store or around 40 KBytes.

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.