0

Suppose users on an exchange deposit bitcoin to different addresses using the HD wallet structure. Now suppose a user wants to withdraw bitcoin to an external address.

How would this whole process be done behind the scenes? I'm assuming the following happens:

A new address is generated for each deposit. Also, one address stores coins up to a certain amount, and the rest gets transferred into a cold wallet. This is done by making a transaction to this address when a deposit happens as long as the address contains bitcoin under some threshold. Then when withdrawals occur, only that address gets topped up and withdrawn from. This makes it easy to know which address contains coins that can be withdrawn from, and this address will contain a large enough amount of bitcoin so multiple transactions across different addresses aren't needed for a withdrawal.

Is this what happens in practice?

1

1 Answer 1

2

This is a pretty broad question that also has some opinion/preference nuances.

To try to answer your question, yes, a new address for each new deposit.

Whether these funds by default go to a hot wallet or cold wallet is a preference and will differ depending on the exchange.

I would suggest that best practice would be to have all user deposit funds going to cold addresses in a cold wallet, and separately have a hot wallet that funds are sent from. This means you need enough funds in a hot wallet to maintain daily user withdrawal requests. Eventually cold funds will be moved to the hot wallet to make up for spent funds, which I suppose is what you mean when you say "only that address gets topped up and withdrawn from." But your scenario implies address re-use so instead think of the same idea but topping up a hot wallet vs a single address.

2
  • So in the hot wallet withdrawals, would address reuse still happen? For example, an address contains 2 btc but a user only wants to withdraw 1 btc. Would the address need to be reused in another withdrawal(s) to get rid of the remaining balance? Jan 2 at 20:51
  • 1
    No you spend the full amount and send the left over to a change address.
    – m1xolyd1an
    Jan 3 at 5:21

Your Answer

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

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