In my smart contract, I have the following property

struct MyStruct {
    uint256 property1;
    uint256 property2;

mapping(address => MyStruct) private structs;

In one function, this struct is getting filled

structs[msg.sender] = MyStruct(

Now my question, is the gas fee increased everytime the structs property is getting bigger, cause the nodes in the blockchain have to store more data?

2 Answers 2


When you create a mapping, solidity saves storage for that mapping. So adding new items to the map won't increase gas cost. You can look at this answer https://ethereum.stackexchange.com/a/8451/83751. You won't reach the maximum storage given to you since you have 2^256 slots.

Of course that if you try to access an item in the mapping that already exists, it will cost less gas than accessing one that doesn't exist.


It actually cost more gas to access an item in a mapping than when an item doesn't exist.

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.