Is it possible to calculate - or even reasonably estimate - how long it took for a transaction to be included in a block after it was first created?

I'm asking about already confirmed transactions which are already included on the blockchain - and all transactions - not just ones that belong to me.

I am currently building a project which scrapes a given blockchain for whatever info/attributes a user desires. You can check it out here - be warned it's no where near ready for production and not even at version 1 yet - but the develop branch is getting close.

As I understand from the docs and the answer to this question the time received attribute is not, as some may think, the time a transaction was "received into a block" but rather the time when my client first noticed the transaction - this attribute is also not available when using getrawtransaction. So that's a no-go.

Ideally, I'm looking for the time that a transaction is created (sent) and the time it is included (confirmed) on a block.

Based on the above info my idea is:

  • for new (unconfirmed) transactions we record the time that my node first notices the transaction
  • then we record the time that my node notices it is confirmed

This would at least give me an indication as to how long it takes newly created transactions to be confirmed. Of course latency adds a huge amount of noise here, but it's at least a step in the right direction!

I would like to do this for existing, confirmed transactions if possible.

Thanks for your time.

  • I have been running a full node for some time now to extract a proxy for this information by keeping a real time tracker of transactions going through the raw mempool, adding a time stamp when my node first saw the transaction ID and then computing the time difference after the transaction has been included in a block...I do not see another way which would make it possible to determine the waiting time ex-post, e.g. after the transaction has been included in a block without tracking the raw mempool. – muffin1974 May 15 '18 at 8:02

Unfortunately, at least for bitcoin and litecoin (and likely most bitcoin derivative block chains), the only way to get this information is to have a node/client listening at the time the transaction appears on the network.

Otherwise your client will simply use the block's timestamp for each transaction.

This design means that getting this information is only possible if using a third party who was maintaining a copy of the blockchain at that time, or potentially getting a dump of a trusted source's blockchain which should (I believe, although I haven't tested it myself) maintain the original client's timestamps.

Would be great if someone could confirm this. I will myself if I get the chance to test it but that might not happen any time soon.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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