Author

Topic: BitcoinD Feature Request - Common IN/OUT 'listtransactions' Label in API (Read 1514 times)

sr. member
Activity: 462
Merit: 250
I heart thebaron
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]

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



  • (notice no label in the Receive ? In my Wallet, it has a Label that I already gave it....as it's a reoccurring payment)
    legendary
    Activity: 1072
    Merit: 1181
    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?
    sr. member
    Activity: 462
    Merit: 250
    I heart thebaron
    This is pointless......
    legendary
    Activity: 1072
    Merit: 1181
    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.
    sr. member
    Activity: 462
    Merit: 250
    I heart thebaron
    I am lost....but here's the easiest way I can explain it....using Gavin's example TX. https://bitcointalksearch.org/topic/m.880936

    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 ?
    legendary
    Activity: 1372
    Merit: 1008
    1davout
    Yes, the "from" account-- I think bitlane wants the "to" account...
    Gotcha
    legendary
    Activity: 1652
    Merit: 2301
    Chief Scientist
    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...
    legendary
    Activity: 1372
    Merit: 1008
    1davout
    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 ?
    legendary
    Activity: 1652
    Merit: 2301
    Chief Scientist
    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.
    sr. member
    Activity: 462
    Merit: 250
    I heart thebaron
    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]

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



  • 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'
    legendary
    Activity: 1372
    Merit: 1008
    1davout
    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
    sr. member
    Activity: 462
    Merit: 250
    I heart thebaron
    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 ?.....
    sr. member
    Activity: 462
    Merit: 250
    I heart thebaron
    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:



    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()' ?
    Jump to: