看国外的比特币交易
问题描述:
我试图让使用看国外的比特币交易
bitcoind gettransaction \
9962d5c704ec27243364cbe9d384808feeac1c15c35ac790dffd1e929829b271
交易信息,但我收到
error: {"code":-5,"message":"Invalid or non-wallet transaction id"}
怎么看使用比特币API事务?
答
正如错误所述,您正试图查看不属于您的钱包的交易。 Bitcoind只允许您探索与您的钱包相关的交易。
如果你想探索“洋”的交易,你应该使用其他工具,如http://blockexplorer.com/
答
znort987的blockparser program看起来很有希望。我还没有机会玩它,所以我不确定它是否有指定单个交易进行检查的原生支持,但是doco说,如果你知道接收地址,那么你可以获得所有交易详情该地址如下所示:
./parser transactions the_receiving_address
答
您可以视图中使用bitcoind国外交易。
- 在您的bitcoin.conf文件中设置txindex = 1。
- 重启bitcoind与-reindex(您需要重新构建整个指数)
你索引的几个街区后,您可以使用这样的事情:
$ bitcoind getblockcount
122735
$ bitcoind getblockhash 67543
0000000004e213266ccd388df12896412c1a70e647b48004f7d6894b9d6f63b9
$ bitcoind getblock 0000000004e213266ccd388df12896412c1a70e647b48004f7d6894b9d6f63b9
// JSON containing tx "a93a668d9332e21d51380c7251bbf5ad47295ca9795e0ad6f2fe8d63b76af9aa"
$ bitcoind getrawtransaction a93a668d9332e21d51380c7251bbf5ad47295ca9795e0ad6f2fe8d63b76af9aa 1
// json of transaction - note that "1" at the end tells bitcoind to decode into json
见this为更多。
答
getrawtransaction <txid>
命令从Bitcoin-QT客户甚至获得任何交易
“原始事务API” 与比特币-QT/bitcoind版本0.7中引入的。它为开发人员或非常复杂的最终用户提供了对事务创建和广播的低级访问。
这将返回十六进制字节的字符串,这不是很有用。但是,如果你键入
getrawtransaction <txid> 1
你会得到很好的格式化的JSON表示
我不希望我的服务器上建立对第三方服务的依赖。还有其他的可能吗? – asv 2012-01-05 16:21:23
也许blockexplorer的代码在某处可用。或类似的东西。但bitcoind不这样做。 – ploum 2012-01-05 19:23:50
不一定如此 - 请参阅我的答案。 – 2013-12-14 23:05:40