Bitcoin Forum
May 10, 2024, 07:44:14 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How is exchange's wallet structure?  (Read 225 times)
wsxdrfv (OP)
Jr. Member
*
Offline Offline

Activity: 405
Merit: 5


View Profile WWW
March 31, 2018, 03:11:32 AM
 #1

1. How exchange provide each coin's address to each users?


2. At exchanges, buy/sell occurs at real time.
Then it is not actual send/receive bitcoin between buyer/seller's real bitcoin address. Because it took so much time.


Then how exchange implement these part?
1715370254
Hero Member
*
Offline Offline

Posts: 1715370254

View Profile Personal Message (Offline)

Ignore
1715370254
Reply with quote  #2

1715370254
Report to moderator
1715370254
Hero Member
*
Offline Offline

Posts: 1715370254

View Profile Personal Message (Offline)

Ignore
1715370254
Reply with quote  #2

1715370254
Report to moderator
If you see garbage posts (off-topic, trolling, spam, no point, etc.), use the "report to moderator" links. All reports are investigated, though you will rarely be contacted about your reports.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715370254
Hero Member
*
Offline Offline

Posts: 1715370254

View Profile Personal Message (Offline)

Ignore
1715370254
Reply with quote  #2

1715370254
Report to moderator
Quickseller
Copper Member
Legendary
*
Offline Offline

Activity: 2870
Merit: 2300


View Profile
March 31, 2018, 03:30:01 AM
 #2

The exchange will control the private key to all of the coins (be it bitcoin, or some other altcoin) on deposit at the exchange along with having ownership of fiat on deposit and they will make an entry in their database once a trade takes place.

Exchanges will generate deposit addresses for each customer for each coin.
wsxdrfv (OP)
Jr. Member
*
Offline Offline

Activity: 405
Merit: 5


View Profile WWW
March 31, 2018, 05:28:13 AM
 #3

The exchange will control the private key to all of the coins (be it bitcoin, or some other altcoin) on deposit at the exchange along with having ownership of fiat on deposit and they will make an entry in their database once a trade takes place.

Exchanges will generate deposit addresses for each customer for each coin.
How to do that?

And how about deals occured in exchange?
HeRetiK
Legendary
*
Offline Offline

Activity: 2926
Merit: 2091


Cashback 15%


View Profile
March 31, 2018, 07:36:12 AM
 #4

The exchange will control the private key to all of the coins (be it bitcoin, or some other altcoin) on deposit at the exchange along with having ownership of fiat on deposit and they will make an entry in their database once a trade takes place.

Exchanges will generate deposit addresses for each customer for each coin.
How to do that?

Most likely by running the wallet software (or some derivation of it) of each respective cryptocurrency. Then you either use an existing library or write a wrapper yourself to use said wallet software for generating addresses and watching them. In the case of Bitcoin you'd likely have the wrapper access your wallet via its JSON-RPC interface. In the case of alts it would probably look similar.


And how about deals occured in exchange?

Like Quickseller already said: Trades are just entries in a database.

In other words:

1) Your balances are stored in a database on the exchange's servers.
2) Whenever you place an order, this order will also be stored on a database somewhere.
3) The trading engine will do its magic and match buy and asks. If it finds a proper match it executes the order.
4) The state of your order is updated in the database. The state of your balances is updated in the database.

In the case of centralized exchanges, none of the above ever hits a blockchain. Only once you withdraw some of the balances of yours, an on-chain transaction will take place.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
Bitfort
Sr. Member
****
Offline Offline

Activity: 952
Merit: 339

invest trade and gamble wisely


View Profile
March 31, 2018, 07:41:49 AM
 #5

The exchange will control the private key to all of the coins (be it bitcoin, or some other altcoin) on deposit at the exchange along with having ownership of fiat on deposit and they will make an entry in their database once a trade takes place.

Exchanges will generate deposit addresses for each customer for each coin.
How to do that?

And how about deals occured in exchange?

What's your point?
Trading on exchanges is actualy off-chain (there is no real transaction between seller and buyer)

It's more like: You open an account, make deposit and this deposit is turned into some sort of "credit".  Traders are exchanging these credits.
Once you want to withdraw, this amount is deducted from your credit and via blockchain transfered to your address.


MY HINTs
◄M► MINING
◄G► GAMBLING
◄E► EXCHANGE

◄E► (KCS) Kucoin-Staking, Auto-Lending, Trading-Bot
◄E► (BNB) Binance-Staking, Savings, 10% RefBack
◄E► (TRX) Poloniex-Staking, Lending, Fee Discount
◄E► (LEO) Bitfinex-Staking, Auto-Lending

◄G► Betfury-Faucet, Dividend Earnings (BFG holders, mine BFG by playing)
◄G► Bitvest -  Faucet, Bankroll Invest
◄G► CryptoGames-Faucet, Lotto
◄G► PrimeDice-Faucet

