Author

Topic: bitcoind sendtoaddress json-rpc method. (Read 2311 times)

newbie
Activity: 54
Merit: 0
April 06, 2013, 09:52:06 AM
#2
Found the answer: Yes, new keys are added to the wallet when sending coins. Trying to use two wallets, assuming they would stay in sync once keys from one wallet was imported in the other, was a big mistake. For anyone else, who might jump to a similar naive conclusion: read up on "nitcoin key pool".
newbie
Activity: 54
Merit: 0
April 05, 2013, 12:34:42 PM
#1
Hi, I'm writing an Java wrapper or client for calling the bitcoind json-rpc methods, and don't understand what sendtoaddres is doing, so I hope someone her can help me understand what's going on.

I have bitcoind running (on testnet), and sent it this request:
{"jsonrpc":"2.0","method":"sendtoaddress","params":["mwswEtw6t2ziSjsfip62FPg84NXGsJ5H2o",0.01000000,"Comment","CommentTO"]}
and got this response: {"result":"75e5bcefb0440216780c502c5eadbec46e44af7d129d081ffdb136b336d74e13","error":null,"id":null}

Seemed fine, but when the transaction showed up in MultiBit, which I also have running on testnet, the description said "Sent to mwswEtw6t2ziSjsfip62FPg84NXGsJ5H2o" and the amount was -5  Huh

And the details:
  75e5bcefb0440216780c502c5eadbec46e44af7d129d081ffdb136b336d74e13: Seen by 1 peer. Appeared in best chain at height 64.163.
     from mj3QxNUyp4Ry2pbbP19tznUAAPqFvDbRFq / outpoint 280acc1c3611fee83331465c715b0da2d10b65733a688ee2273fdcc7581f149b:0
       to mnjiPR1962hdXNGXVsdaeJsAEC21YZVhAA 4.99 BTC
       to mwswEtw6t2ziSjsfip62FPg84NXGsJ5H2o 0.01 BTC

Looks very weird at first glance, but I suspect that the transactions are OK and that the problem really is that the two initially identical wallets gets out of sync, so I guess the real question is: does sendtoaddress add new addresses to the wallet, ind if so, does that mean that whenever I send some coins I will have to make a new backup of my wallet?

Best Regards
Claus Nielsen
Jump to: