I'd like to find a way for an address to trigger a transaction without paying the cost of eth.

I know that two years ago there was some talk about making this a feature of ethereum. Does anyone know what the status of that is?

Until then I'm trying to figure out how to do a workaround.

I was thinking that I could have a contract loaded with eth that would then approve other address to call the contract and trigger that contract to issue a transaction.

So then the address could then use some kind of delegate call to this contract. If the address was on the approved list then this contract would issue the transaction and pay for the eth.

Would something like this work? And can anyone point me to an example of this being done?



The only way to fully cover the gas cost would be to basically have ETH in the contract, and refund the sending address the amount of ETH used in the transaction. You can do this by:

  1. Recording msg.gas at the beginning of execution.
  2. Record msg.gas at the end of execution.
  3. Subtract #2 from #1.
  4. Add 21,000 to #3 for the baseline tx fee. You might have to add a bit more for tx parameters or similar extra fees.
  5. Multiply #5 by msg.gasprice to get the ETH used in the tx. Return this to the origin of the tx.

Your DELEGATECALL idea wont work because internal transactions (a contract calling another contract) will still just use the gas from the original tx.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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