Suppose I have a contract deployed which contains few wallet addresses.

I want to buy the ethereum for these wallet addresses on behalf of them.

Now, to buy ethereum or to do any kind of transaction, the approval of the owner of that wallet address is needed. But in my case, that will not be possible because I want to buy the ethereum on behalf of the owner of a wallet address.

So is it possible that my smart contract can get the approval anytime when I try to do buy the ethereum for that particular address?

In short, whenever I click buy button from frontend, my smart contract should buy the ethereum for the addresses stored in smart contract and the purchased ethereum should be reflected in the wallet of the owner.

  • Your question is not clear, I think you are also mixing between ether the native currency of the blockchain and the erc20 Tokens which are managed „smart contracts“
    – Majd TL
    Commented Apr 4, 2022 at 11:12

1 Answer 1


No permission or approval is needed to send ETH to an EoA. You can just send it.

It's not clear what you mean when you say "buy ether". What is the wallet owner paying in exchange for the ether?

If the wallet owner is giving some other token like USDT in exchange, then yes you need permission to take that other token out of their control. This is what a DEX would do.

But if the exchange is handled off-chain, for example if the wallet owner used their credit card to pay you, then your contract is more like a faucet, it just needs to send them the Ether at their address when the appropriate function is called. No permission needed.


Ether and other ERC-20 tokens are different, in the sense that Ether is created by mining, and other tokens are minted just by adding a entry in their contract that so-and-so account now owns this much token.

Assuming this question is now about minting other tokens:

  1. You can mint the tokens yourself (paying the gas fee) and send it to anyone without their permission. (Note that nothing is actually being sent in this case, minting N tokens for that user just means that now if someone queries your token contract with that user's account address, your contract will say that yes I admit that particular account has N tokens. This means that new tokens won't directly "appear" in the user's wallet, for the first time the user will actively have to give their wallet your token's contract address and tell the wallet to go look in that contract, and see if the contract says the owner has any tokens. Unless your token is very famous one which the wallet automatically checks for, this is a manual step.)
  2. But you cannot spend gas out of someone's wallet without their permission.
  3. You can have the recipient "authorize" you to withdraw up to X of some particular token or ETH. This authorization is a separate transaction and costs gas, and will have to be initiated by the wallet holder. But if X is a large number you will then be authorised to withdraw as many times as you like till that limit.
  4. If you have the authorization you can then mint the tokens paying the gas fee yourself, but then transfer the tokens and take whatever amount out of the other authorised tokens or ETH, from the user's wallet as you see fit, to compensate for the tokens you sent + gas.
  5. Of course this way you are compensated for the gas, but the net gas spent is much higher, being 2 or 3 transactions instead of just one.

For ideas on what is common these days, I suggest look at ICO, crowdsale or airdrop practices, where tokens are minted and assigned to accounts for free or for a fee paid earlier. It's cheaper to do it in bulk once rather than once for every user.

  • i want to mint tokens for an address. For example, suppose I have your wallet address. Now I want to mint 10 ERC20 tokens to your account. The gas fee should be deducted from your account. Now, you are aware that I am going to mint(buy) 10 tokens for you but you don't know when. I don't want you to wait for me that when will I mint tokens on your behalf. So whenever I mint, the minting should be successful and does not require your approval while minting.
    – Ketul s
    Commented Apr 4, 2022 at 10:41
  • So, summarising, I minted(buyed) 10 tokens from your account and the gas fee is deducted from your account and now you will have 10 tokens. Can I write a function like this in solidity.
    – Ketul s
    Commented Apr 4, 2022 at 10:41
  • This has nothing to do with buying ether?
    – salian.eth
    Commented Apr 4, 2022 at 11:02
  • How can I implement this functionality. Means which are the function I need to call in order to complete this entire flow?
    – Ketul s
    Commented Apr 4, 2022 at 11:22
  • We've moved on a bit from the original question. Can you formulate a separate and specific question for this? It would be great if you could do and show your own research based on the keywords provided in the above answer, so the question can be less broad.
    – salian.eth
    Commented Apr 4, 2022 at 11:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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