I deployed my smart contracts to Rinkeby. I made my gas limit 3000000 in truffle.js like so:

rinkeby: {
  host: "localhost",
  port: 8545,
  network_id: 4,
  gas: 3000000

On Etherscan, it shows my gas limit is indeed 3000000. But when I try to use some functions, I exceed the gas limit. On etherscan it shows my gas limit is only 9000 and I exceeded it

Gas Limit: 90000

Gas Used By Transaction:90000 (100%)

As a result, the transaciton fails. Why is this the case?


The gas limit is a property of each transaction. So you set a high gas limit for the transaction where you deployed the contract, but you're setting a lower gas limit on the transactions where you're using the contract.

Most tools/code for sending transactions should be able to automatically estimate the gas limit you need. Without specifics of how you're sending these transactions, it's hard to make further suggestions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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