I am writing smart contracts for a private EVM-compatible blockchain. Due to that, the gas cost isn't as relevant as it would otherwise be. Instead, we are more focused on the size of the blockchain over time, with data written into it over each transaction.

However, while two functions() might be storing the same amount of data in the blockchain, their complexity can vary a lot, and thus the gas cost.

Here is a simple example:

// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;

contract WastingGas {

    uint256 number;

    // Gas cost: 43768
    function addData(uint256 _number) public {
      number = _number;

    // Gas cost: 92258
    function addDataBadWay(uint256 _number) public {
        number = _number;

    // Mocking some complex/expensive function that isn't writing anything into the storage
    function wasteGas() internal {
        for(uint i; i<100; i++) {
            uint wastingGas = number + i;


My question is: Will the addDataBadWay() increase the size of the blockchain more than addData() ?? Both functions only store a single uint variable; therefore, they should increase the blockchain size by the same 256 bits. But it still seemed prudent to ask this question.

1 Answer 1


not only storing data use gas. Each process is a sum of opcodes execution.

The most expensive opcodes are when you store data. to sum 2 numbers for example costs 3 gas.

the fact you process something costs gas, but not necessary to be stored in blockchain because EVM has volatile & non-volatile memory.

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.