Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 2E0DCCD4 for ; Fri, 24 May 2019 08:36:35 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id B754FF4 for ; Fri, 24 May 2019 08:36:34 +0000 (UTC) Received: by mail-io1-f47.google.com with SMTP id u2so7146059ioc.4 for ; Fri, 24 May 2019 01:36:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AfVMDJ6dUyi28gF4pUYumEDoih6vc3ZX2v1qunVHU1Q=; b=h1gIeB9QLgdMhi9BBhHLSfhcvdwg1s0KxAh5VQ5Kk/5S9IyLt0JjAbaHq63RLoJqo8 YBAck/mQzzpJluJ9KUhICTZeQo6suNcV3nMLqqvkO6on7wtasyxzDJyfRbV1NTOHmLZ+ H9KVLn6s+kRn+CnXDV3U/98OiaP4ejMQjI1HAHNYuKkkcdGKpOLWwW5lb4IylSm+Y6Rx jsayzOCXspvAtQ6/X+uAkY+KCnk8QzOhpgVB0r8rWGjp1nNN+/1lR1+5wZo2sSAsu/Gy bVVqYiDblpX44HZ9gWLIkxNN4A97QvN8xlixjoorE9vlaMm5OsVUXmmTG9uBgBXx8rEG YG6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AfVMDJ6dUyi28gF4pUYumEDoih6vc3ZX2v1qunVHU1Q=; b=GBFo5R/14saa5X+6rpMq1hSC3FbGGyDWSw0yrZuTXRyIeVBgwvhAwIW2y/n/WdTeAz PxcKeW9Ik3ejSFW24VuPqsclw7EvK41Jir4snXbmARMZmj7I6eGfCcs9r5jJee2Q6iys eN4KuJMFRkBXwB1AxjDee8QPcWa2+ppsytT5j6SNKvtx2M+1d4OotoI361Ok8g7WoCAC 551U/dztm+z1u9MmHLa2dHu/c26RCZDi3HVxZNGQ3BtUqhbteq1bO6oMm/Pgu76+tujN 3B84w3FdW53Y/dMdkcu2/JAK2tKA7b0ara07kBkiM1XreYfC1ANimTvs0Yt8/btgqUyQ VFXw== X-Gm-Message-State: APjAAAW98DMO6CJzUzzM0yYCcHfMjV3ihytuEBWLQw5jfkRz+3faPQjU XkxHc7VFtmVe7jiOo3W7ZoonROmE6hGopTPJwfA= X-Google-Smtp-Source: APXvYqyQcPlok3D4CneITNEFrBjfzZQ1Jo0P2pCzY4EmHZjSxhxxRru99IIbmzE50DUslunIUVb9R+LrO5XERt5+hmY= X-Received: by 2002:a05:6602:218f:: with SMTP id b15mr1051157iob.233.1558686993889; Fri, 24 May 2019 01:36:33 -0700 (PDT) MIME-Version: 1.0 References: <42F53D61-BAAE-464F-BB0D-4D0CDC554D9A@gmail.com> In-Reply-To: From: Natanael Date: Fri, 24 May 2019 10:36:14 +0200 Message-ID: To: Pieter Wuille , Bitcoin Protocol Discussion Content-Type: multipart/alternative; boundary="000000000000963cfd05899e181c" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org X-Mailman-Approved-At: Fri, 24 May 2019 14:39:19 +0000 Subject: Re: [bitcoin-dev] OP_DIFFICULTY to enable difficulty hedges (bets) without an oracle and 3rd party. X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Bitcoin Protocol Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 May 2019 08:36:35 -0000 --000000000000963cfd05899e181c Content-Type: text/plain; charset="UTF-8" On Thu, May 23, 2019 at 9:58 PM Pieter Wuille via bitcoin-dev < bitcoin-dev@lists.linuxfoundation.org> wrote: > If the difficulty can be directly observed by the script language, you > would need to re-evaluate all scripts in unconfirmed transactions > whenever the difficulty changes. This complicates implementation of > mempools, but it also makes reasoning about validity of (chains of) > unconfirmed transactions harder, as an unconfirmed predecessor may > have conditions that change over time. To deal with potentially wildly varying difficulty, could the value exposed be the sum of accumulated PoW, or in other words the sum of each block's difficulty value in the entire chain? This should be a value that will only rise unless a reorg happens after a difficulty drop happens (only likely to be the result of users manually blacklisting an otherwise valid block that is several blocks back in the chain). This mimics the effect of the block number which only grows. So if you're starting at time A with difficulty X, then you'd estimate what you think the accumulated PoW ought to be at time B with expected difficulty Y (as compared to the current value at time A), and put that value into the script. --000000000000963cfd05899e181c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, May 23, 2019 at 9:58 PM Pieter Wu= ille via bitcoin-dev <bitcoin-dev@lists.linuxfoundation.org> wrote:
If t= he difficulty can be directly observed by the script language, you
would need to re-evaluate all scripts in unconfirmed transactions
whenever the difficulty changes. This complicates implementation of
mempools, but it also makes reasoning about validity of (chains of)
unconfirmed transactions harder, as an unconfirmed predecessor may
have conditions that change over time.

To d= eal with potentially wildly varying difficulty, could the value exposed be = the sum of accumulated PoW, or in other words the sum of each block's d= ifficulty value in the entire chain? This should be a value that will only = rise unless a reorg happens after a difficulty drop happens (only likely to= be the result of users manually blacklisting an otherwise valid block that= is several blocks back in the chain).

This mimics= the effect of the block number which only grows. So if you're starting= at time A with difficulty X, then you'd estimate what you think the ac= cumulated PoW ought to be at time B with expected difficulty Y (as compared= to the current value at time A), and put that value into the script.
=
--000000000000963cfd05899e181c--