Bitcoin Forum
December 12, 2024, 06:50:31 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 »  All
  Print  
Author Topic: Why is account showing as empty even after doing a setaccount?  (Read 2518 times)
CIYAM (OP)
Legendary
*
Offline Offline

Activity: 1890
Merit: 1086


Ian Knowles - CIYAM Lead Developer


View Profile WWW
February 25, 2012, 10:18:21 AM
Last edit: February 29, 2012, 03:22:27 AM by CIYAM Pty. Ltd.
 #1

I have just started playing with bitcoind (under Windoze using the 0.4.0 and running the GUI as the server) and noticed that when I did a "listtransactions" an entry like this:

...
{
    "account" : "",
    "address" : "1XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX6",
    "category" : "send",
    "amount" : -0.50000000,
    "fee" : 0.00000000,
    "confirmations" : 1234,
    "txid" : "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "time" : 1213411747
},
...

I wanted to put an account on the 1XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX6 address so I initially did this via the GUI (which shows up in the Address book fine) but it just stayed blank in the listtransactions output when I re-ran the command.

So I then ran the following:

bitcoind setaccount 1XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX6 name

and it created a new address (documented behavior if the account name is the same as it already has I read) so why can't I see the account when I do listtransactions?

Strangely enough if I run this:

bitcoind getaccount 1XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX6

then it returns "name" is one would expect.

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

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
deepceleron
Legendary
*
Offline Offline

Activity: 1512
Merit: 1036



View Profile WWW
February 25, 2012, 11:53:14 AM
 #2

The accounting system exposed by bitcoind is completely whacked. The last time I used it I had several negative account balances and no others added up to anything resembling what was in the addresses. The GUI ignores it for the most part, leaving wild balances, and it should be thrown away and just addresses and labels used.
CIYAM (OP)
Legendary
*
Offline Offline

Activity: 1890
Merit: 1086


Ian Knowles - CIYAM Lead Developer


View Profile WWW
February 25, 2012, 12:42:06 PM
Last edit: February 29, 2012, 03:23:03 AM by CIYAM Pty. Ltd.
 #3

Ouch - was thinking that I must have done something wrong rather than finding bugs in the very first RPC command I tested. Sad

Interestingly the problem only seems to occur for the "sent" tx's as I do see all the account names for the "receive" tx's fine (so perhaps a fix for at least this part may not be to hard).


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

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
Nefario
Hero Member
*****
Offline Offline

Activity: 602
Merit: 513


GLBSE Support support@glbse.com


View Profile WWW
February 25, 2012, 12:50:06 PM
 #4

Yeah I tried to use the bitcoind accounting system with the first version of GLBSE and it was a nightmare. Now I keep the system separate, In my system I record bitcoin deposits over 6 confirmations, and withdrawals immediately. After that I don't touch bitcoind.

Nefario.

PGP key id at pgp.mit.edu 0xA68F4B7C

To get help and support for GLBSE please email support@glbse.com
Pieter Wuille
Legendary
*
Offline Offline

Activity: 1072
Merit: 1189


View Profile WWW
February 25, 2012, 09:29:30 PM
 #5

Accounts are only affected by:
* incoming transactions to their bound addresses
* sendfrom
* move

Changing what account an address belongs to, does not change former transactions' to-account field.

The account system may be very unintuitive, but I wouldn't consider it buggy.

I do Bitcoin stuff.
CIYAM (OP)
Legendary
*
Offline Offline

Activity: 1890
Merit: 1086


Ian Knowles - CIYAM Lead Developer


View Profile WWW
February 26, 2012, 04:03:30 AM
 #6

Well if not buggy then why does "getaccount" give me a different result than "listtransactions" (are there more than one type of account in Bitcoin)?

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

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
Pieter Wuille
Legendary
*
Offline Offline

Activity: 1072
Merit: 1189


View Profile WWW
February 26, 2012, 04:12:13 AM
 #7

Well if not buggy then why does "getaccount" give me a different result than "listtransactions"?

Can you show me exactly which output you get, and why it is inconsistent? If it's really wrong, you stumbled upon a bug we'll gladly fix.

I do Bitcoin stuff.
CIYAM (OP)
Legendary
*
Offline Offline

Activity: 1890
Merit: 1086


Ian Knowles - CIYAM Lead Developer


View Profile WWW
February 26, 2012, 04:15:45 AM
 #8