◄M► Prohashing (Multipool)-Payout in any coin, get 0.50% bonus for 30 days
◄M► MiningRigRentals (Marketplace)-buy hashrate or rent your miners
◄M► Viabtc  (Pool)-payout to Coinex (exchnage) without fees


as9ardia
Full Member
***
Offline Offline

Activity: 541
Merit: 137


View Profile WWW
March 31, 2018, 08:30:16 AM
 #6

1. How exchange provide each coin's address to each users?


2. At exchanges, buy/sell occurs at real time.
Then it is not actual send/receive bitcoin between buyer/seller's real bitcoin address. Because it took so much time.


Then how exchange implement these part?


if you want actual send/receive at real time transactions then you should try DEX (Decentralized Exchange)
here's for reference https://coinsutra.com/best-decentralized-exchanges-dex/

///Back from hiatus////
Say F to Virus!!!
jseverson
Hero Member
*****
Offline Offline

Activity: 1834
Merit: 759


View Profile
April 01, 2018, 03:11:49 AM
 #7

The simplest way I can explain this is that in most exchanges, you don't actually own the addresses assigned to you. Your account balance is independent from your address balance. If you deposited Bitcoins to your receiving address, it just tells the exchange to credit that many Bitcoins to your account; this is obviously done off-chain, and the Bitcoins in that address don't belong to you. Trading internally only affects the balance credited to your account, while the coins traded stay where they're stored. Coins only move when you take them out of the exchange.

Think of it like banks. If you deposit money in a certain branch, that doesn't necessarily mean it's going to stay there. They are absorbed by the bank system, and they simply credit your account. If, say, you decide to transfer money to a certain person who has the same bank but is based on a different branch, they don't actually physically transfer money; this is done internally by deducting that amount from your account and crediting it to the other person's account. Money only really moves when you take it out.

I hope that was a clear explanation.

wsxdrfv (OP)
Jr. Member
*
Offline Offline

Activity: 405
Merit: 5


View Profile WWW
April 17, 2018, 02:36:02 AM
 #8

Thx for replies.

So how to actually implement exchange wallet?

For example first things first, Bitcoin,

Download bitcoin node and full blockchain datas?

And then locate and run it as daemon with same server of exchange's web server?
For communicate realtime with server and when exchange's user sign up and first logged in, exchange should give deposit address of all crypto coins.

Or?
vanyx
Newbie
*
Offline Offline

Activity: 5
Merit: 0


View Profile WWW
April 17, 2018, 02:40:45 AM
 #9

You'll need a standard database to get started with (e.g. PostgresSQL/MySQL).

This is needed to track open/close orders as well as the private keys associated with each user account (private keys are randomly generated).

Then to verify the balance of those user accounts, you can either use a full node or communicate with an API (e.g. blockchain.info)
wsxdrfv (OP)
Jr. Member
*
Offline Offline

Activity: 405
Merit: 5


View Profile WWW
April 17, 2018, 02:44:24 AM
 #10

You'll need a standard database to get started with (e.g. PostgresSQL/MySQL).

This is needed to track open/close orders as well as the private keys associated with each user account (private keys are randomly generated).

Then to verify the balance of those user accounts, you can either use a full node or communicate with an API (e.g. blockchain.info)
Specific coin's wallet is one and its private key is owned by exchange, and then for user, just give address. Isn't it? So private key for each user will not be given?

And what is good way between full node or API? And is this server should be ubuntu?

And API means this? https://blockchain.info/api/blockchain_wallet_api
vanyx
Newbie
*
Offline Offline

Activity: 5
Merit: 0


View Profile WWW
April 17, 2018, 02:54:38 AM
 #11

Specific coin's wallet is one and its private key is owned by exchange, and then for user, just give address. Isn't it? So private key for each user will not be given?

And what is good way between full node or API? And is this server should be ubuntu?

And API means this? https://blockchain.info/api/blockchain_wallet_api

You do know want to give away the exchange's user account's private key. Because if you do that the user could potentially squander you out of some bitcoins (e.g. setup an open order and then transfering away all bitcoin before order is completed)

