Take the 2-minute tour ×
Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. It's 100% free, no registration required.

This may be a very simple question to answer, but I haven't been able to quickly find it. Regardless, if you were to deconstruct a transaction in the blockchain, and pull out the time value of the transaction, what format is the time stamp in?

In other words, if you were to pull out the draw time value, how can I convert it to a meaningful value?

share|improve this question
    
Does the time need to be known right away, or just historical data (i.e., not including transactions from the most recent six blocks). Also, what granularity. Does knowing the block's timestamp solve the problem or do you need real-time as they arrive? Either way, these values are not immutable -- is that a requirement? –  Stephen Gornick Feb 20 '13 at 12:44
    
Well, what I'd like to do is monitor the time difference between received transactions for a specific address. In other words, I'd like to see how often transactions are sent to a specific address. The data needs to be specific to the network, not necessarily the time the user posted the payment within their client. –  RLH Feb 20 '13 at 12:45
add comment

3 Answers

up vote 4 down vote accepted

There are a couple things you could mean by the time of the transaction:

  1. When the transaction is created
  2. When the transaction is known about by 90% of the network
  3. When the transaction is first included into a block
  4. When the block is known to 90% of the network

We can't know 1, because it could have been generated offline, and there's no time field. You can assume that 1 is 30 seconds or so before 2, but again, you can't know.

We can figure out 2, because the time that we receive the transaction is going to be pretty much the same as when 90% of the network does. For historical data, blockchain.info has an API.

We can figure out 3, because there's a time field in the block. However, that can be off by up to an hour, and the network won't care. Still, there's not much reason to lie about it.

Figuring out 4 is pretty much the same as 2.

share|improve this answer
add comment

Transactions do not have a time per se. They do have a lock_time which is currently not used anyway.

Blocks do have timestamps, bytes 69-72 after trimming the protocol headers and checksums. Some may say that a transactions time is the time of the block that included it.

Another interpretation (the one used by blockchain.info) is simply the first time the transaction was received by the peer.

share|improve this answer
    
I think that would work. Actually, I have an idea for a project, but I need to know the time a transaction showed up in the chain (or was received by a peer, as you suggest.) Is the time stamp on the peer unreliable? –  RLH Feb 19 '13 at 20:39
1  
If you need something immutable not even the timestamp for the block is useful because a block reorg can still occur even once a transaction is in a block. –  Stephen Gornick Feb 20 '13 at 12:42
add comment

If you are literally referring to the "time" or "blocktime" property of a transaction within the blockchain, then this timestamp is in Unix format.

If you wanted to convert this to a meaningful time, you can use a unix command line to do a quick conversion:

Linux:

$ date -d @1395103695

Mac OSX:

$ date -j -f "%s" 1395103695

...which would return the following:

Mon Mar 17 14:48:15 HST 2014
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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