As stated if I do a "listtransactions" the account field is always "" for every send even though (either through the GUI or bitcoind) I later set an account on the send addresses.

If I do a "getaccount" it *does* return the (to my way of thinking) correct string but never does it appear in "listtransactions".

To repeat just do something like the following:

bitcoind -rpcpassword=xxx listtransactions "*" 1000

and look at the account field for every "send" tx. In the version that I am using (0.4.0) for any "send" tx that address will always be "" no matter what you do.

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

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
Pieter Wuille
Legendary
*
Offline Offline

Activity: 1072
Merit: 1189


View Profile WWW
February 26, 2012, 04:23:17 AM
Last edit: February 26, 2012, 04:36:40 AM by Pieter Wuille
 #9

As stated if I do a "listtransactions" the account field is always "" for every send even though (either through the GUI or bitcoind) I later set an account on the send addresses.

If I do a "getaccount" it *does* return the (to my way of thinking) correct string but never does it appear in "listtransactions".

EDIT: reformulated

Accounts are groups of addresses which automatically credit a named balance when transactions are received using them. If you use "setaccount" for an address that is not your own, there is no effect, nothing will ever be received using them.

The "account" field for sent transactions refers to the account a transaction was sent from, not to (that wouldn't make sense, as you can send to addresses that are not your own). The only way to influence that is using the RPC command "sendfrom", which allows changing the "from account" information.

There is somewhat more information here

I do Bitcoin stuff.
CIYAM (OP)
Legendary
*
Offline Offline

Activity: 1890
Merit: 1086


Ian Knowles - CIYAM Lead Developer


View Profile WWW
February 26, 2012, 04:28:46 AM
Last edit: February 26, 2012, 04:47:24 AM by CIYAM Pty. Ltd.
 #10

I guess the fix is a documentation one then - sorry for the misunderstanding.

I do think it is rather unintuitive but thanks for the explanation and the link (just read it).

Perhaps it could make sense that a "setaccount" to an external address instead sets the account on the internal address(es) that the funds came from?

Also after reading the link am not 100% sure about it but would I be correct in saying that I'd have to do a "move" to get the "account" to change for a "send"?

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

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
Pieter Wuille
Legendary
*
Offline Offline

Activity: 1072
Merit: 1189


View Profile WWW
February 26, 2012, 04:47:11 AM
 #11

I updated my post above again.

I'm not sure I see what you mean with "two types of accounts". An account is group of receiving addresses for which a balance of what is received using them is kept. The confusing probably comes from the fact that a) setaccount doesn't complain when adding an address that is not your own and b) labels in the GUI are mapped to accounts.
Still, accounts for sending addresses don't really make sense: if your address is in my "ciyam" account, and I send money to you, would that debit or credit "ciyam"?

I'll try to explain it in another way:
* each receive transaction will credit one account, namely the account associated with the address it was received on.
* each send transaction will debit one account, namely the one specified using "sendfrom", or the default account ("") if the transaction was done using the GUI or sendtoaddress.
* move actions debit one account and credit another account.

Also note that accounts have nothing to do with the actual coins used in the bitcoin transactions involved.

I do Bitcoin stuff.
CIYAM (OP)
Legendary
*
Offline Offline

Activity: 1890
Merit: 1086


Ian Knowles - CIYAM Lead Developer


View Profile WWW
February 26, 2012, 04:50:19 AM
 #12

I updated mine too (several times) - guess we are starting to confuse each other. Wink

I do understand the point that an account has to belong to yourself so will just repeat what I think might be more intuitive.

If I do a "setaccount" to an address that is not my own why couldn't it just put this account on the address(es) that the send had come from?

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

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
Pieter Wuille
Legendary
*
Offline Offline

Activity: 1072
Merit: 1189


View Profile WWW
February 26, 2012, 04:55:29 AM
 #13

If I do a "setaccount" to an address that is not my own why couldn't it just put this account on the address(es) that the send had come from?

You mean: if a send address A is associated with an account X, then transactions to A will by default debit X, and this behaviour can be changed retroactively using setaccount?

That sounds possible, but to be honest, I fear it will confuse even more people.

I do Bitcoin stuff.
CIYAM (OP)
Legendary
*
Offline Offline

Activity: 1890
Merit: 1086


Ian Knowles - CIYAM Lead Developer


View Profile WWW
February 26, 2012, 05:02:57 AM
 #14

