DarkEmi (OP)
|
|
April 23, 2013, 11:51:51 AM |
|
Hello,
We are trying to use the bitcoind official client (last version) to automate payments, using the command line API.
We are encountering the following (very annoying) issue :
"bank" is having 0.0995 from the "bitcoind getbalance"
This is what we have from the "listgrouping" :
[ [ [ "1up3hyCXBeaa97FkCsw8XiWS2bJnrsRgJ", 0.10000000, "up3h" ] ], [ [ "1PLz8h5p5MmYNpTGhuYGXH7p5sAYefPi25", 0.09950000 ], [ "1bankbMhn2zg35UcHYNS83YkD3WoDv9p6", 0.00000000, "bank" ] ] ]
Now when we do this : console/ bitcoind sendmany "bank" '{ "1bankbMhn2zg35UcHYNS83YkD3WoDv9p6":0.0995}' => tid: 497e4049a290195609216079297c78703dbd10c439b6c0a3cf48cde192d8da37
This should not work as we have to pay the transaction ID, but the client is taking the 1 bitcoin FROM the "up3h" account to send them to 1bankbMhn2zg35UcHYNS83YkD3WoDv9p6, when we never specified this account.
Is this a bug ? Is there a way to ensure that all accounts are well separated, ie that the client will never take coins from account A if we tell me it to take it from account B, independently of any situation ?
Regards,
Emilien
|
|
|
|
DarkEmi (OP)
|
|
April 23, 2013, 11:54:05 AM |
|
Also we tried using the "account" mechanism since the beginning (as there is no easy way to use addresses directly except by raw transaction which seems too technical for us),
but we keep having weird and unexpected behavior.
On the wiki all the description of the account mechanism use the mailbox and houses metaphor but from our experience either this mechanism is bugged or there is definitely something we dont understand here.
|
|
|
|
CIYAM
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
April 23, 2013, 11:55:06 AM |
|
You cannot choose *addresses* with account commands instead you would need "coin control" (search) or use the raw tx API.
Basically do not confuse "accounts" with "accounting" they are instead more like "user accounts" (and used by very few people AFAIA).
|
|
|
|
kjj
Legendary
Offline
Activity: 1302
Merit: 1026
|
|
April 23, 2013, 11:55:29 AM |
|
Accounts are just an internal bookkeeping thing. Coins don't belong to them.
|
17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8 I routinely ignore posters with paid advertising in their sigs. You should too.
|
|
|
DarkEmi (OP)
|
|
April 23, 2013, 11:58:03 AM |
|
Are there some really simple tutorial or documentation on how to use the raw transaction API ?
Everything I have seen seemed either messy or overly complex
|
|
|
|
CIYAM
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
April 23, 2013, 12:02:00 PM |
|
The docco is https://en.bitcoin.it/wiki/Raw_Transactions but yes it is not really designed for the feint of heart (and is a very easy way to lose bitcoins if you get anything wrong). Perhaps you could give a more exact idea about what kind of raw tx you will need? (if it is just taking a single UTXO and sending it all to an address then that is very simple to do - you might also find the "Transactions" tab in https://brainwallet.org to be a helpful template)
|
|
|
|
DarkEmi (OP)
|
|
April 23, 2013, 12:06:31 PM |
|
I want to do the following type of transaction :
From address A send x bitcoin to address B send all the remaining bitcoin in address A back to address A
(This is basically what I tried doing with the "account" mechanism but with multiple addresses and account it seems like the account interface is kinda "random" at times and does a lot of unexpected stuff, like taking from address outside of one account and stuff...)
|
|
|
|
deepceleron
Legendary
Offline
Activity: 1512
Merit: 1036
|
|
April 23, 2013, 12:08:14 PM |
|
The accounts feature has been ignored and abandoned, and new development has continued largely ignoring this "feature". The selection of coins and the receiving of change seems to ignore it, and it is typical to see wild negative and positive balances on accounts after some use. Any modern development uses it's own databases to track user's balances.
Raw transactions are a good way to accidentally send your bitcoin balance to fees, as several have experienced. I can't think of a good scenario for a commerce site to use it, unless you were constructing special transactions for which there is not yet an API method (3 in 5, contracts, or other "test" transactions).
|
|
|
|
DarkEmi (OP)
|
|
April 23, 2013, 12:10:53 PM |
|
So do you have any advice ? We do not want to build a complete database of transaction of whatever, we want the fastest and easiest way to do that with the minimun amount of work and minimun risk of bug for a commercial application : From address A send x bitcoin to address B send all the remaining bitcoin in address A back to address AAt least it is good to know the account mechanism is kinda abandonned cause we were almost banging our heads in the wall trying to use it
|
|
|
|
CIYAM
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
April 23, 2013, 12:13:42 PM |
|
From address A send x bitcoin to address B send all the remaining bitcoin in address A back to address A
In that case you'll find that the "brainwallet" template does *exactly* what you want (you'll just need to use the "listunspent" call to plug in the correct information) - btw - I would not recommend that you use "brainwallet" website with your private keys (although it can be used offline if you are willing to trust it that way). If you look carefully at the Transactions tab you'll see that it does send the change back to the original *from* address (note the fee is the difference between the amount you send to the other address and the amount that you send back to the original address). The tricky bit is if you need multiple "inputs" (rather than just the one) - also the brainwallet Transactions tab does allow you to add other unspent outputs but automating this would not be trivial at all.
|
|
|
|
DarkEmi (OP)
|
|
April 23, 2013, 12:22:25 PM |
|
Thanks you for your feedback this is really appreciated.
But yes the brainwallet application does exactly that and it is nice, but this is an outside webpage and so I don't see how we could use it to automate our payments which is our goal, since there is no outside API and I dont feel confident porting javascript code to our own framework.
|
|
|
|
CIYAM
Legendary
Offline
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
|
|
April 23, 2013, 12:26:47 PM |
|
Yes - I feel your pain (I do all CIYAM Open payments *manually* at this stage).
Basically you would need to write an algo that adds all the inputs (which you find with "listunspent") to your raw tx JSON and then add the two outputs (whilst working out the balances correctly to get that right).
It isn't probably that much work (a few hours) but you would need to do a lot of testing to make sure you don't get anything wrong.
|
|
|
|
|