Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 6A85EC07 for ; Tue, 29 May 2018 04:01:50 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f46.google.com (mail-wm0-f46.google.com [74.125.82.46]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 94380224 for ; Tue, 29 May 2018 04:01:49 +0000 (UTC) Received: by mail-wm0-f46.google.com with SMTP id a8-v6so36465311wmg.5 for ; Mon, 28 May 2018 21:01:49 -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; bh=OtpS/RQVVgn9H6EeP48cFeET4eNFRHbWrCIgWYRgOnc=; b=BzwHUrM+ZRHE2SB+0cUBfIbgkVLbDezhynf12xiU1bLNYW6jZbr3FiQ7fdUPXl0Uf5 BfJTQnrZqbO9Q/sP7FHex6na02FQdWt9rl6o7nrtUnUbs11hRifsQ6NzxuBzDHJrrITa bLVIDJ7C39px5ou+9QqeyFNPJ7U4oUcIn5ZcUa414KaK+Y/I+I84T+MU+OKFFNHt2oyD wtGyYm36iDmS+7R9xSRdo+ZUMjvozwtde+A7eyM/QmFAVHyK0+F4tCVwe5sic5+Sn2Uf AFWxojkBDfMC4ypz+pAOxEsCfslvZxsjLy8OYOPOkwn5VsAwhR3V3khcKdz8fmIaxL6q BAZg== 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; bh=OtpS/RQVVgn9H6EeP48cFeET4eNFRHbWrCIgWYRgOnc=; b=t+VVSCCvE/fllHKjvVOjvOy/CL3Sb/g62wHLUogIZKTBz5zzmY+J/PvoYDCWpXg7GX mASMlalMbZnFMMhkCcaOeYoQaYp/KIRvQ97rp1Xbc+shg+Z43IQLvXyhIZFlCkWOqB6+ CQ88VVanjvw07N2z3CaPVtUGkRm5qsBwXyshLEtmQU+/f45A0//T/EhU4HMuDyKD7r5q 3inBfPBMrxWiMkSKhpDgP7iWYwYhbxsj578p9D1JwLdjXkN5HsLnUgyCaWImaZsCl6Eh /mIarXEE8AdCh1C/h7CXJe/l7qyMGdkcoc9J1hY+mKQvOUwnlNmLuDwZcD0x0qMTNNdt cbow== X-Gm-Message-State: ALKqPwcvrI/QMuQSZYc1BbckAmCbKt6lYbzmSWeAypPOookEOg4WAhfh IPmmi8tUITPhLUZN2g0MzUuaq5mq/UC5u7hM64k= X-Google-Smtp-Source: AB8JxZr8sjcaqiJthlwr1VfKwVb6vGnjrnuyMlykj4lI8obxRByqbFRZOgCOYBwFm+a2XcZXK+sJrZK4sQ8g3aBzFrM= X-Received: by 2002:a50:a227:: with SMTP id 36-v6mr17310142edl.151.1527566508039; Mon, 28 May 2018 21:01:48 -0700 (PDT) MIME-Version: 1.0 References: <22d375c7-a032-8691-98dc-0e6ee87a4b08@mattcorallo.com> <7E4FA664-BBAF-421F-8C37-D7CE3AA5310A@gmail.com> In-Reply-To: From: Olaoluwa Osuntokun Date: Mon, 28 May 2018 21:01:35 -0700 Message-ID: To: Jim Posen , Bitcoin Protocol Discussion Content-Type: multipart/alternative; boundary="00000000000015246c056d504b19" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: Re: [bitcoin-dev] BIP 158 Flexibility and Filter Size 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: Tue, 29 May 2018 04:01:50 -0000 --00000000000015246c056d504b19 Content-Type: text/plain; charset="UTF-8" > The additional benefit of the input script/outpoint filter is to watch for > unexpected spends (coins getting stolen or spent from another wallet) or > transactions without a unique change or output address. I think this is a > reasonable implementation, and it would be nice to be able to download that > filter without any input elements. As someone who's implemented a complete integration of the filtering technique into an existing wallet, and a higher application I disagree. There's not much gain to be had in splitting up the filters: it'll result in additional round trips (to fetch these distinct filter) during normal operation, complicate routine seed rescanning logic, and also is detrimental to privacy if one is fetching blocks from the same peer as they've downloaded the filters from. However, I'm now convinced that the savings had by including the prev output script (addr re-use and outputs spent in the same block as they're created) outweigh the additional booking keeping required in an implementation (when extracting the precise tx that matched) compared to using regular outpoint as we do currently. Combined with the recently proposed re-parametrization of the gcs parameters[1], the filter size should shrink by quite a bit! I'm very happy with the review the BIPs has been receiving as of late. It would've been nice to have this 1+ year ago when the draft was initially proposed, but better late that never! Based on this thread, [1], and discussions on various IRC channels, I plan to make the following modifications to the BIP: 1. use P=2^19 and M=784931 as gcs parameters, and also bind these to the filter instance, so future filter types may use distinct parameters 2. use the prev output script rather than the prev input script in the regular filter 3. remove the txid from the regular filter(as with some extra book-keeping the output script is enough) 4. do away with the extended filter all together, as our original use case for it has been nerfed as the filter size grew too large when doing recursive parsing. instead we watch for the outpoint being spent and extract the pre-image from it if it matches now The resulting changes should slash the size of the filters, yet still ensure that they're useful enough for our target use case. [1]: https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2018-May/016029.html -- Laolu --00000000000015246c056d504b19 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
> The additional benefit of the input script/outpo= int filter is to watch for
> unexpected spends (coins= getting stolen or spent from another wallet) or
> transaction= s without a unique change or output address. I think this is a
&g= t; reasonable implementation, and it would be nice to be able to download t= hat
> filter without any input elements.=C2=A0

<= /div>
As someone who's implemented a complete integration of the fi= ltering
technique into an existing wallet, and a higher applicati= on I disagree.
There's not much gain to be had in splitting u= p the filters: it'll result in
additional round trips (to fet= ch these distinct filter) during normal
operation, complicate rou= tine seed rescanning logic, and also is detrimental
to privacy if= one is fetching blocks from the same peer as they've
downloa= ded the filters from.

However, I'm now convinc= ed that the savings had by including the prev output
script (addr= re-use and outputs spent in the same block as they're created)
outweigh the additional booking keeping required in an implementation (w= hen
extracting the precise tx that matched) compared to using reg= ular outpoint
as we do currently. Combined with the recently prop= osed re-parametrization
of the gcs parameters[1], the filter size= should shrink by quite a bit!

I'm very happy = with the review the BIPs has been receiving as of late. It
would&= #39;ve been nice to have this 1+ year ago when the draft was initially
proposed, but better late that never!

Based = on this thread, [1], and discussions on various IRC channels, I plan
<= div>to make the following modifications to the BIP:

=C2=A0 1. use P=3D2^19 and M=3D784931 as gcs parameters, and also bind th= ese to the
=C2=A0 =C2=A0 =C2=A0filter instance, so future filter = types may use distinct parameters
=C2=A0 2. use the prev output s= cript rather than the prev input script in the
=C2=A0 =C2=A0 =C2= =A0regular filter
=C2=A0 3. remove the txid from the regular filt= er(as with some extra book-keeping
=C2=A0 =C2=A0 =C2=A0the output= script is enough)=C2=A0
=C2=A0 4. do away with the extended filt= er all together, as our original use case
=C2=A0 =C2=A0 =C2=A0for= it has been nerfed as the filter size grew too large when doing
= =C2=A0 =C2=A0 =C2=A0recursive parsing. instead we watch for the outpoint be= ing spent and
=C2=A0 =C2=A0 =C2=A0extract the pre-image from it i= f it matches now

The resulting changes should slas= h the size of the filters, yet still ensure
that they're usef= ul enough for our target use case.


-- Laolu
--00000000000015246c056d504b19--