Can you please explain the concept GAS in smart contract properly if possible with example. And what is the max limit of GAS in a contract?
It is clear if i use more gas i have to pay more...so where i can get that actual calculations.
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.Sign up to join this community
There are many good YouTube presentations on this topic. I recommend one by Joseph Chow from ConsenSys. Watch it here: "Ethereum, gas, fuel, and fee" https://youtu.be/dd-ajiMl4HY
A contract call can take all gas per block if the contract tx is lucky enough to be the only one tx in a block or you mine a block yourself . The current gas limit can be checked on the network stats page. https://ethstats.net/
You can use the following Web3 JS function to estimate Gas before making any smart contract function call -
Also, the Gas Limit is defined in the genesis.json file, before initializing the genesis block.
You can take a look at this link to understand these concepts better -