[Ethereum] How to fix: Warning! Error encountered during contract execution [Out of gas]

gas

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?

Best Answer

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.

Related Topic