Full node is when you know your data is correct. An API is good if you're providing that API otherwise you're relying on a 3rd party to provide you correct information (which is something we don't want in a trustless world).

The server can be anything, doesn't need to be ubuntu.

Yes that is an API, but a more common use for an exchange API would be to retrieve funds of specific accounts (to see if a user deposited money into it or not).

E.g. to get the data of address `1M2n7X42iGAheNSNCNq5nfGq5Z3JeRBw8H` we could just go to this link: https://insight.bitpay.com/api/addr/1M2n7X42iGAheNSNCNq5nfGq5Z3JeRBw8H
wsxdrfv (OP)
Jr. Member
*
Offline Offline

Activity: 405
Merit: 5


View Profile WWW
April 20, 2018, 12:38:30 AM
 #12


The exchange will control the private key to all of the coins (be it bitcoin, or some other altcoin) on deposit at the exchange along with having ownership of fiat on deposit and they will make an entry in their database once a trade takes place.

Exchanges will generate deposit addresses for each customer for each coin.
Thx for reply.

So I heard that exchange give specific coin's (Lets say, just Bitcoin) addresses to users. And one private key control them all.

But when I just test with -qt wallet program, after I click [Request payment], it generates new address, 3 times, made 3 addresses,

then I typed [dumpprivkey <address>] at console for each addresses above, it shows different private key per each address.

Why?

So then this means, wallet program is bunch of private keys gatherings, exchange run its bitcoin daemon, then this daemon has all the access the generated addresses given to users? Confused.
HeRetiK
Legendary
*
Offline Offline

Activity: 2926
Merit: 2091


Cashback 15%


View Profile
April 20, 2018, 09:37:31 AM
 #13


The exchange will control the private key to all of the coins (be it bitcoin, or some other altcoin) on deposit at the exchange along with having ownership of fiat on deposit and they will make an entry in their database once a trade takes place.

Exchanges will generate deposit addresses for each customer for each coin.
Thx for reply.

So I heard that exchange give specific coin's (Lets say, just Bitcoin) addresses to users. And one private key control them all.

Not quite.

Each address has its own private key. There's also cases where different addresses can be accessed by the same private key (ie. you can derive a P2SH SegWit address and a legacy address from the same private key) but that's a different matter.

I think the "one private key" you heard about refers to the wallet seed. That is, when using a deterministic wallet or address generation algorithm, you can deterministically -- as opposed to randomly -- derive multiple private keys and their respective addresses from a single private key or passphrase (ie. the wallet seed). If you ever used Electrum, Mycelium, Trezor or any of those wallets -- that's the seed words you get for backing up when setting up a new wallet. Non-deterministic wallets -- such as Bitcoin Core, for the longest time -- generate their private keys / addresses at random, making it necessary to back up to the collection of private keys instead of just a single wallet seed / master key.

Some general info on deterministic wallets:
https://en.bitcoin.it/wiki/Deterministic_wallet

BIP-0044: Multi-Account Hierarchy for Deterministic Wallets:
https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki

BIP-0039: Mnemonic code for generating deterministic keys:
https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki

Most wallets nowadays are hierarchical deterministic wallets (HD wallets); that is: Using a single wallet seed you can not only derive a list of addresses, but a whole tree of addresses. This is usually reflected in the form of accounts, effectively sub-wallets. It would make sense for an exchange to provide each user with an address branch of their own, I'm not sure if that's really the case in practice though.


But when I just test with -qt wallet program, after I click [Request payment], it generates new address, 3 times, made 3 addresses,

then I typed [dumpprivkey <address>] at console for each addresses above, it shows different private key per each address.

Why?

See above.


So then this means, wallet program is bunch of private keys gatherings, exchange run its bitcoin daemon, then this daemon has all the access the generated addresses given to users? Confused.

A wallet, in its simplest form, is a collection of private keys. Depending on the wallet software those may be stored in a wallet file or generated on the fly (ie. only the wallet seed is stored and private keys / addresses are derived as requested). Assuming a full node, this wallet software also checks for incoming and outgoing transactions.

The Bitcoin daemon is a headless wallet, that is: Instead of a GUI for users to click on, it provides an interface for other software to talk with.

Note that running the Bitcoin daemon on the same machine that hosts your web server is both the simplest and most insecure way to set up your infrastructure. At least assuming you use the Bitcoin daemon for generating addresses as well and not just watching the network.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
wsxdrfv (OP)
Jr. Member
*
Offline Offline

Activity: 405
Merit: 5


View Profile WWW
April 27, 2018, 08:36:18 AM
 #14

A wallet, in its simplest form, is a collection of private keys. Depending on the wallet software those may be stored in a wallet file or generated on the fly (ie. only the wallet seed is stored and private keys / addresses are derived as requested). Assuming a full node, this wallet software also checks for incoming and outgoing transactions.
The Bitcoin daemon is a headless wallet, that is: Instead of a GUI for users to click on, it provides an interface for other software to talk with.
Thanks for reply.
So how to consist exchange's wallet then?
Running a full node(really need to run as full node? how to know it is now full node?) of newest bitcoin node (0.16 version) support HD wallet, make bunch of addresses before, and when user join, assign one address to each user and store its info (what address belong to what user ID) to own DB?

Then this one exchange wallet (bitcoin daemon running on exchange's one physical server) has all the access to each user's addresses and its balance and can send to another address?

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!