Bitcoin Forum
December 09, 2016, 01:47:05 PM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: [RFC] reporting addresses, listtransactions/gettransaction  (Read 1182 times)
Gavin Andresen
Legendary
*
qt
Offline Offline

Activity: 1652


Chief Scientist


View Profile WWW
December 18, 2010, 04:27:20 PM
 #1

We're pretty close to being able to duplicate the bitcoin GUI using the RPC.

I think the only thing missing is reporting bitcoin addresses in listtransactions.  That gets a little sticky with multisends (one transactions that sends coins to multiple recipients); here's what I'm thinking of implementing after doing some brainstorming with theymos/jgarzik/nanotube in IRC chat and running a couple of 'multisend' tests on the test network:

Code:
"category" : "receive",
"amount" : amount,
"address" : "bitcoinaddress"
... plus the rest of what is reported now
(account/txid/confirmations/time/comment).  That's the "received on"
address, of course.

On the send side, I'm leaning towards:
Code:
"category" : "send",
"amount" : amount,
"fee" : fee,
"toaddress" : { "address" : amount }  #  or "toaddress" : { "address" : amount, "address" : amount } for a multisend.
... plus the rest of what is reported now
(account/txid/confirmations/time/comment).

I don't like that the common case looks kind of ugly; I'd much prefer
just
Code:
"address" : "bitcoinaddress"

That could be done by having listtransactions report multiple category:send entries for a multisend... except it is not obvious
which one should report the fee, if there is a fee.  First one?  All of them?

I'm also a worried that websites might get their accounting wrong if they're not prepared to deal with multisends; making "toaddress" an
Object makes it obvious that multisends are possible.  The only way a website would get a multisend would be if they allow users to import keys from their local bitcoin wallet, which nobody is doing... yet.


Here's how listtransactions currently reports a complex multisend:

Code:
   {
       "account" : "Test3",
       "category" : "receive",
       "amount" : 3.03000000,
       "confirmations" : 66,
       "txid" :
"36c86ca499275945a3f1805d6e070ac00b2d32e5e16a4c9cf2c83b189a347d88",
       "time" : 1292532062,
       "comment" : "multisend, Test1 to Test2 and Test3 twice (same addr)"
   },
   {
       "account" : "Test3",
       "category" : "receive",
       "amount" : 3.00000000,
       "confirmations" : 66,
       "txid" :
"36c86ca499275945a3f1805d6e070ac00b2d32e5e16a4c9cf2c83b189a347d88",
       "time" : 1292532062,
       "comment" : "multisend, Test1 to Test2 and Test3 twice (same addr)"
   },
   {
       "account" : "Test2",
       "category" : "receive",
       "amount" : 2.00000000,
       "confirmations" : 66,
       "txid" :
"36c86ca499275945a3f1805d6e070ac00b2d32e5e16a4c9cf2c83b189a347d88",
       "time" : 1292532062,
       "comment" : "multisend, Test1 to Test2 and Test3 twice (same addr)"
   },
   {
       "account" : "Test1",
       "category" : "send",
       "amount" : -8.03000000,
       "fee" : 0.00000000,
       "confirmations" : 66,
       "txid" :
"36c86ca499275945a3f1805d6e070ac00b2d32e5e16a4c9cf2c83b189a347d88",
       "time" : 1292532062,
       "comment" : "multisend, Test1 to Test2 and Test3 twice (same addr)"
   },

How often do you get the chance to work on a potentially world-changing project?
1481291225
Hero Member
*
Offline Offline

Posts: 1481291225

View Profile Personal Message (Offline)

Ignore
1481291225
Reply with quote  #2

1481291225
Report to moderator
1481291225
Hero Member
*
Offline Offline

Posts: 1481291225

View Profile Personal Message (Offline)

Ignore
1481291225
Reply with quote  #2

1481291225
Report to moderator
1481291225
Hero Member
*
Offline Offline

Posts: 1481291225

View Profile Personal Message (Offline)

Ignore
1481291225
Reply with quote  #2

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

Posts: 1481291225

View Profile Personal Message (Offline)

Ignore
1481291225
Reply with quote  #2

1481291225
Report to moderator
1481291225
Hero Member
*
Offline Offline

Posts: 1481291225

View Profile Personal Message (Offline)

Ignore
1481291225
Reply with quote  #2

1481291225
Report to moderator
1481291225
Hero Member
*
Offline Offline

