I have the follow use case: There is an off-chain service, like a game, which will generate/mint new ERC20 tokens when some requirements are met by end-users. Since the users will get profit (in terms of ERC20 tokens), I do not want to pay the transaction fee of calling the mint function in the ERC20 contract.

Question: How can I make users pay the transaction fee of mint while under the control of my off-chain service (e.g. not violating the rule of minting new tokens)?

I know usually, this gas-paid-by-someone-else use case is often something like: the user do not need to pay the transaction fee, while a third-party will pay the fee. And there are a lot of mature libraries can do this, like openzeppelin GSN. But in my case, this is different.

I found a related question here talking about the general solution to such problems. But I prefer not to implement too many things by myself, since there may be security issues. Are there any libraries that can help me achieve my goal?

Thanks in advance.

  • Perform the minting as part of one of the user's transactions (for example, when that user withdraws his/her tokens). Sep 27 '20 at 14:59
  • @goodvibration Thanks for comment. But if I do this way, how can I make sure if the user is withdrawing the tokens without violating any regulations?
    – Aaron
    Sep 28 '20 at 1:11
  • Go over each regulation, and make sure that it is not violated. Sep 28 '20 at 5:07
  • But the thing is: the regulations are not in smart contracts. They are coded in off-chain service. I think I should let users directly call the smart contract functions.
    – Aaron
    Sep 28 '20 at 7:16
  • So add them to the smart contract and then verify them. Sep 28 '20 at 7:18

Your Answer

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

Browse other questions tagged or ask your own question.