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 98CF1D0A for ; Tue, 22 May 2018 01:17:07 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 5D035F3 for ; Tue, 22 May 2018 01:17:05 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id x12-v6so14039581wmc.0 for ; Mon, 21 May 2018 18:17:05 -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=cifVcp8iVLNyTFBMIw4vG8BbfDyatTpibI4P5ELqLoQ=; b=twCxahCiZ1TGoU+n9kN0rezvYaAAfajjOPg3ucqrlDWX0sd/PBf/8H0Q1ch+7jumvS hA9RDNsDQdje1PKtCLzdSWiQEkjKCWwi/pU8Xipisun0MHhn2LO0rE05RUBPfq5qq4z9 IVG3gJ6uBCm8ZIgnv91EgpEtFmA9w4iLX9uGe8UiGQlAVdoCLpREPC6RkbcBE/ME9swb BO9CNotxgLnTbqSdprz+4Z81oQUHV3pwX9mJBsfHpEYrlcwpqGMVTG9OTTJ+q1GHU0oo HUPdeaYy9iQu1qrtLlNWjwifMkOygkr41f+l8EL3QETJ+YxjlSGob71lYADDO0nUrctV BZKw== 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=cifVcp8iVLNyTFBMIw4vG8BbfDyatTpibI4P5ELqLoQ=; b=Gs/XxKOdU4udBbH/ehUwRoYkEOg84tjYkTe6h/AF94e8tmqgDGIWdDQFio7Zfjm8W3 RKfH5Za9rWDe31YcvomG92aAeasUZzexZp+oP14dJJEBbATtOz0/GbcLzfkJFCE4tHJZ Ev45WWan29czZOwNQRhoRWe5sykqEYI0I+f9WdtwTXejjY6GewBrCwHIAohn0BnoHD5O xRBIFqKglaUruJ0EoQd8+VvAQYBfCaeZejhX4UKYwKfsK8sW2vHImHDgvLjcEUOnsvWe qnofSURbCHVm5/bA4FXBtYAZsHkeb9zTCgwyjybJKxLfa3hTFaiWKCUwqRzUDyU0pVk7 LGjQ== X-Gm-Message-State: ALKqPwcf+uMXMQLWL7qnji2v6Sx88LVcyzqKlIsXyg5yk9zgYR6IAkoM 79kHXKXQ22syOhkHZBb8bfUwhJ0iKadZv6KxGnA= X-Google-Smtp-Source: AB8JxZpCHIwC7lLQSeU3tPa6UejuTCL3rWi50Nsd4QsCElSDlQhssVixcaVALgZngA6qzjiB0iCw8Y1IDn+dLcp3VdE= X-Received: by 2002:aa7:c60a:: with SMTP id h10-v6mr25969614edq.151.1526951824003; Mon, 21 May 2018 18:17:04 -0700 (PDT) MIME-Version: 1.0 References: <22d375c7-a032-8691-98dc-0e6ee87a4b08@mattcorallo.com> In-Reply-To: From: Olaoluwa Osuntokun Date: Mon, 21 May 2018 18:16:52 -0700 Message-ID: To: =?UTF-8?Q?Johan_Tor=C3=A5s_Halseth?= Content-Type: multipart/alternative; boundary="0000000000000f1609056cc12d60" 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 Cc: Bitcoin Protocol Discussion 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, 22 May 2018 01:17:07 -0000 --0000000000000f1609056cc12d60 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > What if instead of trying to decide up front which subset of elements wil= l > be most useful to include in the filters, and the size tradeoff, we let the > full-node decide which subsets of elements it serves filters for? This is already the case. The current "track" is to add new service bits (while we're in the uncommitted phase) to introduce new fitler types. Light clients can then filter out nodes before even connecting to them. -- Laolu On Mon, May 21, 2018 at 1:35 AM Johan Tor=C3=A5s Halseth wrote: > Hi all, > > Most light wallets will want to download the minimum amount of data > required to operate, which means they would ideally download the smallest > possible filters containing the subset of elements they need. > > What if instead of trying to decide up front which subset of elements wil= l > be most useful to include in the filters, and the size tradeoff, we let t= he > full-node decide which subsets of elements it serves filters for? > > For instance, a full node would advertise that it could serve filters for > the subsets 110 (txid+script+outpoint), 100 (txid only), 011 (script+outp= oint) > etc. A light client could then choose to download the minimal filter type > covering its needs. > > The obvious benefit of this would be minimal bandwidth usage for the ligh= t > client, but there are also some less obvious ones. We wouldn=E2=80=99t ha= ve to > decide up front what each filter type should contain, only the possible > elements a filter can contain (more can be added later without breaking > existing clients). This, I think, would let the most served filter types > grow organically, with full-node implementations coming with sane default= s > for served filter types (maybe even all possible types as long as the > number of elements is small), letting their operator add/remove types at > will. > > The main disadvantage of this as I see it, is that there=E2=80=99s an exp= onential > blowup in the number of possible filter types in the number of element > types. However, this would let us start out small with only the elements = we > need, and in the worst case the node operators just choose to serve the > subsets corresponding to what now is called =E2=80=9Cregular=E2=80=9D + = =E2=80=9Cextended=E2=80=9D filters > anyway, requiring no more resources. > > This would also give us some data on what is the most widely used filter > types, which could be useful in making the decision on what should be par= t > of filters to eventually commit to in blocks. > > - Johan > On Sat, May 19, 2018 at 5:12, Olaoluwa Osuntokun via bitcoin-dev < > bitcoin-dev@lists.linuxfoundation.org> wrote: > > On Thu, May 17, 2018 at 2:44 PM Jim Posen via bitcoin-dev >> Monitoring inputs by scriptPubkey vs input-txid also has a massive >>> advantage for parallel filtering: You can usually known your pubkeys >>> well in advance, but if you have to change what you're watching block >>> N+1 for based on the txids that paid you in N you can't filter them >>> in parallel. >>> >> >> Yes, I'll grant that this is a benefit of your suggestion. >> > > Yeah parallel filtering would be pretty nice. We've implemented a serial > filtering for btcwallet [1] for the use-case of rescanning after a seed > phrase import. Parallel filtering would help here, but also we don't yet > take advantage of batch querying for the filters themselves. This would > speed up the scanning by quite a bit. > > I really like the filtering model though, it really simplifies the code, > and we can leverage identical logic for btcd (which has RPCs to fetch the > filters) as well. > > [1]: > https://github.com/Roasbeef/btcwallet/blob/master/chain/neutrino.go#L180 > > _______________________________________________ bitcoin-dev mailing list > bitcoin-dev@lists.linuxfoundation.org > https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev > > --0000000000000f1609056cc12d60 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
> What if instead of trying to decide up front whi= ch subset of elements will
> be most useful to include in the = filters, and the size tradeoff, we let the
> full-node decide = which subsets of elements it serves filters for?

T= his is already the case. The current "track" is to add new servic= e bits
(while we're in the uncommitted phase) to introduce ne= w fitler types. Light
clients can then filter out nodes before ev= en connecting to them.

-- Laolu

On Mon, May 21, 2018 at 1:35 = AM Johan Tor=C3=A5s Halseth <johant= h@gmail.com> wrote:
H= i all,

Most light wallets will= want to download the minimum amount of data required to operate, which mea= ns they would ideally download the smallest possible filters containing the= subset of elements they need.=C2=A0

What if instead of trying to decide up front which subset of e= lements will be most useful to include in the filters, and the size tradeof= f, we let the full-node decide which subsets of elements it serves filters = for?

For instance, a full node would advertise that it = could serve filters for the subsets 110 (txid+script+outpoint), 100 (txid o= nly), 011 (
script+outpoint) etc. A light client could then choose to= download the minimal filter type covering its needs.=C2=A0

<= /div>
The obvious benefit of this would be minimal bandwidth usage for = the light client, but there are also some less obvious ones. We wouldn=E2= =80=99t have to decide up front what each filter type should contain, only = the possible elements a filter can contain (more can be added later without= breaking existing clients). This, I think, would let the most served filte= r types grow organically, with full-node implementations coming with sane d= efaults for served filter types (maybe even all possible types as long as t= he number of elements is small), letting their operator add/remove types at= will.

The main disadvantage of this as I see it, = is that there=E2=80=99s an exponential blowup in the number of possible fil= ter types in the number of element types. However, this would let us start = out small with only the elements we need, and in the worst case the node op= erators just choose to serve the subsets corresponding to what now is calle= d =E2=80=9Cregular=E2=80=9D + =E2=80=9Cextended=E2=80=9D filters anyway, re= quiring no more resources.

This would also give us= some data on what is the most widely used filter types, which could be use= ful in making the decision on what should be part of filters to eventually = commit to in blocks.

- Joh= an
On Sat, May 19, 2018 at 5:12, Olaoluwa Osuntokun vi= a bitcoin-dev <bitcoin-dev@lists.linuxfoundation.org> wrote:
<= /div>
On Thu, May 17, 2018 at 2:44 PM Ji= m Posen via bitcoin-dev <bitcoin-
<= div dir=3D"ltr">
Monitoring inputs by scriptPubkey vs input-txid a= lso has a massive
advantage for parallel filtering: You can usually known your pubkeys
well in advance, but if you have to change what you're watching block N+1 for based on the txids that paid you in N you can't filter them in parallel.

Yes, I'l= l grant that this is a benefit of your suggestion.
<= /blockquote>

Yeah parallel filtering would be pretty nic= e. We've implemented a serial filtering for btcwallet [1] for the use-c= ase of rescanning after a seed phrase import. Parallel filtering would help= here, but also we don't yet take advantage of batch querying for the f= ilters themselves. This would speed up the scanning by quite a bit.
<= div>
I really like the filtering model though, it really simp= lifies the code, and we can leverage identical logic for btcd (which has RP= Cs to fetch the filters) as well.


=
_______________________________________________ bitcoin-dev mailing list = bitcoin-dev@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/bitcoi= n-dev
--0000000000000f1609056cc12d60--