From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id C23C6E5D for ; Mon, 29 Jul 2019 02:20:09 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 5C93C5E4 for ; Mon, 29 Jul 2019 02:20:08 +0000 (UTC) Received: by mail-wr1-f41.google.com with SMTP id 31so60054581wrm.1 for ; Sun, 28 Jul 2019 19:20:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ib.tc; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lGMPxF7OBJlHbUkXZ51JwXqngiUR6MBnsSpo5QA9oJ4=; b=RP11zCAyp2RZGicT+86j4mwpR7uOAhzdqoFufYkxcE0npze79KpS7g444D64KjlFp4 w84XcYIeiC3GVhlTa/ljMd4/O0Z8knjffDPsKysXIengTkizpOCO4icLSIGLbdFLKa4Q b5kCr3cvg1LOHMx8fS+w71K2Aul1L/X6MFULIFQ8spzAomTg3gIu6FvibC/Hg8aMtwBD 52n0AvyNBADXiYYAG0RwpPHW+UjSYAvs/He5M4Z98wv+DyJqO8ARaKXBeJlOo5KorTCf tNLPcAHWNC0suqdpO/8N1u4w+bR8K+Y5okAns0ubJVMgGtzIcj7Sz/g2VdTwxH2h8OU6 HMhg== 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=lGMPxF7OBJlHbUkXZ51JwXqngiUR6MBnsSpo5QA9oJ4=; b=UeU7n+9XmVxOO8cl0c50tq+LlWDRqjYu4VsafNfIAygnA3sN8z++GtvlTwlbQLDNxu LRClkmO+X7a01pHagJORG8DTi6NB4HMJ68MAz/D4vzXH7xyywNJQwmbHdz1wPuvzBLJt O41Ke1XTmmWTqJLEA5g5WX0+Zh+4Run444NHmR7lr7xmqHEcjiQEJ/1p3L33ZCzP2362 iYQPgR6hGzRLPyJLgqxMf8qJFgsMaS02yg0Jcbm1M7nsVvml0uGEFhxW3KPY4bmm0RHN 2fX/DUa/UE6M8+jXOdhSDH+WFnJC9a+qvXEA9yoE/wiTOI5YpFlWDbBI8FQy2olYdUu6 HOoA== X-Gm-Message-State: APjAAAUnEQSFBkj6wC6JSTyLQWIDkRFA0nJTg2MPNrvP3z6JhTRso4Nd NeJeYdmKOlWQsnI4KcrfXO7Ke0J/+8q/zfIp8IA= X-Google-Smtp-Source: APXvYqxbkshNMP028EQx2KySho0vIZNJ241CPxP2wGXbooy7QssnIAr5OeTreoGNQRhppIs51KcYT1ElwzZF4TJUDx0= X-Received: by 2002:adf:dfc4:: with SMTP id q4mr113864639wrn.54.1564366806891; Sun, 28 Jul 2019 19:20:06 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Mike Brooks Date: Sun, 28 Jul 2019 19:19:55 -0700 Message-ID: To: ZmnSCPxj Content-Type: multipart/alternative; boundary="000000000000d2d171058ec887f7" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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: Mon, 29 Jul 2019 02:53:15 +0000 Cc: Bitcoin Protocol Discussion , "pieter.wuille@gmail.com" Subject: Re: [bitcoin-dev] PubRef - Script OP Code For Public Data References 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: Mon, 29 Jul 2019 02:20:09 -0000 --000000000000d2d171058ec887f7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable ZmnSCPxj, I think that this implication affects other applications built on the blockchain, not just the PubRef proposal: > There is a potential for a targeted attack where a large payout going to a `scriptPubKey` that uses `OP_PUBREF` on a recently-confirmed transaction finds that recently-confirmed transaction is replaced with one that pays to a different public key, via a history-rewrite attack. > Such an attack is doable by miners, and if we consider that we accept 100 blocks for miner coinbase maturity as "acceptably low risk" against miner shenanigans, then we might consider that 100 blocks might be acceptable for this also. > Whether 100 is too high or not largely depends on your risk appetite. I agree 100% this attack is unexpected and very interesting. However, I find the arbitrary '100' to be unsatisfying - I'll have to do some more digging. It would be interesting to trigger this on the testnet to see what happens. Do you know if anyone has pushed these limits? I am so taken by this attack I might attempt it. > Data derived from > 220Gb of perpetually-growing blockchain is hardly, to my mind, "only needs an array". There are other open source projects that have to deal with larger data sets and have accounted for the real-world limits on computability. Apache HTTPD's Bucket-Brigade comes to mind, which has been well tested and can account for limited RAM when accessing linear data structures. For a more general purpose utility leveldb (bsd-license) provides random access to arbitrary data collections. Pruning can also be a real asset for PubRef. If all transactions for a wallet have been pruned, then there is no need to index this PubRef - a validator can safely skip over it. Best Regards, Mike On Sun, Jul 28, 2019 at 6:46 PM ZmnSCPxj wrote: > Good morning Mike, > > > Sent with ProtonMail Secure Email. > > =E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90 Original = Message =E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90 > On Sunday, July 28, 2019 4:03 AM, Mike Brooks wrote: > > > Hey ZmnSCPxj, > > > > As to your first point. I wasn't aware there was so much volatility at > the tip, also 100 blocks is quite the difference! I agree no one could > references a transaction in a newly formed blocks, but I'm curious how th= is > number was chosen. Do you have any documentation or code that you can sha= re > related to how re-orgs are handled? Do we have a kind of 'consensus > checkpoint' when a re-org is no longer possible? This is a very interesti= ng > topic. > > > > Miner coinbases need 100 blocks for maturity, which is the basis of my > suggestion to use 100 blocks. > It might be too high, but I doubt there will be good reason to be less > than 100. > > There is a potential for a targeted attack where a large payout going to = a > `scriptPubKey` that uses `OP_PUBREF` on a recently-confirmed transaction > finds that recently-confirmed transaction is replaced with one that pays = to > a different public key, via a history-rewrite attack. > Such an attack is doable by miners, and if we consider that we accept 100 > blocks for miner coinbase maturity as "acceptably low risk" against miner > shenanigans, then we might consider that 100 blocks might be acceptable f= or > this also. > Whether 100 is too high or not largely depends on your risk appetite. > > > A validator only needs an array of PUSHDATA elements and can then > validate any given SCRIPT at O(1). > > Data derived from > 220Gb of perpetually-growing blockchain is hardly, to > my mind, "only needs an array". > Such an array would not fit in memory for many devices that today are > practical for running fullnodes. > It is keeping that array and indexing it which is the problem, i.e. the > devil in the details. > > Reiterating also, current pruned nodes did not retain that data and would > be forced to re-download the entire blockchain. > Unless you propose that we can refer only to `OP_PUSHDATA` after > activation of `OP_PUSHREF`. > > Regards, > ZmnSCPxj > --000000000000d2d171058ec887f7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
ZmnSCPxj,

