1

I am trying to write a quick blockchain explorer so that I can lookup transactions on my own server rather than using a 3rd party service - consider this an exercise more than a production service. I have a bitcoind server running with txindex = 1 and all is well, I can lookup transaction with getrawtransaction. But unconfirmed transactions do not have block data, and most importantly the time field.

However many 3rd party lookup services like blockchain, tradeblock, etc return a timestamp for the transaction even when not confirmed. So I have tried to use the walletnotify command to record the time the transaction is seen but it's not getting called - probably due to the fact I have disablewallet=1 or because these transactions do not relate to my server.

So my next step is to continuously check the transactions in the current block and record the timestamp that way - suffice to say this is not the best approach but I am really struggling to think of another way.

Perhaps someone has a better approach?

1 Answer 1

2

getrawtransaction does not return the time, because it only gives you the raw transaction itself, which does not include a timestamp.

However, you can use the getmempoolentry RPC to get mempool metadata about a transaction, which includes the time at which time it entered the mempool.

0

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.