Bitcoind

bitcoind rest api tx 端點

  • May 22, 2019

我在使用 bitcoind REST API 端點檢索交易資訊時遇到問題。根據文件,它應該confirmations在檢索到的數據中返回。但是我的 bitcoind 在響應中沒有這個存在。我有rest=1txindex=1所以一切可能都應該沒問題。

我選擇了一個隨機 txid 來展示響應

這是我從 REST API tx 端點(截斷vin/ vout)得到的:

{
   "hash": "669a1302ee3ccb482cc545f56cca9112a2d24a7959f1da18f87603640ff9288e", 
   "vout": [ ... ], 
   "weight": 896, 
   "hex": "0100000001e96d13340057a99320702b9482a93114fb7ed0d27345242dd61a6ba967fe70a5010000006b483045022100833c21acd4e87aec7f794804606ef1699db2a5cc420f80af500243a43970cb8a0220617b9f55e2c6383f3093a4683af9fcdaad668b66e942553a6928b07e241141120121035deb8e150be5ccbfcca2a978d9bc3e2990afb61d08b49ce0494f39b10173c828ffffffff02dc9b68000000000017a91418b3b7d346e3f32cc4b3e0617fdf61e23d5ea2cc87cc8e6f1a000000001976a9140ae8e97489b9412f3f2ca6a63882f762174b368788ac00000000", 
   "blockhash": "0000000000000000000d5cfef192ed15ed37881cd5f0930d5613ac92a6b1b6e6", 
   "vin": [ ... ], 
   "txid": "669a1302ee3ccb482cc545f56cca9112a2d24a7959f1da18f87603640ff9288e", 
   "version": 1, 
   "locktime": 0, 
   "vsize": 224, 
   "size": 224
}

這就是我從bitcoin-cli getrawtransaction 669a1302ee3ccb482cc545f56cca9112a2d24a7959f1da18f87603640ff9288e 1(截斷vin/ vout)得到的:

{
 "txid": "669a1302ee3ccb482cc545f56cca9112a2d24a7959f1da18f87603640ff9288e",
 "hash": "669a1302ee3ccb482cc545f56cca9112a2d24a7959f1da18f87603640ff9288e",
 "version": 1,
 "size": 224,
 "vsize": 224,
 "weight": 896,
 "locktime": 0,
 "vin": [ ... ],
 "vout": [ ... ],
 "hex": "0100000001e96d13340057a99320702b9482a93114fb7ed0d27345242dd61a6ba967fe70a5010000006b483045022100833c21acd4e87aec7f794804606ef1699db2a5cc420f80af500243a43970cb8a0220617b9f55e2c6383f3093a4683af9fcdaad668b66e942553a6928b07e241141120121035deb8e150be5ccbfcca2a978d9bc3e2990afb61d08b49ce0494f39b10173c828ffffffff02dc9b68000000000017a91418b3b7d346e3f32cc4b3e0617fdf61e23d5ea2cc87cc8e6f1a000000001976a9140ae8e97489b9412f3f2ca6a63882f762174b368788ac00000000",
 "blockhash": "0000000000000000000d5cfef192ed15ed37881cd5f0930d5613ac92a6b1b6e6",
 "confirmations": 5,
 "time": 1558449750,
 "blocktime": 1558449750
}

是否有什麼我做錯了,我沒有confirmations從文件中所說的 REST API 端點獲得?

比特幣版本 v0.17.0.0

文件不正確。confirmationstime並且blocktime不是其餘 API 輸出中的欄位。你沒有做錯任何事;這些欄位不存在。

引用自:https://bitcoin.stackexchange.com/questions/87886