Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: bitlane on May 03, 2012, 06:44:25 PM



Title: BitcoinD Feature Request - Common IN/OUT 'listtransactions' Label in API
Post by: bitlane on May 03, 2012, 06:44:25 PM
First off..... I have NO IDEA what I am talking about.
I am not a coder. I am a copy/paste hack at best.

Now, in saying that, if I am the only one to come across this limitation.....then WTF ?

Problem:
When attempting to display a transaction array (say, for a Web GUI ?) and including using "listtransactions()" & "account", a User's custom ID/Name/Label for that transaction address can be acquired, but ONLY for incoming transactions and not outgoing.

Request:
Why can't there be a common 'tag' for "listtransactions()" other than 'account' that would apply to BOTH incoming and outgoing transactions that could display a Wallet's custom ID 'tag' (or LABEL) for a specific address ?

Did that make sense ? or did I simply make myself look stupid ?

For example:

http://members.shaw.ca/bitlane/bitcointrans.jpg

When displaying this array and using "listtransactions/account', I am able to get the Labels for Incoming transactions, but there is no call for outgoing Labels.

Why can't there be a common 'LABEL' tag for incoming and outgoing as well as 'account' using 'listtransactions()' ?


Title: Re: BitcoinD Feature Request - Common IN/OUT 'listtransactions' Label in API
Post by: bitlane on May 03, 2012, 07:03:22 PM
42 views and no one has called me an idiot yet (although no one has replied either)

Is that a good thing ? or a bad thing ?.....


Title: Re: BitcoinD Feature Request - Common IN/OUT 'listtransactions' Label in API
Post by: davout on May 03, 2012, 07:13:01 PM
What you're saying is that you create a new address like this
Code:
$ bitcoin getnewaddress account-xx

when you send funds to it, the "account" field in listtransactions is correctly populated, but when you send funds from the wallet the "account" field remains empty ?

That sounds a little weird, how are you doing the send ? Like this ?
Code:
$ bitcoin sendfrom account-xx 1davout... 42.86


Title: Re: BitcoinD Feature Request - Common IN/OUT 'listtransactions' Label in API
Post by: bitlane on May 03, 2012, 07:21:56 PM
What you're saying is that you create a new address like this
Code:
$ bitcoin getnewaddress account-xx

when you send funds to it, the "account" field in listtransactions is correctly populated, but when you send funds from the wallet the "account" field remains empty ?

That sounds a little weird, how are you doing the send ? Like this ?
Code:
$ bitcoin sendfrom account-xx 1davout... 42.86

Not for Sending OR Receiving functionality. Wallet/BitcoinD is on another machine/node (and work fine).

This feature request (FOR ME) is for MONITORING/WEB DISPLAY ONLY.

I display the wallet's 'latest transactions' array in my Mining Monitor using this code:
Code:
.....[CUT]
$info = $bitcoin->getinfo();
$trans = $bitcoin->listtransactions();
.....[PASTE]

<li><?php echo ("TX: ".$trans[9]['category'] . ":<b> " number_format($trans[9]['amount'],4) ." BTC</b> | ID: <b>".$trans[9]['account'] ."</b>  | Confirms: <b>".$trans[9]['confirmations'] )?></b>
<li><?php echo ("TX: ".$trans[8]['category'] . ":<b> " number_format($trans[8]['amount'],4) ." BTC</b> | ID: <b>".$trans[8]['account'] ."</b>  | Confirms: <b>".$trans[8]['confirmations'] )?></b>
<li><?php echo ("TX: ".$trans[7]['category'] . ":<b> " number_format($trans[7]['amount'],4) ." BTC</b> | ID: <b>".$trans[7]['account'] ."</b>  | Confirms: <b>".$trans[7]['confirmations'] )?></b>
<li><?php echo ("TX: ".$trans[6]['category'] . ":<b> " number_format($trans[6]['amount'],4) ." BTC</b> | ID: <b>".$trans[6]['account'] ."</b>  | Confirms: <b>".$trans[6]['confirmations'] )?></b>
<li><?php echo ("TX: ".$trans[6]['category'] . ":<b> " number_format($trans[5]['amount'],4) ." BTC</b> | ID: <b>".$trans[5]['account'] ."</b>  | Confirms: <b>".$trans[5]['confirmations'] )?></b>

http://members.shaw.ca/bitlane/bitcointrans.jpg

