I am developing a website where each user has a unique bitcoin address and each user can receive or send money. I have a bitcoin node running, so I connect to it to run json-rpc api calls.
The problem which I have is the following: If one user has 1BTC and send 0.5BTC to the external wallet. I want that the user has 0.5 BTC in his wallet but right now with sendtoaddress api call the 0.5 BTC remaining aren't in the original wallet, the 0.5 BTC is moved to a new address from the wallet.
I don't see right now how can achieve it through json-rpc calls, if someone could help I'd be grateful!