0

I am trying to make a transaction of DAI tokens from user wallet 0xDAIUserWallet to some random token contract say 0xRandomContractAddress. In this scenario I am using the private key of DAI User to sign the transaction as well as to pay gas fee, as he the owner of tokens.

What I am looking for, is to sign the transaction using the DAI user private key, but the gas fee should be paid by some other wallet.

I am using standard ERC20 Ethereum smart contract designed using solidity, and using ethers.js to interact with the smart contract.

1

Typically the one who signs a transaction also pays for the transaction. However, this doesn't have to be the case.

What you are looking for is something called meta transactions. A user signs a transaction he wishes to send to the blockchain and then hands the transaction to a third party which actually sends the transaction for the user (and pays for the gas). It's not a trivial thing to implement but once it's done right it should work. For some reason it's not very popular (yet).

Here's one article about the topic: https://medium.com/@austin_48503/ethereum-meta-transactions-90ccf0859e84

  • You are right, do you know how to build this over ethers.js? – DIGVJSS Oct 2 at 11:21
  • Sorry, no idea about ethers.js . As I said, it's not very trivial to set this up. – Lauri Peltonen Oct 2 at 11:26

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.