I am adding approximately 3 ~ 5 new entries into the mapping, while the old one will be obsolete after a week.

If the mapping grow larger, is it going to consume more gasses?

Is there a need for me to remove them since they are no longer needed.


You pass gas to store the value in the first place. There are no future charges for keeping the data there.

That said, you can get a gas refund for deleting the existing data. That can only offset gas used for a new transaction. So if you can manage to delete the old ones while adding the new ones in the same transaction, you'll save gas (and thus ether) by doing so.

| improve this answer | |
  • smarx, thanks for the answer. So adding an entry into a mapping (regardless if it has 0 or 1000000 entries) will always consume the same amount of gas right? – s k Aug 19 '18 at 14:05
  • That's correct. – user19510 Aug 19 '18 at 15:18

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.