2

I am running a BTC core node and I would like to perform some experiments and analysis on Bitcoin transaction latency. However, I see that the method getrwatransaction returns an object with:

"blocktime" : xxx, (numeric) The block time expressed in UNIX epoch time

"time" : n, (numeric) Same as "blocktime"

As I would like to get information on transaction latency, in a way that I can subtract the first appearance of such transaction in the mempool with the block creation epoch, those two parameters should not be the same, otherwise I only see it as a redundant and useless information.

Is there a way to get such piece of information? I see that mempool does not store (obviously) all the record of received transactions, so I was wondering whether such information is stored in the transaction itself, or if it is possible to get it somehow.

2 Answers 2

3

You can use either getrawmempool (for all mempool transactions) or getmempoolentry (for individual transactions) to get the exact time a transaction was accepted into your node's mempool:

"time": xxx, (numeric) local time transaction entered pool in seconds since 1 Jan 1970 GMT

You can also listen for the hashtx ZeroMQ event and store the time when that event was received. Storing timestamps is something you will need to do anyway, since when the transaction becomes confirmed, Bitcoin Core seems to immediately discard the mempool entry data.

2
  • Thank you for your answer. But those solutions imply that transactions to be analyzed are new. If I need to fetch transaction latency for some 2014 transactions, how do I do? Is that possible?
    – ted
    Dec 8, 2022 at 13:37
  • 3
    No, that's not possible, unless you can find someone who collected this data back in 2014 to give it to you, and you also have no way to make sure this data is correct. Dec 8, 2022 at 13:43
0

As a useful info for who might be needing such data, I have found out that that using blockchain.info APIs, information about latency on newer transactions can be fetched. In fact, if we try to query BTC core node:

getrawtransaction "614095eeb59da281af6d49d85a153bfd8ec41acca272289e49bc6bd60b7ac7f6" true

we notice that "time": 1669848740, equals to "blocktime" one. However, if we query blockchain.info APIs, we obtain "time":1669848666, giving us a latency of 74 seconds.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.