standard ICO function which exchanges Ether to ERC20 token balance.

Call 1, used 49431: https://ropsten.etherscan.io/tx/0x6671c8fd39d195b09868d914d80f0e884e42259c7346b69afb483f2e18fae263

Call 2, used 34431: https://ropsten.etherscan.io/tx/0x990f9eebf09968cdfc29a4d2b4f0090b96e4cdff196fb2a0a10ea1a1d7f02164

Same code, same wallets.

Does it mean that gas consumption of working with mapping structure isn't deterministic? it's because it's hashmap?

1 Answer 1


This is expected behaviour. The difference is 15.000. It's because the first call is changing a slot in storage from 0x0 to some value (cost = 20.000). The second call is changing the same, already initialized slot, which costs 5.000. 15.000 less. If you make a third call, it will cost the same like the second.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.