Confirmations

如何測量 TX 確認延遲

  • January 30, 2014

Blockchaininfo這裡有關於交易確認時間的數據。不幸的是,目前尚不清楚他們如何收集數據,也不清楚是否可以從 Namecoin 中獲得類似的數據。

我想將這些數據包含在研究論文中或自己收集類似的數據。但是,如果沒有他們的方法,我就無法使用他們的數據,也無法複製這些技術。發送測試交易和測量確認交易需要多長時間的顯而易見的解決方案似乎提供了一個相當不完整的圖景。

使用可以使用getrawmempool來自 bitcoin-qt 控制台(或通過 JSON-RPC)的命令。此命令顯示所有尚未確認的交易。您可以每秒執行一次此命令,並在每個事務出現時節省時間。之後,您等待區塊,並檢查這些交易何時會包含在區塊中。當新塊出現時,您還可以使用-blocknotify=<cmd>命令行選項來執行一些外部應用程序。

例子:

-> getrawmempool
<- 
[
"007077f621011fd63f13104e602d079120be93be97a4f78cb4f5f7e442894b38",
"00996e6ff49096ff1e2a39866717dcdc3ebd24a57b9f1d7c0681549fc231ffa2",
"00f66dc8026d3489c6db2b5a500338bdad76ce25b1eaba6b7449d324fd8d975c",
.....
"fed72f15d234148a1d0db1b3372e65688de907555d6843a5fe4a32f92cade522",
"ff23d3ee0970698659437f32a1270a05062db7bd92e1ce737ee81cc9d604fb7f",
"ff8b2f12547d7e102ef5788fba78405cca4d2609deb60d32cf4ccbb48d06d100"
]

如果您需要有關特定 tx 的更多資訊:

-> getrawtransaction 007077f621011fd63f13104e602d079120be93be97a4f78cb4f5f7e442894b38
<- 01000000034c4fa9127f8c33a84dcb43c19efca9b6fe5e488720a5e6277aa7fae8e388e11a010000006b483045022026d79a1ec97979c22249ecf2a81d25e5a45675d31ddd7894ad55c8d230dd7d3302210086db210b1693f16bc895a7794f37a36bd0b4921a57b06751a1cbd9af9572ba4301210211e8dbe80f052c1b9a3b0bf9b9f499065b0c4d8525290c0315837a4879ac340cffffffff60275914157600e5c2f1c016b6b5dc2dcb748171add3ce9af15c0cfaaa39639e000000006c493046022100d691f5962d0c4357de9dc062e83e3aa3eed5b7c43b55ebfab1fdb14ad3c8f200022100ff7f6eebb0e2159eea914c57a3d5e8300680755556de9ce77dbaee684aeeed75012102633925a9a270cf6b115b003642551e9efea2de92a1eca4288ad235ed1129be8dffffffffe30a77c90098ed4e31a1a493cf52f4fc98d954d9165dd3373cb805dbcd838f91010000006c493046022100c4727881fd52903a4c260318138fa6ebea012d002ac7c1aaa1ef6a621405a21b0221008b92ffc6f1c3e29d7421c1a576db09f261ae63a4fe605776b742a97294ff095d012102a723eed5a8374e60b48e2cecaf7966330712966a32a2aec5950328e2c675ce10ffffffff02eac62f00000000001976a914b9b4d4c61691d6f4e68e5ad79c1ad98701f5663388ac8c341400000000001976a914d69bea7415fb38f2fc7e3edaba357fe7a563f45888ac00000000
-> decoderawtransaction 01000000034c4fa9127f8c33a84dcb43c19efca9b6fe5e488720a5e6277aa7fae8e388e11a010000006b483045022026d79a1ec97979c22249ecf2a81d25e5a45675d31ddd7894ad55c8d230dd7d3302210086db210b1693f16bc895a7794f37a36bd0b4921a57b06751a1cbd9af9572ba4301210211e8dbe80f052c1b9a3b0bf9b9f499065b0c4d8525290c0315837a4879ac340cffffffff60275914157600e5c2f1c016b6b5dc2dcb748171add3ce9af15c0cfaaa39639e000000006c493046022100d691f5962d0c4357de9dc062e83e3aa3eed5b7c43b55ebfab1fdb14ad3c8f200022100ff7f6eebb0e2159eea914c57a3d5e8300680755556de9ce77dbaee684aeeed75012102633925a9a270cf6b115b003642551e9efea2de92a1eca4288ad235ed1129be8dffffffffe30a77c90098ed4e31a1a493cf52f4fc98d954d9165dd3373cb805dbcd838f91010000006c493046022100c4727881fd52903a4c260318138fa6ebea012d002ac7c1aaa1ef6a621405a21b0221008b92ffc6f1c3e29d7421c1a576db09f261ae63a4fe605776b742a97294ff095d012102a723eed5a8374e60b48e2cecaf7966330712966a32a2aec5950328e2c675ce10ffffffff02eac62f00000000001976a914b9b4d4c61691d6f4e68e5ad79c1ad98701f5663388ac8c341400000000001976a914d69bea7415fb38f2fc7e3edaba357fe7a563f45888ac00000000
<- {
"txid" : "007077f621011fd63f13104e602d079120be93be97a4f78cb4f5f7e442894b38",
"version" : 1,
"locktime" : 0,
"vin" : [{
   "txid" : "1ae188e3e8faa77a27e6a52087485efeb6a9fc9ec143cb4da8338c7f12a94f4c",
   "vout" : 1,
   "scriptSig" : { ... },
   "sequence" : 4294967295
}, {
   "txid" : "9e6339aafa0c5cf19aced3ad718174cb2ddcb5b616c0f1c2e500761514592760",
   "vout" : 0,
   "scriptSig" : { ... },
   "sequence" : 4294967295
}, {
   "txid" : "918f83cddb05b83c37d35d16d954d998fcf452cf93a4a1314eed9800c9770ae3",
   "vout" : 1,
   "scriptSig" : { ... },
   "sequence" : 4294967295
}],
"vout" : [{
   "value" : 0.03131114,
   "n" : 0,
   "scriptPubKey" : {
       "asm" : ...,
       "hex" : ...,
       "reqSigs" : 1,
       "type" : "pubkeyhash",
       "addresses" : ["1Hvvdri3r6iXzgtzdbt9uBmas8iprcmKyk"]
   }
}, {
   "value" : 0.01324172,
   "n" : 1,
   "scriptPubKey" : {
       "asm" : ...,
       "hex" : ...,
       "reqSigs" : 1,
       "type" : "pubkeyhash",
       "addresses" : ["1LZkPGswXmwZuHYi3Xt6uFRCsCgTa4WfCD"]
   }
}]}

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