I'm having difficulty coming up with suitable logic to handle a hot-wallet style deposit/withdraw system where funds that are deposited have to be sent out to any number of different addresses. This seems to be common place for exchanges or any other centralised system.

I've implemented this already for Bitcoin and that's rather easy to generate new addresses, get users to send coins to a central wallet, then sending out to any other wallet. This is easy due to Bitcoin's multiple input/outputs. This is proving to be a bigger challenge than I thought with Ethereum's single input and single output.

From my understanding it's not possible to have multiple addresses for a single account, since the account is the address. So the only option I'm left with is making deposit addresses as new accounts for every user that generates an address.

This is the major issue I'm facing. The funds that got deposited are now split over an unknown number of addresses/accounts. I've noticed that exchanges like Poloniex have a single main ETH account (which can be seen on etherscan).

So my main question is: How can I create different addresses and have the funds sent to a single address for full control?


1 Answer 1


You basically have two options:

First option

  1. Generate unique address for every user, you may derive user address deterministically from master public key and user ID, this way you will not need to deal with private keys in your back-end.
  2. Check balances of these addresses periodically.
  3. In case balance of some address exceeds certain threshold, publish transaction to move all ether (minus transfer fee) from this deposit address to your cold wallet.
  4. Track status of the transaction published at step 3
  5. Once transaction is mined and got decent number of confirmation, increase user balance in database

Pros: adding new users for free, user may send ether to deposit address from smart contracts via transfer method

Cons: deposits are more expensive, because second transaction is needed to move ether to cold storage, deposits take longer time

Second option

  1. For each user deploy smart contract that forwards all incoming ether to your cold wallet and logs an event with user ID and ether amount received
  2. Give address of deployed contract to the user as deposit address
  3. Monitor event log
  4. Once deposit event occurs in event log with transaction with decent number of confirmations, increase user balance in database

Pros: deposits are cheap and instant

Cons: adding new user costs gas that has to be paid by platform, not by user

  • Is there any project providing CEX style deposit / withdrawal as a service? This seems to be a common problem for anything centralized- games, exchanges etc. Oct 15, 2023 at 7: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.