Solidity – How to Transfer ERC20 Tokens From Multiple Accounts Without ETH

Securitysoliditytransactionsweb3js

I have a requirement to have 1000+ ethereum addresses, which in fact used to store small amounts of various ERC20 tokens. I want to move all these crypto assets in all these 1000+ wallets into a single address.

If I could create a pool account with a single private key, it was the best method, but based on my current understanding on ethereum, I believe that it's not possible with ethereum. Every address is associated with another private key.

Now, note that all these 1000+ account has no ethereum in it. So in order to transfer ERC20 token to a common account, I need to transfer ETH in first to these 1000+ accounts for gas price for the ERC20 token transfer for each of these accounts.

Which means I need to transfer in ETH to account for gas, then transfer out ERC20 token to the pool account with the small amount of ETH transferred in.

Though it might work, it seems to be very complicated and a lot of ETH unnecessarily being wasted for gas while I am still in control of all these 1000+ accounts.

Is there any better or easier way for me? Like exchanges do? How can I internally transfer without a gas price? Or is there a way (even a complicated way) that I can have a pool account having single private key with multiple addresses?

Can anyone help?

Thanks,

Best Answer

Though it might work, it seems to be very complicated and a lot of ETH unnecessarily being wasted for Gas while I am still in control of all these 1000+ accounts.

I think you've mostly self-talked your way through this. If these are standard ERC20 contracts without backdoors, as I assume is the case, then there is simply no way around the constraint that a transfer transaction must be signed by the token holder.

If this were not the case, then it would be possible for a clever contract to spend from other people's wallets (ETH or Tokens). That would lead to a rather quick and disorderly collapse of just about everything.

You have the keys, so you can sign. The fact that the accounts have no ETH to pay for gas is something to think about before sending assets there. I would also give some thought to the cost implications. Gas cost for these transactions is scale-invariant, so you're making everything 1000x more expensive. You didn't mention the purpose of this so it's hard to say if there is a more ideal way to approach the issue.

Hope it helps.

Related Topic