I would like to know who pays the gas when a transaction is refunded by the smart contract.

Suppose if a sender sends some amount of money to a smart contract, and it finds out that there is some issue with the transaction and wants to refund the sender. Who will pay for the gas in this case ?

1 Answer 1


The person calling the transaction always supplies the gas used in that transaction.

If the contract called throws an exception, or tries to send funds back to the sender for some reason, that will use the gas provided by the person calling the original transaction.

However, on the same logic, once the contract has received the funds and the initial transaction has been completed, if they were later to be returned to the original sender in a new transaction, it would be whoever triggers that new transaction that pays for the gas to do it.

Although there is no way around the initial need for the person who triggers a transaction to pay for the gas for it, it is possible to program a contract such that it sends an equivalent amount to the sender of the transaction, creating a de-facto refund. For example, the Ethereum Alarm Clock allows somebody who wants a transaction to be called at a future date to provide the funds for that call in advance. At the appropriate time some arbitrary person can then call the contract, providing the gas for it, but will be refunded with the money originally provided by the person requesting the call, along with a bonus to reward them for their effort.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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