0

https://solidity-by-example.org/state-variables/

the site says "you can read state variables, for free, without any transaction fee". But when I do a get - call in Remix, a transaction is created and a gas cost is incurred !

What is the reason for this? Shouldn't get calls work without transaction fees in Ethereum? enter image description here

1 Answer 1

0

This would be the gas cost if the function call were part of a transaction.

For example, if a user initiates a transaction against a smart contract that spends gas, and that contract calls this get function, then the cost would be added to the total cost of the transaction. But if the call is made directly from an external account (Metamask), then there is no transaction and no gas cost.

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.