I am using a Dapp connected with MetaMask and smart contract. I try to conduct a function named addUser(id, name), I enter two users, one with addUser(12, Jack), while the second with addUser(43, Alex), the (gas used) was different, which surprised me, why gas used change although both users have the same parameters and the same number of digits? I couldn't find a good explanation for this! I know the gas used calculated depends on the complexity of the function or transaction. Can someone help me to understand this?

thanks a lot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.