Move bitcoins from one address to another using JSON RPC

0

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!

John Graham

Posted 2017-06-08T19:23:21.713

Reputation: 73

Answers

1

The leftover 0.5 BTC is sent to a change address because it is not good practice to reuse addresses. You would simply have to assign the change addresses to the users.

doffing81

Posted 2017-06-08T19:23:21.713

Reputation: 474