# Calculated Gas Costs of Contract execution

I have a smart contract that maps a string to a string value and stores it on the Blockchain. I want to analyse the Gas Used by Transaction. One time the execution consumes 92,843 Gas (https://rinkeby.etherscan.io/tx/0x04ac9ef0403d0d9362779de3f15d25942e861270aa53d4896692f68bc06150aa), the other time it only takes 43,043 Gas (https://rinkeby.etherscan.io/tx/0x103693f2d548da60e14470ced0825f5a5263a9e618658e1812d3c84c29571f4a). How does that happen?

Also: The transaction costs 21.000 Gas and the storage operation for 32Byte is 5.000 Gas. Since I store 2 64Byte Strings that is 21.000 + 2*5.000 + 2*5.000 = 41.000. Where does the rest of 2.043 Gas come from?

To narrow it down, I also uploaded an even simpler contract which only stores one uint value:

``````pragma solidity ^0.5.7;
contract storeNumber{
uint test;
function setValue(uint number) public{
test = number;
}
}
``````

The transaction https://rinkeby.etherscan.io/tx/0x5327f3a2a74f2589c7f8e323a698f78c17b249cf5090cec74d11e7456cb0ec38 consumes 26,684 Gas - 21.000 + 5.000 is obvious to me, but what about the 684 additional Gas?

• @Felix: Possibly the "extra" input argument yields an additional cost. Try to remove it, set `test = THE_VALUE_THAT_YOU_HAVE_USED` and then measure the gas cost once again. – goodvibration May 1 '19 at 10:15