Why Gas Used By Txn is different when invoking the same function in the same smart contract

0 votes

I have seen some transactions in etherscan.io.But I have found that even invoking the same function in the same smart contract, the gas used by txn are different.I try to found that maybe the input data result in it.Really?

Sep 25, 2018 in Blockchain by sabby
• 4,370 points
1,011 views

1 answer to this question.

0 votes

The input data might be different, but also the state stored in the smart contract might be different (and change e.g. the number of times a loop iterates). Also, if storing nonzero data in a state variable that previously held zero data, or vice versa, will change the gas usage. For example, a simple function that toggles a boolean variable will not use the same amount of gas on any two consecutive calls.

answered Sep 25, 2018 by Christine
• 15,790 points

Related Questions In Blockchain

0 votes
1 answer

Solidity, why the used function is placed before the brace "{}" when define a new function?

Hey there! 1. Yes, using the same name ...READ MORE

answered Apr 4, 2019 in Blockchain by Omkar
• 69,220 points
1,314 views
0 votes
1 answer

Why is it downloading the blocks when I am trying to deploy the ethereum private network?

Once you have installed the Ethereum wallet, ...READ MORE

answered May 3, 2018 in Blockchain by Shashank
• 10,400 points
691 views
0 votes
1 answer

Where are the transaction details of a smart contract is written in Ethereum?

First ques:where in the blockchain is a ...READ MORE

answered Jul 11, 2018 in Blockchain by Shashank
• 10,400 points
837 views
0 votes
1 answer

Why RLP encoding is used in Ethereum?

RLP is intended to be a highly ...READ MORE

answered Aug 4, 2018 in Blockchain by Mohini
• 260 points
1,642 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,947 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,470 views
+3 votes
2 answers

How to run ethereumjs using Node.JS

You need to install testrpc globally on ...READ MORE

answered Mar 27, 2018 in Blockchain by ned_crew
• 1,610 points
1,467 views
+1 vote
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP