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 where i can get that actual calculations.

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"

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.

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 -

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.