We are developing bitcoin wallet for multi-user. We are using Bitcoin core as Bitcoin wallet. Bitcoin core is generating random address. we cannot show balance because After one transaction rest of user's balance goes to a new address. so we can not show the real balance of any user? But we can not use old accounting system. How to create multi-user bitcoin wallet using UTXO and show user address balance.
1 Answer
I'm assuming that you're using a fully custodial setup. You need to implement logic to keep track of their balances in a database. Hereby, you give each new user a new deposit address and keep track whom you have shown which addresses. When you receive funds, you credit the corresponding user in your database. When they withdraw, you deduct from their balance. Hereby, you need to consider the confirmation status and transaction fees of the corresponding transactions.
To be honest, if you're having trouble mapping individual user balances to your customers, it worries me that you are aiming to manage funds for others. You should perhaps consider relying on a third party service to manage the funds of your business for you. However, even then you'll need to implement the basic business logic yourself.