2

This question already has an answer here:

I have a scenario like that:

I have a "Main" account with ethereum client:

And there are other two accounts, lets call them: "A" and "B"

"A" account will send to "B" account some token (ecr20 token). But transaction fee must be paid by "Main" account.

Is it possible? How can i create a transction like that?

marked as duplicate by Validity Labs - Sebastian, niksmac, Dawny33, Nicolas Massart, Waqar Lim Mar 14 '17 at 11:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

5

You can't currently use an account to trigger a transaction from another account, and currently the account that triggers the transaction has to pay for the gas.

If A can be a contract rather than an Externally Owned Account, you can give the contract methods to allow it to be called by the Main account, causing it to send funds to B. In this case the Main account is triggering the transaction, so the gas will come from the Main account.

Alternatively, with ERC 20 tokens, it's possible to approve() another address to spend funds on your behalf. So you could make a single call from A (for which A will have to pay gas) to approve a large sum of money, which will cover many small payments from A's account to B's. That way A only has to pay for gas once, after which gas can be paid for by Main. If you don't want to trust Main to make all these calls without restriction, you could make an intermediate contract that has to be called by Main, specifying under what circumstances it can spend funds belonging to A.

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