[RFC] アドレスの報告、listtransactionsとgettransaction
RPCだけでbitcoinのGUIと同じことができるところまで、あと少しだ。
足りないのは、listtransactionsでビットコインアドレスを報告することだけだと思う。ただ、マルチセンド(一つのトランザクションで複数の相手にコインを送るもの)があると、少しややこしくなる。IRCのチャットでtheymos、jgarzik、nanotubeと案を出し合い、テストネットワークで「マルチセンド」のテストを何度か走らせてみて、今のところ次のように実装しようと考えている。
"category" : "receive",
"amount" : amount,
"address" : "bitcoinaddress"
このほかに、今も報告している項目(account/txid/confirmations/time/comment)が付く。このアドレスは、もちろん「受け取った」アドレスだ。
送る側は、次の形にしようかと考えている。
"category" : "send",
"amount" : amount,
"fee" : fee,
"toaddress" : { "address" : amount } # or "toaddress" : { "address" : amount, "address" : amount } for a multisend.
こちらにも、今も報告している項目(account/txid/confirmations/time/comment)が付く。
よくある場合の見た目が少し不格好なのが気に入らない。できれば、次のようにしたい。
"address" : "bitcoinaddress"
マルチセンドのときは、listtransactionsにcategory:sendの項目を複数報告させれば、そうできる…ただ、手数料がある場合に、どの項目が手数料を報告すべきかがはっきりしない。最初の項目だろうか。全部だろうか。
もう一つ少し心配なのは、マルチセンドを扱う用意のないウェブサイトが、帳簿を間違えるかもしれないことだ。「toaddress」をObjectにしておけば、マルチセンドがありうることがはっきり分かる。ウェブサイトがマルチセンドを受け取るのは、利用者が手元のbitcoinのウォレットから鍵を取り込めるようにしている場合だけで、そんなことをしているところはない…今のところは。
複雑なマルチセンドを、listtransactionsは今のところ次のように報告する。
{
"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)"
},