Bitcoin Forum
May 06, 2024, 04:13:51 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: BitcoinD Feature Request - Common IN/OUT 'listtransactions' Label in API  (Read 1497 times)
bitlane (OP)
Internet detective
Sr. Member
****
Offline Offline

Activity: 462
Merit: 250


I heart thebaron


View Profile
May 03, 2012, 06:44:25 PM
Last edit: May 03, 2012, 06:59:52 PM by bitlane
 #1

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

1714968831
Hero Member
*
Offline Offline

Posts: 1714968831

View Profile Personal Message (Offline)

Ignore
1714968831
Reply with quote  #2

1714968831
Report to moderator
1714968831
Hero Member
*
Offline Offline

Posts: 1714968831

View Profile Personal Message (Offline)

Ignore
1714968831
Reply with quote  #2

1714968831
Report to moderator
1714968831
Hero Member
*
Offline Offline

Posts: 1714968831

View Profile Personal Message (Offline)

Ignore
1714968831
Reply with quote  #2

1714968831
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714968831
Hero Member
*
Offline Offline

Posts: 1714968831

View Profile Personal Message (Offline)

Ignore
1714968831
Reply with quote  #2

1714968831
Report to moderator
bitlane (OP)
Internet detective
Sr. Member
****
Offline Offline

Activity: 462
Merit: 250


I heart thebaron


View Profile
May 03, 2012, 07:03:22 PM
 #2

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

davout
Legendary
*
Offline Offline

Activity: 1372
Merit: 1007


1davout


View Profile WWW
May 03, 2012, 07:13:01 PM
 #3

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

bitlane (OP)
Internet detective
Sr. Member
****
Offline Offline

Activity: 462
Merit: 250


I heart thebaron


View Profile
May 03, 2012, 07:21:56 PM
Last edit: May 03, 2012, 07:33:14 PM by bitlane
 #4

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>



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'

Gavin Andresen
Legendary
*
qt
Offline Offline

Activity: 1652
Merit: 2216


Chief Scientist


View Profile WWW
May 03, 2012, 07:35:30 PM
 #5

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.

How often do you get the chance to work on a potentially world-changing project?
davout
Legendary
*
Offline Offline

Activity: 1372
Merit: 1007


1davout


View Profile WWW
May 03, 2012, 07:37:51 PM
 #6

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 ?

Gavin Andresen
Legendary
*
qt
Offline Offline

Activity: 1652
Merit: 2216


Chief Scientist


View Profile WWW
May 03, 2012, 07:39:13 PM
 #7

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

How often do you get the chance to work on a potentially world-changing project?
davout
Legendary
*
Offline Offline

Activity: 1372
Merit: 1007


1davout


View Profile WWW
May 03, 2012, 07:44:34 PM
 #8

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

bitlane (OP)
Internet detective
Sr. Member
****
Offline Offline

Activity: 462
Merit: 250


I heart thebaron


View Profile
May 03, 2012, 07:45:12 PM
Last edit: May 03, 2012, 08:08:18 PM by bitlane
 #9

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 ?

Pieter Wuille
Legendary
*
qt
Offline Offline

Activity: 1072
Merit: 1174


View Profile WWW
May 03, 2012, 09:18:52 PM
 #10

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.

I do Bitcoin stuff.
bitlane (OP)
Internet detective
Sr. Member
****
Offline Offline

Activity: 462
Merit: 250


I heart thebaron


View Profile
May 03, 2012, 11:28:05 PM
 #11

This is pointless......

Pieter Wuille
Legendary
*
qt
Offline Offline

Activity: 1072
Merit: 1174


View Profile WWW
May 03, 2012, 11:35:30 PM
 #12

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?

I do Bitcoin stuff.
bitlane (OP)
Internet detective
Sr. Member
****
Offline Offline

Activity: 462
Merit: 250


I heart thebaron


View Profile
May 03, 2012, 11:43:21 PM
 #13

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>



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

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!