For incoming transactions, I am able to get the local LABEL for the address (see example above).
Outgoing Addresses also have Labels, but I have no way of displaying them using a COMMON tag so that I do not have to display separate IN/OUT arrays...and just keep it to a single array instead ?

Does THAT makes sense ?

'Account' does not populate the LABEL for outgoing transactions, as it does for Incoming...using listtransactions....

I am hoping for a common 'LABEL' tag/field/call/whatever that can be used for both rather than using 'Account'


Title: Re: BitcoinD Feature Request - Common IN/OUT 'listtransactions' Label in API
Post by: Gavin Andresen on May 03, 2012, 07:35:30 PM
So you create a 'send' transaction:
Code:
sendtoaddress msK1Hu7N27XTcuXd5MqWuyhW3YEGxHgVPe 11 "Testing" "One, two, three"
a9e19baabc3929f0940805e69370d4aefa981cbe9cb8f5ea9184f5f6909a8544

... and you've associated msK1Hu7N27XTcuXd5MqWuyhW3YEGxHgVPe with the label "2_address":
Code:
setaccount "msK1Hu7N27XTcuXd5MqWuyhW3YEGxHgVPe" "2_address"

listtransactions looks like this:
Code:
{
        "account" : "",
        "address" : "msK1Hu7N27XTcuXd5MqWuyhW3YEGxHgVPe",
        "category" : "send",
        "amount" : -11.00000000,
        "fee" : 0.00000000,
        "confirmations" : 0,
        "txid" : "a9e19baabc3929f0940805e69370d4aefa981cbe9cb8f5ea9184f5f6909a8544",
        "time" : 1336073201,
        "comment" : "Testing",
        "to" : "One, two, three"
    }

