What is Nostr?
Thomas Hartman [ARCHIVE] /
npub1ffm…9z9w
2023-06-07 18:26:35
in reply to nevent1q…sda9

Thomas Hartman [ARCHIVE] on Nostr: 📅 Original date posted:2020-08-19 📝 Original message:> On Aug 16, 2020, at 2:59 ...

📅 Original date posted:2020-08-19
📝 Original message:> On Aug 16, 2020, at 2:59 PM, Tier Nolan via bitcoin-dev <bitcoin-dev at lists.linuxfoundation.org> wrote:
>
> Output 0: Pay Alice if diff < 1.00 trillion else Bob

What is included in blocks is a packed representation of the difficulty target, not the difficulty per se as typically reported on blockchain explorer.

https://en.bitcoin.it/wiki/Difficulty <https://en.bitcoin.it/wiki/Difficulty>;

Perhaps what is best for speculation contracts is not the difficulty per se, but the ratio between some unknown future difficulty and the current difficulty. That is easily obtained from the packed representations already included in blocks. IE

Current difficulty / last difficulty = 1 / ( current target / last target )

To give a worked example, current difficulty is 16.94T, and last difficulty was 16.84T.
Current packed target is 0x17109bac, last packed target is 0x1710b4f8
16.94 / 16.84 is same as 1 / ( 0x109ba / 0x10b4f8 ) (the 17 is an exponent in both cases so leaving it out for clarity).

So perhaps the way op_diff should work is take 2 packed targets, 1 known and 1 unknown at time of contract, and return the ratio.

The contract could then work as previously described, except using the ratio for ticks instead of the difficulty.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20200819/4a4b1a9f/attachment.html>;
Author Public Key
npub1ffml6fw4zq92ysqwe4addw44frugxladd2fmelrvsrn2uvmyteyswn9z9w