Both transactions and blocks have a time field when you use Bitcoin's getblock or gettransaction methods. The API method list defines the transaction time as " time the transaction occurred".

Is this the time the transaction or block arrived at my client? Or is this time defined by the sender of the transaction or block?

I tried to encode a transaction to a raw transaction and decode it again afterwards, but the lock_time property is set to 0 when I do this.

The reason for this question is that I want to make sure that when you check all transactions twice, all new ones of the second check have a time value higher than the highest one of the first check.


Blocks have timestamps, transactions don't. The time of a block creation is known, the time of the transaction can only be guessed. Most clients use the block's time for transactions, and if they're still in the transaction mempool (not in a block) they use the time the transaction was first seen by the client.

| improve this answer | |
  • So you say that when a transaction gets confirmed, the time value changes to the block time value? – Steven Roose May 2 '13 at 23:19
  • 1
    That's client specific behavior, as transaction times play no role in the bitcoin network. But yeah, in this case that seems likely. Test it yourself though: go to blockchain.info, pick a few transactions that are currently unconfirmed and get the time value for them. Then get them again in like an hour or so. – Tom van der Woerdt May 2 '13 at 23:33
  • @TomvanderWoerdt, But doesn't that mean that every single node will have different timestamps because they receive the broadcast at different times? – Pacerier May 23 '14 at 14:02
  • @Pacerier Yes, it does – Tom van der Woerdt May 23 '14 at 16:31
  • @TomvanderWoerdt, Please also see bitcoin.stackexchange.com/q/25542/1475 – Pacerier May 23 '14 at 16:32

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