diff options
author | Thomas Hartman <thomashartman1@gmail.com> | 2020-08-19 17:15:08 -0400 |
---|---|---|
committer | bitcoindev <bitcoindev@gnusha.org> | 2020-08-19 21:15:14 +0000 |
commit | cee573b38a17379d8bad5187fb6edbb5f971e214 (patch) | |
tree | 8e201b4748fee2e470ad2ed2a3f5bfbba4adf364 | |
parent | 21773b602aa2018cda5a5b99de46bd7262c82985 (diff) | |
download | pi-bitcoindev-cee573b38a17379d8bad5187fb6edbb5f971e214.tar.gz pi-bitcoindev-cee573b38a17379d8bad5187fb6edbb5f971e214.zip |
Re: [bitcoin-dev] reviving op_difficulty
-rw-r--r-- | 06/8852465d591da9c02300ea578fc7514787a6ca | 169 |
1 files changed, 169 insertions, 0 deletions
diff --git a/06/8852465d591da9c02300ea578fc7514787a6ca b/06/8852465d591da9c02300ea578fc7514787a6ca new file mode 100644 index 000000000..e04fd3836 --- /dev/null +++ b/06/8852465d591da9c02300ea578fc7514787a6ca @@ -0,0 +1,169 @@ +Return-Path: <thomashartman1@gmail.com> +Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) + by lists.linuxfoundation.org (Postfix) with ESMTP id 91DD7C0051 + for <bitcoin-dev@lists.linuxfoundation.org>; + 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 <bitcoin-dev@lists.linuxfoundation.org>; + 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 <bitcoin-dev@lists.linuxfoundation.org>; + 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 <bitcoin-dev@lists.linuxfoundation.org>; + Wed, 19 Aug 2020 21:15:13 +0000 (UTC) +Received: by mail-qv1-f46.google.com with SMTP id b2so4291qvp.9 + for <bitcoin-dev@lists.linuxfoundation.org>; + 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 <thomashartman1@gmail.com> +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: <CAHAXnDXhAFQHiBCJ=H=1ZGHdHWhgLh1rG3pCPR5o48ziZzV+zQ@mail.gmail.com> + <CAE-z3OVCcAL2x39TswA8zrZ+yjSqdx4hccTWn9Ug8MQ5=k-Pgg@mail.gmail.com> +To: Tier Nolan <tier.nolan@gmail.com>, + Bitcoin Protocol Discussion <bitcoin-dev@lists.linuxfoundation.org> +In-Reply-To: <CAE-z3OVCcAL2x39TswA8zrZ+yjSqdx4hccTWn9Ug8MQ5=k-Pgg@mail.gmail.com> +Message-Id: <C4A9F1FC-8BD9-4A03-806B-5091375090B5@gmail.com> +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 <bitcoin-dev.lists.linuxfoundation.org> +List-Unsubscribe: <https://lists.linuxfoundation.org/mailman/options/bitcoin-dev>, + <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=unsubscribe> +List-Archive: <http://lists.linuxfoundation.org/pipermail/bitcoin-dev/> +List-Post: <mailto:bitcoin-dev@lists.linuxfoundation.org> +List-Help: <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=help> +List-Subscribe: <https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev>, + <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=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 = +<bitcoin-dev@lists.linuxfoundation.org> 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 = +<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 + +<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; = +charset=3Dus-ascii"></head><body style=3D"word-wrap: break-word; = +-webkit-nbsp-mode: space; line-break: after-white-space;" class=3D""><br = +class=3D""><div><br class=3D""><blockquote type=3D"cite" class=3D""><div = +class=3D"">On Aug 16, 2020, at 2:59 PM, Tier Nolan via bitcoin-dev = +<<a href=3D"mailto:bitcoin-dev@lists.linuxfoundation.org" = +class=3D"">bitcoin-dev@lists.linuxfoundation.org</a>> wrote:</div><br = +class=3D"Apple-interchange-newline"><div class=3D""><span = +style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: = +12px; font-style: normal; font-variant-caps: normal; font-weight: = +normal; letter-spacing: normal; text-align: start; text-indent: 0px; = +text-transform: none; white-space: normal; word-spacing: 0px; = +-webkit-text-stroke-width: 0px; text-decoration: none; float: none; = +display: inline !important;" class=3D"">Output 0: Pay Alice if = +diff < 1.00 trillion else Bob</span></div></blockquote></div><br = +class=3D""><div class=3D""><div class=3D"">What is included in blocks is = +a packed representation of the difficulty target, not the difficulty per = +se as typically reported on blockchain explorer. </div><div = +class=3D""><br class=3D""></div><div class=3D""><a = +href=3D"https://en.bitcoin.it/wiki/Difficulty" = +class=3D"">https://en.bitcoin.it/wiki/Difficulty</a></div><div = +class=3D""><br class=3D""></div><div class=3D"">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</div><div class=3D""><br class=3D""></div><div = +class=3D"">Current difficulty / last difficulty =3D 1 / ( current target = +/ last target )</div><div class=3D""><br class=3D""></div><div = +class=3D"">To give a worked example, current difficulty is 16.94T, and = +last difficulty was 16.84T. </div><div class=3D"">Current packed = +target is 0x17109bac, last packed target is 0x1710b4f8<span = +class=3D"Apple-tab-span" style=3D"white-space:pre"> = +</span></div><div class=3D"">16.94 / 16.84 is same as 1 / ( 0x109ba / = +0x10b4f8 ) (the 17 is an exponent in both cases so leaving = +it out for clarity). </div><div class=3D""><br class=3D""></div><div = +class=3D"">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. </div><div class=3D""><br class=3D""></div><div class=3D"">The= + contract could then work as previously described, except using the = +ratio for ticks instead of the difficulty.</div></div></body></html>= + +--Apple-Mail=_98632C2A-C28D-43EB-92CD-68981432E9AA-- + |