Author

Topic: [Discussion] Building an instant exchange (Read 459 times)

newbie
Activity: 427
Merit: 0
June 21, 2020, 03:51:55 AM
#6
I want to create an instant exchange (to make it open source) but I'm not sure about the logic behind this type of exchanges.

My current understanding:

{The exchange runs a full node for both ETH and BTC}

1. User makes a deposit
2. The exchange generate a BTC address for the user to send funds to
3. The user pays
4. The exchange wait until a certain amount of confirmation is reached
5. And then initiate a transaction to the user's ETH address

So basically, your order doesn't have to match someone else's order, you're buying/selling from/to the exchange itself.

But I then came across this post and also looked into CoinSwitch and it appears that some instant exchange are buying directly from centralized platforms like Binance, Bittrex, Hitbtc etc. So does that mean that these platforms are running without liquidity to start with? Do they just let you deposit to their addresses, and then they forward them to the exchange, buy the coin and withdraw to your address? I find that hard to believe, but I guess this could easily go unnoticed if an exchange require a high amount of confirmations.

Something else I've noticed is that some platforms tend to have the same trading pairs, which might also prove that they're dealing with certain third parties.

Thanks!



Hello can you can your exchange also list another coins too?
member
Activity: 84
Merit: 22
Do you want something like https://changelly.com/ ? If yes, I could help you out and guide you for free.

legendary
Activity: 1624
Merit: 2481
They use a double system, having their own coins in their private wallets and other coins on the exchange.
When you send ETH to the instant exchange wallet, the same time they receive the coins they execute an exchange of ETH>BTC on Binance or Okex or whatever, and then they release your BTC from their own funds. At the end of the day, they deposit or withdraw coins to balance the pairs again and have funds available.

Definitely this.

I can't speak for all of them, but the majority does indeed work like this.
That's the only way to guarantee a specific conversion rate without waiting for a few confirmations where the rate could fluctuate.


Oh, and since you are going to open source it, don't forget to include the random 0.1% chance of having your funds locked due to "security" reasons incl. required KYC to release the funds. Every proper instant exchange needs that.
Code:
if (getRandomNumber(0, 999) == 666):
    lockFunds()
    requestKYC()
   
newbie
Activity: 21
Merit: 1
Easiest way to implement such a exchange is to use Binance ( or similar ) API to generate deposit address, switch the coins, and withdraw.
And the easiest way to implement something is most likely how they run.
legendary
Activity: 2912
Merit: 6403
Blackjack.fun
So does that mean that these platforms are running without liquidity to start with? Do they just let you deposit to their addresses, and then they forward them to the exchange, buy the coin and withdraw to your address? I find that hard to believe, but I guess this could easily go unnoticed if an exchange require a high amount of confirmations.

Not really, I don't know about all of them but I'm sure at least one of them works like this.

They use a double system, having their own coins in their private wallets and other coins on the exchange.
When you send ETH to the instant exchange wallet, the same time they receive the coins they execute an exchange of ETH>BTC on Binance or Okex or whatever, and then they release your BTC from their own funds. At the end of the day, they deposit or withdraw coins to balance the pairs again and have funds available.





staff
Activity: 3500
Merit: 6152
I want to create an instant exchange (to make it open source) but I'm not sure about the logic behind this type of exchanges.

My current understanding:

{The exchange runs a full node for both ETH and BTC}

1. User makes a deposit
2. The exchange generate a BTC address for the user to send funds to
3. The user pays
4. The exchange wait until a certain amount of confirmation is reached
5. And then initiate a transaction to the user's ETH address

So basically, your order doesn't have to match someone else's order, you're buying/selling from/to the exchange itself.

But I then came across this post and also looked into CoinSwitch and it appears that some instant exchange are buying directly from centralized platforms like Binance, Bittrex, Hitbtc etc. So does that mean that these platforms are running without liquidity to start with? Do they just let you deposit to their addresses, and then they forward them to the exchange, buy the coin and withdraw to your address? I find that hard to believe, but I guess this could easily go unnoticed if an exchange require a high amount of confirmations.

Something else I've noticed is that some platforms tend to have the same trading pairs, which might also prove that they're dealing with certain third parties.

Thanks!
Jump to: