How to calculate difficulty re target?

How to calculate difficulty re target?

I am trying to re-calculate difficulty and verify by using the formula

T${new}$ = T${old} \times \frac{Time~ taken~ for~ previous~ 2016~ blocks}{2016~\times ~600}$

I used block #s 564697 and 562681 for verification (which are exactly 2016 blocks apart).

For block 562681:

bits : 388919176  (172E6F88 in hex)

timestamp : 2019-02-12 04:27:23

And for block 564697

bits : 388914000 (172E5B50 in hex)

timestamp : 2019-02-26 06:09:48

Time gap is 1215745 seconds .

So I calculated T$_new$ = 2E6F88 $\times$ 256$^{(17-3)} \times \frac{1215745}{2016~\times~600}

= 3058668.0803240740740740740740741 $\times$ 2^{160}

This should the new difficulty for block 564697. But when I reconvert it back to bits I am getting only 388934636 instead of 388914000.

Why is this difference or am I making some mistake in calculation?

https://ift.tt/2TfqlxL

Comments

Popular posts from this blog

Bitcoin Core errors with database block

sendrawtransaction and txn-mempool-conflict