1

I have a contract where the user has to interact twice.

Is it possible to deposit GAS and store it in the contract for the first interaction, so the later interaction will be "free"? (and additional gas will be refunded to the user).

  • Gas goes to the miner, not to the contract. – goodvibration Jan 5 at 21:12
1

This isn't directly possible, but GasToken roughly does this by storing data and then deleting it later to claim a gas refund. But it's impossible to get the transaction fee down to zero, because gas refunds can only offset up to half of the transaction fee.

Note that you can also use some form of relayer to pay gas on behalf of a user. (Search for "meta transactions" for common patterns.) So a user could pay ether up front that is later used to reimburse relayers who pay for gas on future transactions.

0

What you can do is sending some slice of ether you charge on the contract before the second transaction to reimburse the user of gas cost. With all the limitations derived from fluctuating gas price, accounting in the contract and so on.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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