Posts: 1481291225

View Profile Personal Message (Offline)

Ignore
1481291225
Reply with quote  #2

1481291225
Report to moderator
genjix
Legendary
*
expert
Offline Offline

Activity: 1232


View Profile
December 18, 2010, 09:07:12 PM
 #2

Could toaddresss be destination instead? I don't think having an object for toaddress is ugly- fine by me. It's just nit-picking. A lot less worse than the inconsistent naming scheme used.... (grumbles back to basement).

Code:
"toaddress" : { "address" : amount }
"address" "address" is redundant.
Code:
"destination" : { "address" : amount }

Now my code will read:
transaction["destination"]["address"]
Which reads exactly like the English:
transaction destination address

Clear, simple and logical.

However is category really that necessary? Amount is already + or -. Or is move also in there too?

BTW I don't see any addresses in that output you pasted.
Gavin Andresen
Legendary
*
qt
Offline Offline

Activity: 1652


Chief Scientist


View Profile WWW
December 19, 2010, 02:19:03 AM
 #3

However is category really that necessary? Amount is already + or -. Or is move also in there too?

BTW I don't see any addresses in that output you pasted.

move is its own category (and may be + or -, never has a txid or fees).  And the output I pasted is what listtransactions does right now (it doesn't report bitcoin addresses).

After some private feedback, I'm now leaning towards listtransactions giving multiple category:send entries (with the same txid) for the multisend case.  That matches what is done for the category:receive end.  transaction fee... I think I'll do what is easiest to implement which is repeat it in all of them.

So the example would look like this, with three receives and three sends:

Code:
   {
       "account" : "Test3",
       "address" : "1aTest3blahblahblah9d87"
       "category" : "receive",
       "amount" : 3.03000000,
       "confirmations" : 66,
       "txid" :
"36c86ca499275945a3f1805d6e070ac00b2d32e5e16a4c9cf2c83b189a347d88",
       "time" : 1292532062,
       "comment" : "multisend, Test1 to Test2 and Test3 twice (same addr)"
   },
   {
       "account" : "Test3",
       "address" : "1aTest3blahblahblah9d87"
       "category" : "receive",
       "amount" : 3.00000000,
       "confirmations" : 66,
       "txid" :
"36c86ca499275945a3f1805d6e070ac00b2d32e5e16a4c9cf2c83b189a347d88",
       "time" : 1292532062,
       "comment" : "multisend, Test1 to Test2 and Test3 twice (same addr)"
   },
   {
       "account" : "Test2",
       "address" : "1aTest2blahblahblahQ9Qe"
       "category" : "receive",
       "amount" : 2.00000000,
       "confirmations" : 66,
       "txid" :
"36c86ca499275945a3f1805d6e070ac00b2d32e5e16a4c9cf2c83b189a347d88",
       "time" : 1292532062,
       "comment" : "multisend, Test1 to Test2 and Test3 twice (same addr)"
   },
   {
       "account" : "Test1",
       "address" : "1aTest3blahblahblah9d87"
       "category" : "send",
       "amount" : -3.03000000,
       "fee" : 0.00000000,
       "confirmations" : 66,
       "txid" :
"36c86ca499275945a3f1805d6e070ac00b2d32e5e16a4c9cf2c83b189a347d88",
       "time" : 1292532062,
       "comment" : "multisend, Test1 to Test2 and Test3 twice (same addr)"
   },
   {
       "account" : "Test1",
       "address" : "1aTest3blahblahblah9d87"
       "category" : "send",
       "amount" : -3.00000000,
       "fee" : 0.00000000,
       "confirmations" : 66,
       "txid" :
"36c86ca499275945a3f1805d6e070ac00b2d32e5e16a4c9cf2c83b189a347d88",
       "time" : 1292532062,
       "comment" : "multisend, Test1 to Test2 and Test3 twice (same addr)"
   },
   {
       "account" : "Test1",
       "address" : "1aTest2blahblahblahQ9Qe"
       "category" : "send",
       "amount" : -2.00000000,
       "fee" : 0.00000000,
       "confirmations" : 66,
       "txid" :
"36c86ca499275945a3f1805d6e070ac00b2d32e5e16a4c9cf2c83b189a347d88",
       "time" : 1292532062,
       "comment" : "multisend, Test1 to Test2 and Test3 twice (same addr)"
   },

How often do you get the chance to work on a potentially world-changing project?
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!