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,390 points
712 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
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
439 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
620 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,432 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,683 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,226 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
958 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