Transaction Timestamps

+2 votes
Guys

I've just noticed that when you use a combination of getrawtransaction & decoderawtransaction to inspect any transaction on the blockchain, no timestamp information is provided.  Ideally we would need this data to be returned so that consumers can verify the authenticity of a transaction including when it occurred??

{"method":"getrawtransaction","params":["047bccde50b678662a9e4a6052ec9dd7740638735dbbc65e862b827cb3549a8d"],"id":1,"chain_name":"test-chain"}

{"method":"decoderawtransaction","params":["0100000001fa53ce10f142cfb6121e73744327fab0c4b7557a1c9815aedb35a02b1d7cc565000000006a47304402206a8e6b434b3b837c004854a530197948242848fe9bd54664fe48c533ca77b1b602205bf7434a0298a9f515b2040a65019245c3440a014a9827b758dd07f9e8953430012102c5e09902f60c9a61a5f9702ba91fa38413b1a192e83b84fa869a7fa5cc2c4ce2ffffffff0200000000000000003176a914bf6d3f90ae93743241add19c9ee38e919b9a4a8a88ac1673706b71470000000901000065c501000000000000007500000000000000001b6a197b2273616c652d7072696365223a22a33235302c303030227d00000000"],"id":1,"chain_name":"test-chain"}

 

Cheers

Marty
asked Jun 1, 2016 by Marty

1 Answer

+1 vote

Transactions are timestamped by the block in which they appear - see the time field in the response to getblock. There is no timestamp inside transactions themselves.

answered Jun 1, 2016 by MultiChain
Retrieving a transactions timestamp
I have replied to this via a new question rather than with a comment....apols,

Marty
In my case, when i convert the timestamp (blocktime) to a date i get a wrong date (days before the transaction itself)
is it normal?
It should not happen - is the time set correctly on the server?
Yes the time is set correctly on the server.
I 've just sent another transaction and got 29th of june for time
OK. Are you calling getblock for the right block? How are you specifying the block - by block number or block hash?
by block hash
And you're using the block hash of the block which actually contains the transaction you're interested in? How are you finding that block's hash?
I find the block time of the block which contains the transaction with getrawtransaction
I verfy the time using getblock with the block that contains the transaction and i get a similar time

UPDATE : when i tried the getwallettransaction i got the right time but i'm afraid this won't be doable from another node. I need a command that get the time of a certain txid from any node.
If I understand it right you see the following in the output of getwallettransaction:
On the node you are sending transaction from:
timereceived - right, time - right, blocktime - wrong (in the past, before timereceived)
On other node:
timereceived - may be right, time - wrong, blocktime - wrong

This can happen if some of your nodes (not necessarily the node you are checking) have wrong date, especially if the node is a miner. MultiChain nodes don't rely on their own time and take average from other nodes.
Please check all nodes and let me know if it is not a case.
Thanks a lot! it really helped
One of the nodes had wrong date.
...