5

When I buy bitcoin on an exchange I instantly get them and can withdraw my coins 5 seconds after the transaction. This means the exchange must record your account balance in some database independent of a bitcoin wallet (otherwise buying the coins would take ~10 minutes) and when I withdraw them it is sending a request to withdraw X bitcoin from the exchanges wallet.

However, when I check the wallet that BTC is coming from on blockchain.info etc the source wallet is always different, and I'm unable to see what wallet's balance over time.

How are exchanges storing bitcoin so you can buy/sell on the exchange instantly, and how are they managing that system for withdrawls?

7

It is important to keep in mind that addresses are not the same as wallets. A wallet contains multiple addresses, not each address is a wallet.

Exchanges maintain their own wallet with thousands of addresses and thousands of coins. When you deposit Bitcoin at an exchange, they will give you an address from their wallet, and you are sending to their wallet. The Bitcoin is now theirs. When you withdraw from the exchange, they send Bitcoin from their wallet to the address that you provide. When they send, their wallet uses some coin selection algorithm to select which coins it will spend to send to you. Since an exchange processes thousands of deposits and withdrawals per day and since the coin selection algorithm may include some randomness, the addresses associated with the coins being spent for each withdraw that you make will likely be different.

  • 1
    What about specifically when I buy from another user on that exchange, what mechanism is in place giving me instant access to the bitcoins I just used (because bitcoin transfers take ~10 minutes) and I have coins I just bought immediately. Is it just hot swapping ownership of these thousands of addresses? E.g. I buy 2 BTC from someone and in reality what the exchange is doing is making me the owner of their wallet now. But if that was the case wouldn't my deposit address now change? – tsujp Jul 13 '17 at 18:38
  • 4
    No, when you deposited coins in the exchange, you sent coins to their wallet, so the money is really now theirs. You don't actually own the Bitcoin. They then updated in their database the balance for your account. When you trade with someone, they just update the balances of your account and the person you traded with. No Bitcoin is actually moved. – Andrew Chow Jul 13 '17 at 18:55
  • Ahh yep yep that's what I meant :) – tsujp Jul 16 '17 at 12:54

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.