Bitcoin Forum
May 24, 2024, 08:38:32 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Problem using accounts  (Read 815 times)
DarkEmi (OP)
Full Member
***
Offline Offline

Activity: 223
Merit: 100



View Profile
April 23, 2013, 11:51:51 AM
 #1

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

ProProfi.com
The first home improvement service cryptocurrency project
ICO | Discuss on Forum
DarkEmi (OP)
Full Member
***
Offline Offline

Activity: 223
Merit: 100



View Profile
April 23, 2013, 11:54:05 AM
 #2

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.

ProProfi.com
The first home improvement service cryptocurrency project
ICO | Discuss on Forum
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1078


Ian Knowles - CIYAM Lead Developer


View Profile WWW
April 23, 2013, 11:55:06 AM
 #3

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).

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1025



View Profile
April 23, 2013, 11:55:29 AM
 #4

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)
Full Member
***
Offline Offline

Activity: 223
Merit: 100



View Profile
April 23, 2013, 11:58:03 AM
 #5

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

ProProfi.com
The first home improvement service cryptocurrency project
ICO | Discuss on Forum
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1078


Ian Knowles - CIYAM Lead Developer


View Profile WWW
April 23, 2013, 12:02:00 PM
 #6

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)

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
DarkEmi (OP)
Full Member
***
Offline Offline

Activity: 223
Merit: 100



View Profile
April 23, 2013, 12:06:31 PM
 #7

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...)

ProProfi.com
The first home improvement service cryptocurrency project
ICO | Discuss on Forum
deepceleron
Legendary
*
Offline Offline

Activity: 1512
Merit: 1032



View Profile WWW
April 23, 2013, 12:08:14 PM
 #8

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)
Full Member
***
Offline Offline

Activity: 223
Merit: 100



View Profile
April 23, 2013, 12:10:53 PM
 #9

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 A


At 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 Cheesy

ProProfi.com
The first home improvement service cryptocurrency project
ICO | Discuss on Forum
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1078


Ian Knowles - CIYAM Lead Developer


View Profile WWW
April 23, 2013, 12:13:42 PM
 #10

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.

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
DarkEmi (OP)
Full Member
***
Offline Offline

Activity: 223
Merit: 100



View Profile
April 23, 2013, 12:22:25 PM
 #11

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.

ProProfi.com
The first home improvement service cryptocurrency project
ICO | Discuss on Forum
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1078


Ian Knowles - CIYAM Lead Developer


View Profile WWW
April 23, 2013, 12:26:47 PM
 #12

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.

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!