Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: sjefdeklerk on February 18, 2018, 05:51:52 PM



Title: How do exchange transactions work?
Post by: sjefdeklerk on February 18, 2018, 05:51:52 PM
I wonder what exactly happens if an exchange transaction takes place. I've been looking at my own bitfinex btc wallet adress and I see that my deposits get moved into a single wallet that seems to be the general Bitfinex wallet. This general bitfinex wallet moves btc's to the cold wallet whenever the btc amount gets too big and moves it back whenever the amount gets too low.

So what exactly happens when I sell BTC at bitfinex to somebody else ? The amount of BTC remains exactly the same in the bitfinex wallet, it just has different owners. This seems to happen completely off chain, but how does it work. Does bitfinex simply have a database where they keep track of who owns what part of their wallet? And is it even possible to identify for example who is buying how much? It seems this is impossible?

Thanks


Title: Re: How do exchange transactions work?
Post by: achow101 on February 18, 2018, 06:31:00 PM
Exchanges do not make transactions on chain, that would be inefficient and costly. Rather they have a central database with their customer's balances. So when you make a trade, they just update balances in their database. The same happens when you deposit or withdraw, a value in their database is updated.

When you deposit coins into your exchange wallet, they just change values in their database. The coins are no longer yours nor are they identifiable to you once they enter an exchange. Don't think of those coins as "your coins" but rather "the exchange's coins". What they do with deposits is much like a traditional bank does - they update a balance in their database which is effectively a promise to you that they will give you that amount in the future when you ask for it (aka withdraw). The coins themselves will be put in some wallet and then later used for someone else's withdrawals. The transactions that happen within the exchange itself happen on a database and they can keep logs of everything, so they do actually know how much you had, when, and how much you traded.


Title: Re: How do exchange transactions work?
Post by: sjefdeklerk on February 18, 2018, 08:50:58 PM
Exchanges do not make transactions on chain, that would be inefficient and costly. Rather they have a central database with their customer's balances. So when you make a trade, they just update balances in their database. The same happens when you deposit or withdraw, a value in their database is updated.

When you deposit coins into your exchange wallet, they just change values in their database. The coins are no longer yours nor are they identifiable to you once they enter an exchange. Don't think of those coins as "your coins" but rather "the exchange's coins". What they do with deposits is much like a traditional bank does - they update a balance in their database which is effectively a promise to you that they will give you that amount in the future when you ask for it (aka withdraw). The coins themselves will be put in some wallet and then later used for someone else's withdrawals. The transactions that happen within the exchange itself happen on a database and they can keep logs of everything, so they do actually know how much you had, when, and how much you traded.

Thanks mate!


Title: Re: How do exchange transactions work?
Post by: irukandji on February 21, 2018, 07:45:17 AM
The exchange takes ownership of all your coins in their wallet, i.e. they have the private key. Then they give you a credit on their own internal ledger (which really gives you nothing) Then if they like they give them back when you ask for them


Title: Re: How do exchange transactions work?
Post by: posi on February 21, 2018, 08:58:55 PM
Exchanges do not make transactions on chain, that would be inefficient and costly. Rather they have a central database with their customer's balances. So when you make a trade, they just update balances in their database. The same happens when you deposit or withdraw, a value in their database is updated.

When you deposit coins into your exchange wallet, they just change values in their database. The coins are no longer yours nor are they identifiable to you once they enter an exchange. Don't think of those coins as "your coins" but rather "the exchange's coins". What they do with deposits is much like a traditional bank does - they update a balance in their database which is effectively a promise to you that they will give you that amount in the future when you ask for it (aka withdraw). The coins themselves will be put in some wallet and then later used for someone else's withdrawals. The transactions that happen within the exchange itself happen on a database and they can keep logs of everything, so they do actually know how much you had, when, and how much you traded.


If that's how the exchange transaction work. So, what the reason behind some exchange site charging their account holder some certain fee for making deposit since the network fee is not needed to be pay to miner?


Title: Re: How do exchange transactions work?
Post by: Xynerise on February 21, 2018, 09:15:17 PM
If that's how the exchange transaction work. So, what the reason behind some exchange site charging their account holder some certain fee for making deposit since the network fee is not needed to be pay to miner?

It depends on the cryptocurrency.
To initialise a ripple wallet you need to have a minimum of 20 XRP as a reserve (https://coinsutra.com/20-xrp-ripple-fee-reserve/) so some exchanges like Poloniex charge you that 20XRP to create a wallet.

For ethereum there is a challenge on how to store user funds -- as an address or as a smart contract. They can either initialise a smart contract for every user (which consumes gas for contract creation), or create a new address (external Account) for each customer which will also incur gas fees for moving the deposited eth by the customer to the cold wallet. (It's worse for tokens since they'll have to seed every address with ETH for gas in order to move the tokens)
Some exchanges externalise this cost to customers by requiring a deposit fee so they can move the ether or tokens deposited, while others eat the cost.


Title: Re: How do exchange transactions work?
Post by: Rath_ on February 21, 2018, 09:20:39 PM
If that's how the exchange transaction work. So, what the reason behind some exchange site charging their account holder some certain fee for making deposit since the network fee is not needed to be pay to miner?

There isn't any good reason to charge a Bitcoin deposit fee. As far as I know, HitBTC charges about 0.0006 BTC every time you deposit Bitcoin. They introduced this fee 2 months ago when Bitcoin network was overloaded. The reason why they introduced this fee is because they want to provide stable service. They could have come up with a better excuse. They still charge 0.001 BTC withdrawal fee. Ridiculous, we should ditch exchanges which behave like that. I can't wait to see fully working atomic swaps.

Source: https://blog.hitbtc.com/introducing-deposit-fees-for-bitcoin/


Title: Re: How do exchange transactions work?
Post by: btctousd81 on February 22, 2018, 02:42:58 AM
everything happens on exchange excecpt withdrawals are just numbers game.

you deposit x btc to your deposit wallet,
exchange see those x btc added and gives you x btc to play with .

you sell those x btc to another user.
exchange removes those x btc from your account and adds those x btc in who have purchased your btc.

this is all done in internal database.

the only time person withdrwas their coins , is when they create a transaction and broadcast/push to the the specific blockchain network/nodes.

so you can seee its , just numbers game for them.