Bitcoin Forum
May 09, 2024, 08:49:04 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [RFC] reporting addresses, listtransactions/gettransaction  (Read 1417 times)
Gavin Andresen (OP)
Legendary
*
qt
Offline Offline

Activity: 1652
Merit: 2216


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?
1715287744
Hero Member
*
Offline Offline

Posts: 1715287744

View Profile Personal Message (Offline)

Ignore
1715287744
Reply with quote  #2

1715287744
Report to moderator
Once a transaction has 6 confirmations, it is extremely unlikely that an attacker without at least 50% of the network's computation power would be able to reverse it.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715287744
Hero Member
*
Offline Offline

Posts: 1715287744

View Profile Personal Message (Offline)

Ignore
1715287744
Reply with quote  #2

1715287744
Report to moderator
1715287744
Hero Member
*
Offline Offline

Posts: 1715287744

View Profile Personal Message (Offline)

Ignore
1715287744
Reply with quote  #2

1715287744
Report to moderator
genjix
Legendary
*
expert
Offline Offline

Activity: 1232
Merit: 1076


View Profile
December 18, 2010, 09:07:12 PM
Last edit: December 18, 2010, 09:34:16 PM by genjix
 #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 (OP)
Legendary
*
qt
Offline Offline

Activity: 1652
Merit: 2216


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:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!