0

I'm a softawre developer & newly involved in Blockchain Technology.

I need information about How Cryptocurrency Exchange Technically work? i.e Buy ETH using BTC or exchanging any coin with another coin etc.

I know all the other terms/things needed for exchange like, Legal, security, KYC, peer to peer etc.

I search many articles but didn't found any technical architecture. found following

There are readymade API's like block.io, chain.com, blockcypher.com etc who provide such thing. but want to develope it from core ie bitcoind Github.

  • I have good conceptual knowledge of Blockchain, Solidity etc.
  • Working with Bitcoin Core for creating new address, sending BTC to another address vai CMD prompt.
  • Able to implement Block Explorer etc.
  • Able to create new Coin/Currency in Solidity using ETH Compiler.

What I really need is Direction & path to follow. As the technology is new, resources are very few. Any technical help I really appreciate.

Thank you, Have a great day.

closed as too broad by Adam, pebwindkraft, chytrik, alcio, Willtech Mar 7 '18 at 9:54

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Welcome to bitcoin.SE! I think it will be difficult to find such advise here. Mostly we are here to answer technical questions, but yours is extending to the conceptual level. And other exchanges would keep the way, how they do trading between the cryptos as a secret. There is a p2p exchange (github.com/bisq-network/exchange), which might have sources that you can look into... – pebwindkraft Mar 5 '18 at 8:47
  • @pebwindkraft Thanks very much for sharing link. Its valuable for me. Is their anything that you can help(links,docs,pdf,groups), kindly share on vd30992@gmail.com – Vishal Dalve Mar 5 '18 at 8:59
  • Why my question is on HOLD ??? Can anybody explain?? – Vishal Dalve Mar 9 '18 at 5:21
  • most likely because the way an exchange works is very hard to be answered in a single thread, and also it has very little to do with technical aspects of bitcoin :-) – pebwindkraft Mar 10 '18 at 6:30
  • @pebwindkraft I agreed but no one even want to share a little amount of knowledge about it like #MartineSolie did. Is their any medium to ask such kind of questions? – Vishal Dalve Mar 10 '18 at 7:27
3

There is opensource asset exchange called Peatio written in ruby. You can look into its source code to see what happens with assets during their lifetime there.

Mainly there are 3 steps for exchange:

  1. Deposit - put real coins to exchange's accounts
  2. Exchange - change coins, by changing just values of accounts' balances
  3. Withdraw - send real coins from exchange's accounts to end user

When user sends deposit request, exchange generates new address (sends rpc request to btc node), and assigns it to deposit entity in db. User have to send sufficient amount of btc, to fulfill deposit. When special daemon watcher finds incoming transaction to the address assigned to some deposit entity, it compares incoming amount with required one and waits for confirmations. If there are enough btcs and confirmations - daemon increases amount of user's account balance.

Then, during user's exchanges, exchange engine just changes numbers in db, so no real transactions are provided. This allows very fast fast and network fee free exchanges.

When user decides to spend bitcoins from account, he sends withdrawal request to exchange. Exchange checks user's balance and if there are enough coins, sends them from its wallet to user's address and decreases user's balance

In such system security of the main server is critical. All coins are stored on wallets of the system and can be spent by it. So cold wallet is usually used in such exchanges. Nearly 90% of total amount of all coins are sent to some secured wallet: hardware wallet or at least wallet, that is stored on a system that doesn't have internet connection. When there is not enough coins on hot wallet to create withdrawal, alert is sent to admin, and he manually sends some coins from cold wallet to hot.

If you don't want to allow trading, and just want exchange, you can remove Exchange step, and create withdrawal just after deposit fulfillment. But then you have to determine price of the pair.

This is not the only approach to asset exchanges. There are also approaches when users control their wallets on exchange, and approaches when decisions to change user's balance are taken by several nodes together.

  • Really good answer, some technical doubts cleared. Thanks :-) – Vishal Dalve Mar 6 '18 at 7:11

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