0

I would like to make a ERC20 contract in which the contract owner will pay the gas for clients transactions (for example, to allow to transfer tokens between clients for free).

There is an excellent post about how to make a contract when a receiver of ethers pays for the gas: https://programtheblockchain.com/posts/2018/02/17/signing-and-verifying-messages-in-ethereum/ The idea in it is that the contract owner sends a signed transaction off-chain to receiver of ethers, and receiver calls some contract function passing the signature there and paying for gas actually. This function checks the transaction signature with ecrecover function, the owner address and transfers the appointed amount of ethers to receiver.

What if to add a similar new function to a ERC20 contract, which will accept both tokens sender's and receiver's address, the amount of tokens and sender's signature. This function will be called by the contract owner (who pays blockchain fee). The function will recreate the transaction, check sender's signature and address and transfer tokens from the sender to receiver (if verification is OK). Senders can send signed transactions to the contract owner off-chain. I think it will work, but what about ERC20 compatibility? Will it violate ERC20 standard rules or have any other security issues?

1

It might be little complicated, esp. if current EIP-20 interface needs to be honoured.

Currently Ethereum does not have a feature where a contract can pay for gas, which would make this more clean.

It is planned in the future:

https://github.com/ethereum/EIPs/pull/208

https://github.com/ethereum/EIPs/issues/865

  • As I understand, the first EIP proposes a special kind of transaction that is to be sent on-chain, for free, to a 'forwarding contract' which actually pays for the gas. The second adds a new function to the token interface allowing to check transaction signature, and the transactions are to be sent off-chain. I think, first is ok, but the second proposal is not very meaningful, because: 1) anyone can implement the similar function himself just now 2) from the viewpoint of the token standard this does not add any new functionality for wallet developers. – xdimy Mar 22 '18 at 13:20

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.