From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 91DD7C0051 for ; Wed, 19 Aug 2020 21:15:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 7533B221DC for ; Wed, 19 Aug 2020 21:15:14 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DpY29hEGl7Vj for ; Wed, 19 Aug 2020 21:15:13 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qv1-f46.google.com (mail-qv1-f46.google.com [209.85.219.46]) by silver.osuosl.org (Postfix) with ESMTPS id 741D421FAD for ; Wed, 19 Aug 2020 21:15:13 +0000 (UTC) Received: by mail-qv1-f46.google.com with SMTP id b2so4291qvp.9 for ; Wed, 19 Aug 2020 14:15:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:mime-version:subject:date:references:to:in-reply-to:message-id; bh=lnSD7rx2aFK61BXtb5A8tY9qDgxDbmPNpnhK2qXrRZs=; b=TOeEOUaQAPa0YsQz+o4xNrFe2wzg0HV2HLOUhONtQh1SLfBLLnM3K7MMG1ADZ6lBqe z3ob5wdZtDcmAg5S7ofkNFX5SdtIQCJxIZRQVt7ZAfHWviEnSIa5GO8zkXWL1Z64XmNL ciwTcd38J9cVSnmFMvY2NR/9ZssVx4zVIA0rF3i28DGx43CjlZdrvDWH/1Tt0nBltRxB OK/3x7erGBss3yoL7S/e/nu8dHIMFSDlx3Tg3l2aMO/wIfVt+JifDAhMsSAJ0bowjq+x mKrxt1s8sL8e6b1caT/nJ+Kl2EaaPgTNkSJY8RpDewMiVrO3cE8TbgZcPSXS+ct9Suma KT7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:subject:date:references:to :in-reply-to:message-id; bh=lnSD7rx2aFK61BXtb5A8tY9qDgxDbmPNpnhK2qXrRZs=; b=DBfXm0ZIXuhVTFxxRM7caRxIbVD1X9er9DL1oM+2qie7TsC3fG83rE/0TYQvcHCxI0 nxXUV4B9iVNyw8J7p3WvZP0elTZ5GMGI3aQLpkYNar1GT6xgNPyVi427RLt0+LzZqSOK 82NnRzQrBmUsjVHKZJPchBSH/5tCgnH7kCF5vUlWx9LPGS3zVH3Vnj9SHVJBR5LVNaci GQUMBcoGQeStPkwmjuOqC6jUplaaW0lwdzlDwWCRBXKD4BTw4MfOMqHRK1ja0+qF2D5h dVxvK0X3Nzws/AolmOsiSqSP7dHJPe3Fc49ded/6REYrsZdmMWoXy82VHaC8eWFZATrj 5FPA== X-Gm-Message-State: AOAM5314/eEjfeIaYxMW71awonYAxb8zm1jc4wEws45I8BUfVjvZC2kT TT1Ahri4UjCKWQ9xv/5i6dxm9tbtweqnkj6Y X-Google-Smtp-Source: ABdhPJzJBuTcC7L2pvTXjagA6/+1xHWBNiX/S9O+PK/Yaeijg9T4utmlhl7qDYVb7D8lmbAtLhP2ww== X-Received: by 2002:a0c:a81a:: with SMTP id w26mr175233qva.52.1597871712203; Wed, 19 Aug 2020 14:15:12 -0700 (PDT) Received: from [192.168.43.187] ([172.58.4.14]) by smtp.gmail.com with ESMTPSA id j15sm24673555qkl.63.2020.08.19.14.15.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Aug 2020 14:15:11 -0700 (PDT) From: Thomas Hartman Content-Type: multipart/alternative; boundary="Apple-Mail=_98632C2A-C28D-43EB-92CD-68981432E9AA" Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Date: Wed, 19 Aug 2020 17:15:08 -0400 References: To: Tier Nolan , Bitcoin Protocol Discussion In-Reply-To: Message-Id: X-Mailer: Apple Mail (2.3445.9.1) X-Mailman-Approved-At: Wed, 19 Aug 2020 21:21:34 +0000 Subject: Re: [bitcoin-dev] reviving op_difficulty X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Bitcoin Protocol Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Aug 2020 21:15:14 -0000 --Apple-Mail=_98632C2A-C28D-43EB-92CD-68981432E9AA Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Aug 16, 2020, at 2:59 PM, Tier Nolan via bitcoin-dev = wrote: >=20 > 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.=20 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 =3D 1 / ( current target / last = target ) To give a worked example, current difficulty is 16.94T, and last = difficulty was 16.84T.=20 Current packed target is 0x17109bac, last packed target is 0x1710b4f8=09= 16.94 / 16.84 is same as 1 / ( 0x109ba / 0x10b4f8 ) (the 17 is an = exponent in both cases so leaving it out for clarity).=20 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.=20 The contract could then work as previously described, except using the = ratio for ticks instead of the difficulty.= --Apple-Mail=_98632C2A-C28D-43EB-92CD-68981432E9AA Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii

On Aug 16, 2020, at 2:59 PM, Tier Nolan via bitcoin-dev = <bitcoin-dev@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. 


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 =3D 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.
= --Apple-Mail=_98632C2A-C28D-43EB-92CD-68981432E9AA--