0

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

2
  • 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
    Jan 22, 2020 at 21:17
  • 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
    Jan 22, 2020 at 21:21

2 Answers 2

3

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

12
  • 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
    Jan 22, 2020 at 19:05
  • 1
    @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. Jan 22, 2020 at 19:07
  • 1
    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. Jan 22, 2020 at 19:15
  • 1
    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. Jan 22, 2020 at 21:18
  • 2
    I expect that literally every wallet can do this. Don't use a hosted solution. Jan 22, 2020 at 21:54
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.

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.

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.

4
  • How to create all users addresses in single wallet, so then I can make a single transfer? With which wallet?
    – Genti
    Jan 22, 2020 at 22:09
  • 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. Jan 22, 2020 at 22:13
  • I need also wallets with HD for USDT in Omni, Tron and Ethereum chains..
    – Genti
    Jan 22, 2020 at 22:25
  • 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. Jan 23, 2020 at 0:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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