11

I have sent ETH to a contract address, and it "failed" the transaction saying it is: Warning! Error encountered during contract execution [Reverted]

contract address and transaction failure here: https://etherscan.io/tx/0x0fba0c8e21a3c9f123fc8667a08cd4b1c495178285e9dbff9730b9e1918d455b

Even though I tried to set the gas higher, it still failed. Can someone help and explain, please?

5

2 Answers 2

11

Out of gas refers to the gas limit, not the gas price. When a transaction runs out of gas, the total gas required for the transaction is higher than the specified gas limit. All transactions have a base fee of 21,000 units of gas, and any extra computation on top of that (e.g. interacting with a contract), uses more gas.

Usually wallets can estimate how much gas a transaction needs pretty accurately, but if the estimated gas is too low, you can try manually increasing it. Setting something like 100,000 should be plenty for most contract interactions. Any unused gas is returned to you.

7

Your gas limit is too low. Retry the transaction with a gas limit of 6 million. The transaction will only use the required gas without consuming it all

1
  • 2
    Thank you. Your suggestion worked for me. I used MetaMask's Google Chrome extension (version 9.8.0) for both of my transactions. Initially, I used MetaMask's "slow" option for gas price and MetaMask's default value for gas limit (~30,000). My transaction failed ("Out of gas"). So then I tried again. Again I used MetaMask's "slow" option for gas price but set the gas limit (under "Advanced Options") to 750,000. My transaction succeeded and only used about 37,250 units of gas. See ethereum.org: Gas and fees: What is gas limit?
    – ma11hew28
    Jul 17, 2021 at 15:51

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