Say I am an exchange that has many users. When I ask a user to deposit ETH I give him a unique address so I can attribute the ETH to him.
With Bitcoin this is easy. The bitcoin wallet software handles this and I can have BTC on multiple addresses and it's treated as one account.
I understand that with Ethereum this is different.
I found 2 options to achieve this:
Deploy a forwarder smart contract once for each user, give the address to the user. When the smart contract receives ETH, it forwards it to my main ETH address.
- User pays the gas cost of forwarding ETH
- Only have to keep track of one account (1 private key).
- I have to pay gas cost of deploying the forwarder contract multiple times
Create an account for each user. Don't give the private key to the user. Periodically go over all "user accounts" I control and send the ETH to the "main account"
- I don't have to pay gas for deploying any smart contracts
- I have to keep track of multiple accounts
Which of these two approaches will cost me more gas? Intuitively I think 2nd would cost less gas because deploying smart contracts is more expensive than sending ETH. But the 1st approach seems to be the one that is more popular with exchanges. Why is that?
I should note that I don't expect users to deposit ETH more than once. (Or rather for each deposit I would give them a new address so it's easier to keep track of their deposits)