Author

Topic: Many adresses for many coins. Building exchange (Read 180 times)

legendary
Activity: 4522
Merit: 3426
I keep my funds on a exchange, and i need an exchange to be able to echange the users crypto that is sent to me.

How would i exchange the users crypto for like 1% fee if i didnt use an exchange?

If you keep your funds in your own wallets, then you don't need an exchange. And charging 1% is easy. If the pair trades at 1 to 100, then you exchange at 1 to 99 or 1 to 101.

But I see what you are doing. You don't want to hold any inventory and you want to act as a broker between the customer and the exchange.

Many wallets do what you want to do. They set up a relationship with an exchange that allows them to be a broker. Checkout Binance Connect
newbie
Activity: 8
Merit: 1
I'm curious why Binance, which is an exchange, needed for your exchange.

Off the top of my head, here is a summary of how to create a simple exchange where you set the prices instead of using a market (because it is easier).

  • 1. Create a wallet for each kind of coin.
  • 2. Create a database for trades. Each entry would contain the amounts for each coin and their receiving addresses.
  • 3. Create a site that allows a person to create a trade.
    • 3a. The site gets an address from the wallet for the coin the customer is sending and shows it to the customer.
    • 3b. The set gets an address from customer for the coins the customer is buying.
    • 3c. The site records the transaction in the database.
  • 4. Create a backend that periodically scans the transaction database, gets the receiving addresses for the pending trades and checks the wallets to see if the coins have arrived. When the coins for a trade have arrived, it sends the customer's coins to the address they provided.

There you go. No need for Binance. Is that what you are doing?


Of course, I'm sure that there is a lot more involved in the implementation. You don't want to get hacked or end up like Mt. Gox.



I keep my funds on a exchange, and i need an exchange to be able to echange the users crypto that is sent to me.

How would i exchange the users crypto for like 1% fee if i didnt use an exchange?
legendary
Activity: 4522
Merit: 3426
I'm curious why Binance, which is an exchange, needed for your exchange.

Off the top of my head, here is a summary of how to create a simple exchange where you set the prices instead of using a market (because it is easier).

  • 1. Create a wallet for each kind of coin.
  • 2. Create a database for trades. Each entry would contain the amounts for each coin and their receiving addresses.
  • 3. Create a site that allows a person to create a trade.
    • 3a. The site gets an address from the wallet for the coin the customer is sending and shows it to the customer.
    • 3b. The set gets an address from customer for the coins the customer is buying.
    • 3c. The site records the transaction in the database.
  • 4. Create a backend that periodically scans the transaction database, gets the receiving addresses for the pending trades and checks the wallets to see if the coins have arrived. When the coins for a trade have arrived, it sends the customer's coins to the address they provided.

There you go. No need for Binance. Is that what you are doing?


Of course, I'm sure that there is a lot more involved in the implementation. You don't want to get hacked or end up like Mt. Gox.
hero member
Activity: 462
Merit: 767
Instant cryptocurrency exchange with own reserves!
Would you mind doing your own research about block.io
I feel like this wallet website could meet your needs.
staff
Activity: 3500
Merit: 6152
The user will have a uniqe order-id, so i was thinking if i could log that, plus his reciving adress and the amount he sent.
Then i would get notification when his coins arrive to my binance account and then just send him back 5% less ETH if i charged a 5% fee.

But he still would not get any notification that i have recived his coins while he is waiting or me to complete the exchange. 

I like you 1-4 description, thats exactly how i want it to work.
Do i need a node for each coin, like if i have 50 different coins, do i need a node for each one?
And what could that cost?

You should first confirm if Binance allows generating multiple addresses but as I said, I don't believe they do and even if they did, you will probably need to deal with the API limits as well, which doesn't help either.

The approach is correct though.
You create an address for the user and link it with the OrderID -> Wait until the address receives a transaction -> check for the amount -> wait for a few confirmations -> notify the user.

And yes, you would need different nodes for different coins. But if you're going to deal mainly with evm compatible networks then I would suggest you look into Alchemy, Infura, and Quicknode. They all have free tiers (there are limits on how many requests you can make, but it's still good) so maybe you can start with that at first and then upgrade.

As for your comment above, then yes, an instant exchange like Sideshift may be easier to develop and maintain compared to a CEX, but you should still take security seriously.
newbie
Activity: 8
Merit: 1
AFAIK, there's no way to generate a new address using Binance API.

What you need to do is run your own node, and communicate with it.

1. A user chooses the trading pairs.
2. You generate a bitcoin address for him.
3. Wait for a certain number of confirmations.
4. Send him the money.

I understand what you're trying to do, and one solution would be to once you're done with #3, you transfer the funds directly to Binance, and from there, you can exchange the funds and withdraw them however, I don't think this is the best solution because it will result into a very bad experience (since the user has to wait more than he should).

It's better to have some liquidity aside on Binance at first if this is how you want to do it and instead of sending each transaction you receive directly to Binance, you wait until you get a few, then batch everything to Binance. This should also save you some fees.

The user will have a uniqe order-id, so i was thinking if i could log that, plus his reciving adress and the amount he sent.
Then i would get notification when his coins arrive to my binance account and then just send him back 5% less ETH if i charged a 5% fee.

But he still would not get any notification that i have recived his coins while he is waiting or me to complete the exchange. 


I like you 1-4 description, thats exactly how i want it to work.
Do i need a node for each coin, like if i have 50 different coins, do i need a node for each one?
And what could that cost?



newbie
Activity: 8
Merit: 1
Im making an exchange
~
How do i generate a new deposit adress for each new user
If you have to ask this, you shouldn't build an exchange.

Wow, you are talking so much shit.

Its not rocketscience making a small exchange, and its even easier to maintain when its all set up.

It like i would say" if you have to ask how to fix a car, you shouldnt drive one".
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
Im making an exchange
~
How do i generate a new deposit adress for each new user
If you have to ask this, you shouldn't build an exchange.
staff
Activity: 3500
Merit: 6152
AFAIK, there's no way to generate a new address using Binance API.

What you need to do is run your own node, and communicate with it.

1. A user chooses the trading pairs.
2. You generate a bitcoin address for him.
3. Wait for a certain number of confirmations.
4. Send him the money.

I understand what you're trying to do, and one solution would be to once you're done with #3, you transfer the funds directly to Binance, and from there, you can exchange the funds and withdraw them however, I don't think this is the best solution because it will result into a very bad experience (since the user has to wait more than he should).

It's better to have some liquidity aside on Binance at first if this is how you want to do it and instead of sending each transaction you receive directly to Binance, you wait until you get a few, then batch everything to Binance. This should also save you some fees.
newbie
Activity: 8
Merit: 1
Im making an exchange like sideshift.ai.
I have 2 questions.


1. How do i generate a new deposit adress for each new user and each coin?

Like if you want to exchange BTC to ETH, you will get a BTC adress/QR code to send to.
But that unique adress needs to go to my binance account, or at least the deposit has to go to binance account. 
Is there like any API or so that generates sub adresses and then binding them all to my static btc adress on binance?

2. When a user send crypto to the deposit adress, he will get a notification that they are accepted by the blockchain network.
 Something like:
" thanks for your deposit, We will now exchange your BTC and send 0.124 ETH  to your wallet. You can now close your browser if you want".


I will have like 50 different coins in total, so not only BTC and ETH.

Jump to: