<p>You give each customer a different address. That is the only reasonable approach.</p>

CC BY-SA 4.0
2020-01-22T19:05:35.880Z
I can generate addresses for each customer, but then I need to have all the amount in one address, cause all the amount will be used. There can be a solution if I can create multiple addresses inside one wallet, so I can make the transfer from multiple addresses in a single transfer, if you know an API to do this, it would be the solution..
Genti
CC BY-SA 4.0
2020-01-22T19:07:12.163Z
@GesaVoIP That is not how Bitcoin works. You do not need all coins in one address. Doing so hurts your accounting, your privacy, and the privacy of everyone you interact with. Don't reuse addresses.
Pieter Wuille
CC BY-SA 4.0
2020-01-22T19:10:44.033Z
I will use the BTC amount man, I will be trading with the amount. Its a trading bot app
Genti
CC BY-SA 4.0
2020-01-22T19:15:21.827Z
There are so many red flags here. You shouldn't be using a third party to hold your users' funds (use a self-managed wallet instead), you shouldn't be trading with your users' funds (keep your funds separate from your users'), and don't reuse addresses. This is all I will say; the way to figure out what account was credited is by not reusing addresses. If the approach you're using makes that hard/impossible, the approach is broken.
Pieter Wuille
CC BY-SA 4.0
2020-01-22T19:17:34.093Z
Its a trading bot app, users will agree to it, if you can give a solution to my problem it would be great !
Genti
CC BY-SA 4.0
2020-01-22T21:18:10.513Z
I think the solution would be instead manage your own wallet that users pay into (so that you can give each a different address), and then move the coins into/out of the exchange as needed, with proper accounting.
Pieter Wuille
CC BY-SA 4.0
2020-01-22T21:38:35.073Z
That said, I don't understand why you can't request a separate address for each user from the exchange, and still do your own accounting.
Pieter Wuille
CC BY-SA 4.0
2020-01-22T21:40:59.967Z
Because if I have at minimum 100 users that deposit each one 0.01 BTC, I should then go to 100 accounts and transfer each of those 0.01 BTC one by one to my trading account.. This is the reason
Genti
CC BY-SA 4.0
2020-01-22T21:43:50.360Z
You would have 1 wallet that every user pays into, but each through a different address. If 100 users paid 0.01 BTC each, that wallet will have 1 BTC, and with a single transaction you can move that to an exchange.
Pieter Wuille
CC BY-SA 4.0
2020-01-22T21:49:30.883Z
That would be the solution but which wallet API do you recommend to do that? I have tried the blockchain.com API can create addresses for each user but not in the same wallet. If you know another wallet API that can work, for BTC and USDT it would be great !
Genti
CC BY-SA 4.0
2020-01-22T21:54:48.523Z
I expect that literally every wallet can do this. Don't use a hosted solution.
Pieter Wuille
CC BY-SA 4.0
2021-01-22T19:43:08.403Z
@PieterWuille My reply might be a little late but you wrote that "you would have 1 wallet that every user pays into, but each through a different address. If 100 users paid 0.01 BTC each, that wallet will have 1 BTC, and with a single transaction you can move that to an exchange". It is not really a "single transaction" as the transaction consists of 100 UTXO (100 inputs) (so 100 * fee). The only benefit of using HD wallet is that it simplifies generation of addresses via 1 seed/PK. Am I correct?
S.O.S
CC BY-SA 4.0
2020-01-22T18:59:42.767Z
2020-01-22T18:59:42.767Z
Pieter Wuille
<p>Your proposed approach is not practical:</p>

<ol>
<li>Users might change the amount, or omit the fractional part</li>
<li>The fractional part might represent significant value - a user with an ID of 1234567 will have to pay a minimum of 0.01234567, well over a hundred USD at the moment</li>
<li>If users are withdrawing from an exchange or some other wallet without much control over the transactions, they might not be able to set the value beyond the first four decimals. Additionally, some custodial wallets batch payments, combining multiple outputs to one address into a single output with a summed value.</li>
</ol>

<p>Pieter is right, the only reasonable way to approach this is to assign unique addresses for each user, and forwarding funds from there to your trading accounts. It is important to control the keys at the point money flows into your system. It is not unheard of exchanges to update their deposit addresses, either as part of normal key rollover or due to a hack. It is a lot easier for you to change a single forwarding address in your system, than to convince all of your users to update it.</p>

<p>All of your user addresses can be in a single wallet - managing the funds and forwarding them to a trading service will be no different from any other transaction you make. Any transaction fees incurred are simply the cost of doing business, and you can decide if you wish to pass those on to users or absorb them.</p>

CC BY-SA 4.0
2020-01-22T22:09:51.727Z
How to create all users addresses in single wallet, so then I can make a single transfer? With which wallet?
Genti
CC BY-SA 4.0
2020-01-22T22:13:07.610Z
Every wallet supports an HD chain these days, which lets you derive the addresses from a single seed. You should be able to find a library in your language of choice for this (for example, BitcoinJS-lib for javascript) - Based on your questions, you might be a little out of your depth here, and should consider hiring someone to, at the very least, help you architect the part of the system that handles the crypto - making a mistake here can be very costly, and very permanent.
Raghav Sood
CC BY-SA 4.0
2020-01-22T22:25:47.947Z
I need also wallets with HD for USDT in Omni, Tron and Ethereum chains..
Genti
CC BY-SA 4.0
2020-01-23T00:37:44.233Z
Those get considerably more complex, as for USDT on all three chains you need additional BTC, tron, or ETH to pay transaction fees from each address - you will likely not find an out of the box, available solution for these. You will have to build it yourself, or hire someone to do it for you.
Raghav Sood
CC BY-SA 4.0
2020-01-22T21:46:01.963Z
2020-01-22T21:52:00.393Z
2020-01-22T21:52:00.393Z
Raghav Sood
<p>I am making an app, and I want my users to deposit BTC coin to my address which is an exchange address (I don't have the private keys).</p>

<p>How can I know which user made which transaction?</p>

<p>I have a way, which is to add the numeric user ID to the amount , for example if an user wants to deposit 100.00 BTC coin , and the ID is 158769, I can add the ID in the amount like this: 100.0000158769 and make it as a QR-code so the user should deposit the exact amount so I can know that he made this transaction.</p>

<p>But is there any other way to do it , any idea?</p>

<p>Thanks in advance</p>

CC BY-SA 4.0
2020-01-22T21:17:30.657Z
If your user changes the deposit amount post QR-code generation (which is very possible for them to do), then you will have no way to relate the actual payment to the actual customer. This will create a nightmare or accounting work that will be almost impossible to complete accurately.
chytrik
CC BY-SA 4.0
2020-01-22T21:21:19.880Z
Thats why I am asking for another solution..! In my solution, the user can change the amount, but his deposit will not be counted then, so users will be advised and explained why to deposit the exact amount. But as I said, my question is to get another solution
Genti
<api><bip32-hd-wallets><deposit>
How can I know which user made which BTC transaction?
Genti
# How can I know which user made which BTC transaction?

(Asked by: username_0 on 2020-01-22)

I am making an app, and I want my users to deposit BTC coin to my address which is an exchange address (I don't have the private keys).

How can I know which user made which transaction?

I have a way, which is to add the numeric user ID to the amount , for example if an user wants to deposit 100.00 BTC coin , and the ID is 158769, I can add the ID in the amount like this: 100.0000158769 and make it as a QR-code so the user should deposit the exact amount so I can know that he made this transaction.

But is there any other way to do it , any idea?

Thanks in advance

**Tags:** api, bip32-hd-wallets, deposit

> **Comments:**
> **username_1**: If your user changes the deposit amount post QR-code generation (which is very possible for them to do), then you will have no way to relate the actual payment to the actual customer. This will create a nightmare or accounting work that will be almost impossible to complete accurately.  
> **username_0**: Thats why I am asking for another solution..! In my solution, the user can change the amount, but his deposit will not be counted then, so users will be advised and explained why to deposit the exact amount. But as I said, my question is to get another solution  

---

## 2 answers

### Answer by username_2 on 2020-01-22. Score: 3

You give each customer a different address. That is the only reasonable approach.

> **Comments:**
> **username_0**: I can generate addresses for each customer, but then I need to have all the amount in one address, cause all the amount will be used. There can be a solution if I can create multiple addresses inside one wallet, so I can make the transfer from multiple addresses in a single transfer, if you know an API to do this, it would be the solution..  
> **username_2**: @GesaVoIP That is not how Bitcoin works. You do not need all coins in one address. Doing so hurts your accounting, your privacy, and the privacy of everyone you interact with. Don't reuse addresses.  
> **username_0**: I will use the BTC amount man, I will be trading with the amount. Its a trading bot app  
> **username_2**: There are so many red flags here. You shouldn't be using a third party to hold your users' funds (use a self-managed wallet instead), you shouldn't be trading with your users' funds (keep your funds separate from your users'), and don't reuse addresses. This is all I will say; the way to figure out what account was credited is by not reusing addresses. If the approach you're using makes that hard/impossible, the approach is broken.  
> **username_0**: Its a trading bot app, users will agree to it, if you can give a solution to my problem it would be great !  
> **username_2**: I think the solution would be instead manage your own wallet that users pay into (so that you can give each a different address), and then move the coins into/out of the exchange as needed, with proper accounting.  
> **username_2**: That said, I don't understand why you can't request a separate address for each user from the exchange, and still do your own accounting.  
> **username_0**: Because if I have at minimum 100 users that deposit each one 0.01 BTC, I should then go to 100 accounts and transfer each of those 0.01 BTC one by one to my trading account.. This is the reason  
> **username_2**: You would have 1 wallet that every user pays into, but each through a different address. If 100 users paid 0.01 BTC each, that wallet will have 1 BTC, and with a single transaction you can move that to an exchange.  
> **username_0**: That would be the solution but which wallet API do you recommend to do that? I have tried the blockchain.com API can create addresses for each user but not in the same wallet. If you know another wallet API that can work, for BTC and USDT it would be great !  
> **username_2**: I expect that literally every wallet can do this. Don't use a hosted solution.  
> **username_3**: @username_2 My reply might be a little late but you wrote that "you would have 1 wallet that every user pays into, but each through a different address. If 100 users paid 0.01 BTC each, that wallet will have 1 BTC, and with a single transaction you can move that to an exchange". It is not really a "single transaction" as the transaction consists of 100 UTXO (100 inputs) (so 100 * fee). The only benefit of using HD wallet is that it simplifies generation of addresses via 1 seed/PK. Am I correct?  

---

### Answer by username_4 on 2020-01-22. Score: 1

Your proposed approach is not practical:

1. Users might change the amount, or omit the fractional part
2. The fractional part might represent significant value - a user with an ID of 1234567 will have to pay a minimum of 0.01234567, well over a hundred USD at the moment
3. If users are withdrawing from an exchange or some other wallet without much control over the transactions, they might not be able to set the value beyond the first four decimals. Additionally, some custodial wallets batch payments, combining multiple outputs to one address into a single output with a summed value.

username_2 is right, the only reasonable way to approach this is to assign unique addresses for each user, and forwarding funds from there to your trading accounts. It is important to control the keys at the point money flows into your system. It is not unheard of exchanges to update their deposit addresses, either as part of normal key rollover or due to a hack. It is a lot easier for you to change a single forwarding address in your system, than to convince all of your users to update it.

All of your user addresses can be in a single wallet - managing the funds and forwarding them to a trading service will be no different from any other transaction you make. Any transaction fees incurred are simply the cost of doing business, and you can decide if you wish to pass those on to users or absorb them.

> **Comments:**
> **username_0**: How to create all users addresses in single wallet, so then I can make a single transfer? With which wallet?  
> **username_4**: Every wallet supports an HD chain these days, which lets you derive the addresses from a single seed. You should be able to find a library in your language of choice for this (for example, BitcoinJS-lib for javascript) - Based on your questions, you might be a little out of your depth here, and should consider hiring someone to, at the very least, help you architect the part of the system that handles the crypto - making a mistake here can be very costly, and very permanent.  
> **username_0**: I need also wallets with HD for USDT in Omni, Tron and Ethereum chains..  
> **username_4**: Those get considerably more complex, as for USDT on all three chains you need additional BTC, tron, or ETH to pay transaction fees from each address - you will likely not find an out of the box, available solution for these. You will have to build it yourself, or hire someone to do it for you.  

---

