Pages:
Author

Topic: Why is account showing as empty even after doing a setaccount? (Read 2491 times)

legendary
Activity: 1890
Merit: 1078
Ian Knowles - CIYAM Lead Developer
Not sure if any dev is watching this thread but I have made suggested source code changes to bitcoinrpc.cpp from this forked repo branch:

https://github.com/ciyam/bitcoin/tree/opt_use_sent_to_addr_for_acc

As I don't have boost or the time to get it and other libs installed at the moment this has not even been compiled (so I have not submitted a pull request).

If any dev (or anyone else) has enough spare time to at least compile and show any errors in my changes then I'd appreciate it.

The change is to the bitcoinrpc command listtransactions whose usage would become as follows:

listtransactions [account] [count=10] [from=0] [usesenttoaddresses=false]

When usesenttoaddresses is set true then the account mapping for "send" category tx's is to the sent to addr (rather than the current behaviour).

EDIT: Link for  commit changes:
https://github.com/ciyam/bitcoin/commits/opt_use_sent_to_addr_for_acc

I do hope to find more spare time to actually compile and test this myself but unfortunately I don't see that happening for quite a while so once again if anyone else has any spare time to check this I would appreciate it so I can then create a pull request.

EDIT: I will start a new thread in the Development board about this and will put a BTC bounty in that.


Cheers,

Ian.
legendary
Activity: 1890
Merit: 1078
Ian Knowles - CIYAM Lead Developer
Yes - that is the idea and thanks for your help - I will look into implementing this as soon as I have some free time (or if anyone else is interested 1 BTC bounty available).

I think it might be useful especially for people who have started using the GUI and then decide they want to put all their tx's into a general ledger.
legendary
Activity: 1072
Merit: 1178
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) ?

I finally understand what you're asking. You do not want accounts at all, you just want labels attached to addresses, and the ability to search for them.

I suppose that isn't too hard, and sounds useful indeed.
legendary
Activity: 1890
Merit: 1078
Ian Knowles - CIYAM Lead Developer
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.
legendary
Activity: 1890
Merit: 1078
Ian Knowles - CIYAM Lead Developer
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) ?
legendary
Activity: 1890
Merit: 1078
Ian Knowles - CIYAM Lead Developer
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.
legendary
Activity: 1072
Merit: 1178
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.
legendary
Activity: 1890
Merit: 1078
Ian Knowles - CIYAM Lead Developer
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).
legendary
Activity: 1072
Merit: 1178
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.
legendary
Activity: 1890
Merit: 1078
Ian Knowles - CIYAM Lead Developer
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).

legendary
Activity: 1072
Merit: 1178
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.
legendary
Activity: 1890
Merit: 1078
Ian Knowles - CIYAM Lead Developer
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?
legendary
Activity: 1072
Merit: 1178
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.
legendary
Activity: 1890
Merit: 1078
Ian Knowles - CIYAM Lead Developer
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"?
legendary
Activity: 1072
Merit: 1178
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
legendary
Activity: 1890
Merit: 1078
Ian Knowles - CIYAM Lead Developer
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.
legendary
Activity: 1072
Merit: 1178
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.
legendary
Activity: 1890
Merit: 1078
Ian Knowles - CIYAM Lead Developer
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)?
legendary
Activity: 1072
Merit: 1178
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.
hero member
Activity: 602
Merit: 512
GLBSE Support [email protected]
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.
Pages:
Jump to: