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

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

CC BY-SA 3.0
2017-01-05T20:08:00.487Z
2017-01-05T20:08:00.487Z
Pieter Wuille
<p>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.</p>

<p>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.</p>

<p>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.</p>

<p>Perhaps someone has a better approach?</p>

<bitcoind><raw-transaction><bitcoin-cli>
GetRawTransaction not returning time
Alex
# GetRawTransaction not returning time

(Asked by: username_0 on 2017-01-05)

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?

**Tags:** bitcoind, raw-transaction, bitcoin-cli


---

## 1 answers

### Answer by username_1 on 2017-01-05. Score: 2 | Accepted answer

`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.


---

