Hello. I have encountered an unusual situation: 5 cancelled transactions… one after another.
One reason: Warning! Error encountered during contract execution [Out of gas] as per Etherscan
But more interestingly, the gas is consumed, and no refund seen.
So I’ve lost like 5 x 5 = 25$ already…
Two questions, why is this happening? We are running an “estimate fee” service and according to the Etherscan, volume + gas = fits the balance
Due to the Blockchain’s design, the gas fees associated with transactions are getting consumed
regardless if the transaction executes successfully or not. This is due to the Ethereum Virtual
Machine trying to process transaction instructions before a transaction can be broadcasted to
the network. It does this by consuming the Gas Limit that is being added to any transaction.
When a transaction is marked “Fail” on Etherscan.io, the amount the sender sent does not leave
the wallet but “Gas Fee” is being deducted.
In the event of an “Out of Gas” failed transaction, the gas limit set during the transaction is
below the required gas needed for the transaction. You may send or may request the sender to
send another transaction with a higher “Gas Limit”.
From your example, the gas used by the transaction is 100% of the total gas limit is set to.
Gas Limit & Usage by Txn: 21,000 | 21,000 (100%)
You can look into a part of your code where you are calculating Gas limit or Base fee for the transaction.