=C2=A0I think that= this implication affects other applications built on the blockchain, not j= ust the PubRef proposal:

=C2=A0> There is a pot= ential for a targeted attack where a large payout going to a `scriptPubKey`= that uses `OP_PUBREF` on a recently-confirmed transaction finds that recen= tly-confirmed transaction is replaced with one that pays to a different pub= lic key, via a history-rewrite attack.
=C2=A0> Such an attack is doab= le by miners, and if we consider that we accept 100 blocks for miner coinba= se maturity as "acceptably low risk" against miner shenanigans, t= hen we might consider that 100 blocks might be acceptable for this also.=C2=A0> Whether 100 is too high or not largely depends on your risk app= etite.

I agree 100% this attack is unexpected and v= ery interesting.=C2=A0 However, I find the arbitrary '100' to be un= satisfying - I'll have to do some more digging. It would be interesting= to trigger this on the testnet to see what happens.=C2=A0 Do you know if a= nyone has pushed these limits?=C2=A0 I am so taken by this attack I might a= ttempt it.

=C2=A0> Data derived from > 220Gb of pe= rpetually-growing blockchain is hardly, to my mind, "only needs an arr= ay".

There are other open source projects tha= t have to deal with larger data sets and have accounted for the real-world = limits on computability. Apache HTTPD's Bucket-Brigade comes to mind, w= hich has been well tested and can account for limited RAM when accessing li= near data structures. For a more general purpose utility leveldb (bsd-licen= se) provides random access to arbitrary data collections.=C2=A0 Pruning can= also be a real asset for PubRef.=C2=A0 If all transactions for a wallet ha= ve been pruned, then there is no need to index this PubRef - a validator ca= n safely skip over it.

Best Regards,
Mik= e

On Sun, Jul 28, 2019 at 6:46 PM ZmnSCPxj <ZmnSCPxj@protonmail.com> wrote:
Good morning Mike,


Sent with ProtonMail Secure Email.

=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90 Original Me= ssage =E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90
On Sunday, July 28, 2019 4:03 AM, Mike Brooks <m@ib.tc> wrote:

> Hey ZmnSCPxj,
>
> As to your first point.=C2=A0 I wasn't aware there was so much vol= atility at the tip, also 100 blocks is quite the difference!=C2=A0 I agree = no one could references a transaction in a newly formed blocks, but I'm= curious how this number was chosen. Do you have any documentation or code = that you can share related to how re-orgs are handled? Do we have a kind of= 'consensus checkpoint' when a re-org is no longer possible? This i= s a very interesting topic.
>

Miner coinbases need 100 blocks for maturity, which is the basis of my sugg= estion to use 100 blocks.
It might be too high, but I doubt there will be good reason to be less than= 100.

There is a potential for a targeted attack where a large payout going to a = `scriptPubKey` that uses `OP_PUBREF` on a recently-confirmed transaction fi= nds that recently-confirmed transaction is replaced with one that pays to a= different public key, via a history-rewrite attack.
Such an attack is doable by miners, and if we consider that we accept 100 b= locks for miner coinbase maturity as "acceptably low risk" agains= t miner shenanigans, then we might consider that 100 blocks might be accept= able for this also.
Whether 100 is too high or not largely depends on your risk appetite.

>=C2=A0 A validator only needs an array of PUSHDATA elements and can the= n validate any given SCRIPT at O(1).=C2=A0=C2=A0

Data derived from > 220Gb of perpetually-growing blockchain is hardly, t= o my mind, "only needs an array".
Such an array would not fit in memory for many devices that today are pract= ical for running fullnodes.
It is keeping that array and indexing it which is the problem, i.e. the dev= il in the details.

Reiterating also, current pruned nodes did not retain that data and would b= e forced to re-download the entire blockchain.
Unless you propose that we can refer only to `OP_PUSHDATA` after activation= of `OP_PUSHREF`.

Regards,
ZmnSCPxj
--000000000000d2d171058ec887f7--