... because "send" transactions always report a negative amount (you're sending coins) and the account that they're being sent from.

If you want to know the account/label associated with the address that you're sending to, do this:
Code:
getaccount msK1Hu7N27XTcuXd5MqWuyhW3YEGxHgVPe
2_address

... or you could use the [comment]/[comment-to] params to the sendtoaddress/sendfrom/sendmany commands if you want the "to-account" to show up in listtransactions.


Title: Re: BitcoinD Feature Request - Common IN/OUT 'listtransactions' Label in API
Post by: davout on May 03, 2012, 07:37:51 PM
So you create a 'send' transaction:
Code:
sendtoaddress msK1Hu7N27XTcuXd5MqWuyhW3YEGxHgVPe 11 "Testing" "One, two, three"
a9e19baabc3929f0940805e69370d4aefa981cbe9cb8f5ea9184f5f6909a8544

...

... or you could use the [comment]/[comment-to] params to the sendtoaddress/sendfrom/sendmany commands if you want the "to-account" to show up in listtransactions.

Doesn't the TX get tagged with the account when using the sendfrom call ?


Title: Re: BitcoinD Feature Request - Common IN/OUT 'listtransactions' Label in API
Post by: Gavin Andresen on May 03, 2012, 07:39:13 PM
Doesn't the TX get tagged with the account when using the sendfrom call ?

Yes, the "from" account-- I think bitlane wants the "to" account...


Title: Re: BitcoinD Feature Request - Common IN/OUT 'listtransactions' Label in API
Post by: davout on May 03, 2012, 07:44:34 PM
Yes, the "from" account-- I think bitlane wants the "to" account...
Gotcha


Title: Re: BitcoinD Feature Request - Common IN/OUT 'listtransactions' Label in API
Post by: bitlane on May 03, 2012, 07:45:12 PM
I am lost....but here's the easiest way I can explain it....using Gavin's example TX. https://bitcointalk.org/index.php?topic=79105.msg880936#msg880936

CURRENT:
Code:
{
        "account" : "",
        "address" : "msK1Hu7N27XTcuXd5MqWuyhW3YEGxHgVPe",
        "category" : "send",
        "amount" : -11.00000000,
        "fee" : 0.00000000,
        "confirmations" : 0,
        "txid" : "a9e19baabc3929f0940805e69370d4aefa981cbe9cb8f5ea9184f5f6909a8544",
        "time" : 1336073201,
        "comment" : "Testing",
        "to" : "One, two, three"
    }

REQUEST:
Code:
{
        "account" : "", <---------------------Because this only populates if local RECEIVE address has a 'Label' and is ALWAYS blank for SENDS
        "address" : "msK1Hu7N27XTcuXd5MqWuyhW3YEGxHgVPe",
        "LABEL" : "2_address", <----------------------------PLEASE ADD THIS 'address book label' FIELD TO listtransactions---COMMON to both SEND & RECEIVE----<
        "category" : "send",
        "amount" : -11.00000000,
        "fee" : 0.00000000,
        "confirmations" : 0,
        "txid" : "a9e19baabc3929f0940805e69370d4aefa981cbe9cb8f5ea9184f5f6909a8544",
        "time" : 1336073201,
        "comment" : "Testing",
        "to" : "One, two, three"
    }

...because on a SEND (for reoccurring/re-used addresses ? payments etc) , I can not display the 'Account' name as I can for Incoming, so I think that a COMMON LABEL tag would suit both IN/OUT.

Did that make sense ?


Title: Re: BitcoinD Feature Request - Common IN/OUT 'listtransactions' Label in API
Post by: Pieter Wuille on May 03, 2012, 09:18:52 PM
The question is, where do you want the data that gets added to the label or account of an outgoing transaction to come from? If it comes from another hypothetical RPC call "settransactionlabel" or something, you may as well use the sendfrom RPC.

You say that account is always empty for outgoing transactions. That is not true, it is equal to the account you sent it from (and the default is ""). If you use "sendfrom", you can decide which account it is subtracted from.

Also, yelling doesn't help.


Title: Re: BitcoinD Feature Request - Common IN/OUT 'listtransactions' Label in API
Post by: bitlane on May 03, 2012, 11:28:05 PM
This is pointless......


Title: Re: BitcoinD Feature Request - Common IN/OUT 'listtransactions' Label in API
Post by: Pieter Wuille on May 03, 2012, 11:35:30 PM
Can you just answer this question: where does the label you want listtransaction to report for outgoing transactions, come from? Or alternative, how do you want to set it?


Title: Re: BitcoinD Feature Request - Common IN/OUT 'listtransactions' Label in API
Post by: bitlane on May 03, 2012, 11:43:21 PM
Can you just answer this question: where does the label you want listtransaction to report for outgoing transactions, come from? Or alternative, how do you want to set it?

First off, if you had read the entire post, or even the OP, you would have noticed that...

I AM NOT SMART ENOUGH TO ANSWER YOUR QUESTION.

Second,

I am simply looking for a common way to show the GUI's user Friendly Labels from the address book for both Sends & Receives.

Currently, Receive Labels can be populated in a 'listtransactions' field using 'account' but there isn't anything that is common to both Send and Receive that will do the same.

When I am writing my Transaction array for my php web monitor, my code is using 'listtransactions' for everything and everything is common to either Send or Receive, with the exception of a way to display both transaction 'Categories' Labels.

I am simply not smart enough to answer anymore.....LOL

I display the wallet's 'latest transactions' array in my Mining Monitor using this code:
Code:
.....[CUT]
$info = $bitcoin->getinfo();
$trans = $bitcoin->listtransactions();
.....[PASTE]

<li><?php echo ("TX: ".$trans[9]['category'] . ":<b> " number_format($trans[9]['amount'],4) ." BTC</b> | ID: <b>".$trans[9]['account'] ."</b>  | Confirms: <b>".$trans[9]['confirmations'] )?></b>
<li><?php echo ("TX: ".$trans[8]['category'] . ":<b> " number_format($trans[8]['amount'],4) ." BTC</b> | ID: <b>".$trans[8]['account'] ."</b>  | Confirms: <b>".$trans[8]['confirmations'] )?></b>
<li><?php echo ("TX: ".$trans[7]['category'] . ":<b> " number_format($trans[7]['amount'],4) ." BTC</b> | ID: <b>".$trans[7]['account'] ."</b>  | Confirms: <b>".$trans[7]['confirmations'] )?></b>
<li><?php echo ("TX: ".$trans[6]['category'] . ":<b> " number_format($trans[6]['amount'],4) ." BTC</b> | ID: <b>".$trans[6]['account'] ."</b>  | Confirms: <b>".$trans[6]['confirmations'] )?></b>
<li><?php echo ("TX: ".$trans[6]['category'] . ":<b> " number_format($trans[5]['amount'],4) ." BTC</b> | ID: <b>".$trans[5]['account'] ."</b>  | Confirms: <b>".$trans[5]['confirmations'] )?></b>

http://members.shaw.ca/bitlane/bitcointrans.jpg

(notice no label in the <TX#2 above> Receive ? In my Wallet, it has a Label that I already gave it....as it's a reoccurring payment)