Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: AmDD on March 03, 2016, 06:15:50 PM



Title: Is the current difficulty included in blockchain?
Post by: AmDD on March 03, 2016, 06:15:50 PM
For example, if I lookup block 1492 is there any information included with the block in the blockchain that would give the difficulty at the time the block was mined?


Title: Re: Is the current difficulty included in blockchain?
Post by: --Encrypted-- on March 03, 2016, 06:17:30 PM
For example, if I lookup block 1492 is there any information included with the block in the blockchain that would give the difficulty at the time the block was mined?

https://blockchain.info/block/000000002590c6bd1c26c7afffb1dfb621950be4a6d9b89d019455c982997368

yes. it's not so hard to check.


Title: Re: Is the current difficulty included in blockchain?
Post by: jonnybravo0311 on March 03, 2016, 06:48:12 PM
Using the bitcoin client...

Code:
>bitcoin-cli getblockhash 1492
000000002590c6bd1c26c7afffb1dfb621950be4a6d9b89d019455c982997368

>bitcoin-cli getblock "000000002590c6bd1c26c7afffb1dfb621950be4a6d9b89d019455c982997368" true
{
  "hash": "000000002590c6bd1c26c7afffb1dfb621950be4a6d9b89d019455c982997368",
  "confirmations": 399504,
  "size": 216,
  "height": 1492,
  "version": 1,
  "merkleroot": "5c24d1f94f5315b8d9808f83e18a1dfce2dcfd1c4f3cae1241f38647908b1a76",
  "tx": [
    "5c24d1f94f5315b8d9808f83e18a1dfce2dcfd1c4f3cae1241f38647908b1a76"
  ],
  "time": 1232763992,
  "mediantime": 1232762084,
  "nonce": 3780540712,
  "bits": "1d00ffff",
  "difficulty": 1,
  "chainwork": "000000000000000000000000000000000000000000000000000005d505d505d5",
  "previousblockhash": "00000000b7f525ddd961b69117ec21f5fc253af5a60be885a72cab6cc65b4adc",
  "nextblockhash": "00000000c3a7bc56d1eaace7a174de16999db9e747aeec41ab62318f812b2678"
}

Hope this helps :)


Title: Re: Is the current difficulty included in blockchain?
Post by: AmDD on March 03, 2016, 08:05:25 PM
Awesome, thanks! I knew some block explorers would show this but I didnt know if they collected the info manually (checking the difficulty in realtime with each block) or if it was actually recorded with the blockchain.

Thank you both


Title: Re: Is the current difficulty included in blockchain?
Post by: watashi-kokoto on March 03, 2016, 09:32:54 PM
Thank you both

Yes difficulty is part of block header.

This way node can just from seeing the header know if it satisfies the difficulty.

But the node also checks if the difficulty itself is not fake (lower) by calculating the current difficulty from whole blockchain.