# Gavin Andresen # 2010-09-27 17:57:53 # https://bitcointalk.org/index.php?topic=724.msg14266#msg14266 I've been working on a "monitoraddress" / "monitorblocks" patch, so bitcoind will POST transaction/block information to an arbitrary URL. @p{par} And it seems to me "getblock" should be split into "getblockbycount", "getblockbyhash" and "gettransaction". I also have some suggestions for making the naming more consistent: @p{par} I'd suggest getblockby* return: @p{brk} Code: { @p{brk} "hash" : "00000000002d1a4380793affbc610885aa2e0b224eeedd64ffe108044ec7d434", @p{brk} "blockcount" : 71995, @p{brk} "version" : 1, @p{brk} "merkleroot" : "9d436c694968454ea0d17f4aece3b829930027c3cb918e5107a1605aa2eeae33", @p{brk} "time" : 1280823515, @p{brk} "nonce" : 2918845955, @p{brk} "tx" : [ "f85e77e4379694c8d2c1232d6fddfc7792073fb8484bdac37a9ba5ed1d245c57", etc ] @p{brk} } @p{brk} @p{brk} Reasoning: @p{brk} blockcount instead of 'height' or 'depth' because getinfo returns "blockcount" @p{brk} getblockbyhash might return a block not on the "best" chain; return blockcount=-1 in that case? @p{brk} version instead of 'ver' because abbrvs shd b avoided (thy cn b hrd to rd/rmbr) @p{brk} only return transaction hashes; if you need more transaction details, call gettransaction. @p{brk} No n_tx (or n_anything) because it is implicit in length of returned array @p{par} (stuff I'm not sure about: what is 'bits' in the implemented getblock? Is that difficulty? Does anybody really need all the detailed merkle tree info?) @p{par} I'd suggest gettransaction return: @p{brk} Code: { @p{brk} "txid" : ...transaction id passed in, @p{brk} "version" : 1, @p{brk} "time" : ...transaction time..., @p{brk} "confirmations" : n, @p{brk} "block" : "block hash", # (if confirmations @s{gt} 0) @p{brk} "from" : [ [ "txid", n ], ... ], # Empty if coin generation transaction @p{brk} "to" : [ [ "address", amount ], ... ], @p{brk} } @p{brk} @p{brk} Reasoning: @p{brk} Returning the CScript string seems like it is both too much detail AND not very useful (I want the bitcoin addresses, NOT OP_DUP 0xblahblahblah ...) @p{brk} "from" is just a list of pointers to previous transaction "to"s @p{brk} confirmations is duplicate info (you could getblockbyhash and then look at its blockcount), but is so useful I think it belongs here. @p{brk}