Well for certain I found the output of listtransactions confusing after playing with getaccount and setaccount (but as originally stated this was my first play with bitcoind).

If doing a "move" would fix the problem I was seeing (simply that I wanted to change the associated account for the unseen from address) then no need to change anything.

Another helpful idea might be to perhaps have the listtransactions output contain both to/from addresses (so you would do a setaccount on the from address of a "send" in order to make the change I was trying to make).


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

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
Pieter Wuille
Legendary
*
Offline Offline

Activity: 1072
Merit: 1189


View Profile WWW
February 26, 2012, 05:06:36 AM
 #15

Well for certain I found the output of listtransactions confusing after playing with getaccount and setaccount (but as originally stated this was my first play with bitcoind).

I understand.

Quote
If doing a "move" would fix the problem I was seeing (simply that I wanted to change the associated account for the unseen from address) then no need to change anything.

A move allows you to virtually move funds from one account to another. It will not change which account a particular send debits. That is something you choose when doing the transaction.

Quote
Another helpful idea might be to perhaps have the listtransactions output contain both to/from addresses (so you would do a setaccount on the from address of a "send" in order to make the change I was trying to make).

Bitcoin transactions do not have a from address (they can have multiple, or none at all, as they combine previously received funds), and accounts have nothing to do with the addresses in actual transactions. They are only for internal bookkeeping.

I do Bitcoin stuff.
CIYAM (OP)
Legendary
*
Offline Offline

Activity: 1890
Merit: 1086


Ian Knowles - CIYAM Lead Developer


View Profile WWW
February 26, 2012, 05:11:36 AM
 #16

Okay - think I need to do some more thinking about this (and it's starting to hurt).

From what I gather now it seems impossible to make the change I was wanting to see without resorting to have an external DB (which is what I gather the other posters did).

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

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
Pieter Wuille
Legendary
*
Offline Offline

Activity: 1072
Merit: 1189


View Profile WWW
February 26, 2012, 05:20:41 AM
 #17

May I ask what you are trying to do (the big picture, not "put send addresses in an account")?

The account feature is for keeping separate balances, for example for an e-wallet website that wishes to keep a balance for each customer (an "account"), and receive and send funds for them.

I do Bitcoin stuff.
CIYAM (OP)
Legendary
*
Offline Offline

Activity: 1890
Merit: 1086


Ian Knowles - CIYAM Lead Developer


View Profile WWW
February 26, 2012, 05:34:28 AM
Last edit: February 26, 2012, 06:14:22 AM by CIYAM Pty. Ltd.
 #18

Sure the "big picture" is exactly as you describe (having accounts for a general ledger) and I think if "sendfrom" was used (rather than the GUI) then the output I would see from listtransactions would be exactly as I am wanting it to be (with the account showing as the one for each customer).

My mistake was in not understanding what I was seeing (basically the word "account" confusing me and the fact I peeked at the code and just assumed from what I saw there that it was just a simple map).

I was simply wanting to change the output of listtransactions to see a name appear (as I can do in the GUI) but I now gather that is not possible using bitcoind and instead I should use "sendfrom" to have things appear as I wanted them to.

Perhaps there might be an option to be able to specify an account in the send dialog in the GUI down the track?

I am going to write a GL system (for my own business and which will end up as a package in my open source project) which I want to integrate with Bitcoin (other modules would follow the GL such as Payroll). Currently my own tx's were performed via the GUI so the problem I have is that I cannot (using bitcoind) get the "account labels" to match the GUI without doing this externally.

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

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
CIYAM (OP)
Legendary
*
Offline Offline

Activity: 1890
Merit: 1086


Ian Knowles - CIYAM Lead Developer


View Profile WWW
February 26, 2012, 07:20:20 AM
 #19

Perhaps another possibility might be to add an option for listtransactions that would change the "account" being displayed (and filtered) for "send" categories to actually be the one attached to the external address (as perhaps is how the GUI is working at the moment) ?

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

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
CIYAM (OP)
Legendary
*
Offline Offline

Activity: 1890
Merit: 1086


Ian Knowles - CIYAM Lead Developer


View Profile WWW
February 26, 2012, 08:20:23 AM
 #20

If I get some spare time I wouldn't mind working on adding such an option to listtransactions provided that the core developers don't think it would be a bad idea.

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

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
Pages: [1] 2 »  All
  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!