Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: Elwar on June 04, 2014, 09:40:37 AM



Title: Bitcoind setaccount/sendfrom issues
Post by: Elwar on June 04, 2014, 09:40:37 AM
I have a list of public and private keys with associated public addresses I need to send bitcoins to.

To get this to work I do:
bitcoind getbalance testaccount
bitcoind importprivkey 5xyzabc.....
bitcoind setaccount 1xyzabc... testaccount
bitcoind getbalance testaccount
(if balance is higher by 'amount')
bitcoind sendfrom testaccount 1toaddress... 'amount'

When I ran this, it did not send from the right address:
bitcoind.exe getbalance test
Return: 0.00000000
bitcoind.exe importprivkey ....
bitcoind.exe setaccount  1BPMNDJqfgSx55x4fME26DtQDtBEtKiKuT test
bitcoind.exe getbalance test
Return: 1.00000000
bitcoind.exe sendfrom test 1Fbn8VVuUyejnPasPjjTdPXtQbutiyqxve 1.0

Here is the returned transaction ID:
184bd8b35e74f214e665b4cf101bc86f87aef0c81e7cdd6137a53c23cd2ad14e

You can see here that 1BPMNDJqfgSx55x4fME26DtQDtBEtKiKuT has not changed amount:
https://blockchain.info/address/1BPMNDJqfgSx55x4fME26DtQDtBEtKiKuT


Am I missing something with setaccount and sendfrom?


Title: Re: Bitcoind setaccount/sendfrom issues
Post by: Foxpup on June 05, 2014, 04:17:02 AM
You're missing that accounts have nothing whatsoever to do with addresses. The only thing that setaccount does is causes coins sent to a particular address to be credited to a particular account instead of the default account. Coins sent from an account merely sends whatever coins are available, and deducts the amount from the account, which is what you would normally expect. After all, when you deposit cash in a bank account, you don't expect that the notes you later withdraw will be the exact same ones that you deposited, or get upset that somebody else withdraws "your" notes. If you expect anything else, you don't understand how accounts work and shouldn't be using them (you probably shouldn't be using them anyway, but for different reasons).