0

I am just learning mining process. Today I learned that we have to find nonce for given block header.

And for block header we need timestamp in UTC

I took the timestamp data from below link of 125552 block https://www.blockchain.com/btc/block/00000000000000001e8d6829a8a21adc5d38d0a473b144b6765798e61f98bd1d

And used the below linke to convert it from UTC to seconds https://www.epochconverter.com/

And I am getting 1305998760

But according to the example in the below link its 1305998791 https://en.bitcoin.it/wiki/Block_hashing_algorithm

And what is endian in the above link

Can anyone please help me what am I missing

Thanks in advance

2

Displayed precision ≠ Stored precision

Note that the block timestamp is stored as a 4-byte number of seconds since 1970-01-01T00:00 UTC (the Unix epoch). However Blockchain.com show this in a more human readable form rounded or truncated to the nearest minute (2011-05-21 18:26). So if you convert that human readable time back to an integer, you will get a value that is different by a number of seconds between 0 and 59

Endianness

See Wikipedia article on endianness. There are two possible orderings of the bytes of a multi-byte integer. You can start with least significant byte (LSB) or with most significant byte (MSB). Internet standard "Network Order" is big-endian. X86 architecture computers use little-endian byte-order. Some other hardware architectures use big-endian byte-order.

Bitcoin

Bitcoin mostly uses little endian. Even for data transmitted over the Internet. See documentation for block hashing. Note that it talks about the use of big-endian for hexadecimal display of values and little-endian for storage.

Timestamps are not accurate

See Why don't the timestamps in the block chain always increase?

A timestamp is accepted as valid if it is greater than the median timestamp of previous 11 blocks, and less than the network-adjusted time + 2 hours. "Network-adjusted time" is the median of the timestamps returned by all nodes connected to you.

So don't be surprised if later blocks sometimes have earlier timestamps. Children can be older than their parents.

6
  • Thank you for the info. can you help me where can i get the correct time stamp with seconds for any block
    – V01
    Oct 14 at 11:24
  • E.g. Blockstream gives seconds. Remember that block timestamps are not meant to be an accurate representation of the time a block was created, they can vary from actual time by an hour or more. Miners can tweak them as an extra nonce. Miners don't have to keep accurate time. Oct 14 at 11:44
  • wow so timestamp is also a parameter that miners have the control? and it can be used as extra nonce? that's interesting
    – V01
    Oct 14 at 12:33
  • Thank you i again worked considering the timestamp with including seconds and i got blockheader like 0100000081cd02ab7e569e8bcd9317e2fe99f2de44d49ab2b8851ba4a308000000000000e320b6c2fffc8d750423db8b1eb942ae710e951ed797f7affc8892b0f1fc122bc7f5d74df2b9441a42a14695 same as the 125552 showed in link en.bitcoin.it/wiki/Block_hashing_algorithm when i applied double hash to it using xorbin.com/tools/sha256-hash-calculator i am not getting same result can you please help me
    – V01
    Oct 15 at 12:11
  • This website works best when you ask one question at a time so It would probably best if you ask a new question showing exactly what you want to do, how you did the calculations and exactly how the results differ from what you expected. In your new question you can include a link back to this one if you think it will help people understand your new question. Oct 15 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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