<oembed><type>rich</type><version>1.0</version><author_name>npub1ppn2nhlfdzkw9gw0ytljpef5dpyzsxzw8ffcyykamt32hw6pge0smhs2fw</author_name><author_url>https://nostr.ae/npub1ppn2nhlfdzkw9gw0ytljpef5dpyzsxzw8ffcyykamt32hw6pge0smhs2fw</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2018-05-22&#xA;📝 Original message:Maybe I didn&#39;t make it clear, but the distinction is that the current track&#xA;allocates&#xA;one service bit for each &#34;filter type&#34;, where it has to be agreed upon up&#xA;front what&#xA;elements such a filter type contains.&#xA;&#xA;My suggestion was to advertise a bitfield for each filter type the node&#xA;serves,&#xA;where the bitfield indicates what elements are part of the filters. This&#xA;essentially&#xA;removes the notion of decided filter types and instead leaves the decision&#xA;to&#xA;full-nodes.&#xA;&#xA;This would require a &#34;getcftypes&#34; message, of course.&#xA;&#xA;- Johan&#xA;&#xA;&#xA;On Tue, May 22, 2018 at 3:16 AM, Olaoluwa Osuntokun &lt;laolu32 at gmail.com&gt;&#xA;wrote:&#xA;&#xA;&gt; &gt; What if instead of trying to decide up front which subset of elements&#xA;&gt; will&#xA;&gt; &gt; be most useful to include in the filters, and the size tradeoff, we let&#xA;&gt; the&#xA;&gt; &gt; full-node decide which subsets of elements it serves filters for?&#xA;&gt;&#xA;&gt; This is already the case. The current &#34;track&#34; is to add new service bits&#xA;&gt; (while we&#39;re in the uncommitted phase) to introduce new fitler types. Light&#xA;&gt; clients can then filter out nodes before even connecting to them.&#xA;&gt;&#xA;&gt; -- Laolu&#xA;&gt;&#xA;&gt; On Mon, May 21, 2018 at 1:35 AM Johan Torås Halseth &lt;johanth at gmail.com&gt;&#xA;&gt; wrote:&#xA;&gt;&#xA;&gt;&gt; Hi all,&#xA;&gt;&gt;&#xA;&gt;&gt; Most light wallets will want to download the minimum amount of data&#xA;&gt;&gt; required to operate, which means they would ideally download the smallest&#xA;&gt;&gt; possible filters containing the subset of elements they need.&#xA;&gt;&gt;&#xA;&gt;&gt; What if instead of trying to decide up front which subset of elements&#xA;&gt;&gt; will be most useful to include in the filters, and the size tradeoff, we&#xA;&gt;&gt; let the full-node decide which subsets of elements it serves filters for?&#xA;&gt;&gt;&#xA;&gt;&gt; For instance, a full node would advertise that it could serve filters for&#xA;&gt;&gt; the subsets 110 (txid+script+outpoint), 100 (txid only), 011 (script+outpoint)&#xA;&gt;&gt; etc. A light client could then choose to download the minimal filter type&#xA;&gt;&gt; covering its needs.&#xA;&gt;&gt;&#xA;&gt;&gt; The obvious benefit of this would be minimal bandwidth usage for the&#xA;&gt;&gt; light client, but there are also some less obvious ones. We wouldn’t have&#xA;&gt;&gt; to decide up front what each filter type should contain, only the possible&#xA;&gt;&gt; elements a filter can contain (more can be added later without breaking&#xA;&gt;&gt; existing clients). This, I think, would let the most served filter types&#xA;&gt;&gt; grow organically, with full-node implementations coming with sane defaults&#xA;&gt;&gt; for served filter types (maybe even all possible types as long as the&#xA;&gt;&gt; number of elements is small), letting their operator add/remove types at&#xA;&gt;&gt; will.&#xA;&gt;&gt;&#xA;&gt;&gt; The main disadvantage of this as I see it, is that there’s an exponential&#xA;&gt;&gt; blowup in the number of possible filter types in the number of element&#xA;&gt;&gt; types. However, this would let us start out small with only the elements we&#xA;&gt;&gt; need, and in the worst case the node operators just choose to serve the&#xA;&gt;&gt; subsets corresponding to what now is called “regular” + “extended” filters&#xA;&gt;&gt; anyway, requiring no more resources.&#xA;&gt;&gt;&#xA;&gt;&gt; This would also give us some data on what is the most widely used filter&#xA;&gt;&gt; types, which could be useful in making the decision on what should be part&#xA;&gt;&gt; of filters to eventually commit to in blocks.&#xA;&gt;&gt;&#xA;&gt;&gt; - Johan&#xA;&gt;&gt; On Sat, May 19, 2018 at 5:12, Olaoluwa Osuntokun via bitcoin-dev &lt;&#xA;&gt;&gt; bitcoin-dev at lists.linuxfoundation.org&gt; wrote:&#xA;&gt;&gt;&#xA;&gt;&gt; On Thu, May 17, 2018 at 2:44 PM Jim Posen via bitcoin-dev &lt;bitcoin-&#xA;&gt;&gt;&#xA;&gt;&gt;&gt; Monitoring inputs by scriptPubkey vs input-txid also has a massive&#xA;&gt;&gt;&gt;&gt; advantage for parallel filtering: You can usually known your pubkeys&#xA;&gt;&gt;&gt;&gt; well in advance, but if you have to change what you&#39;re watching block&#xA;&gt;&gt;&gt;&gt; N+1 for based on the txids that paid you in N you can&#39;t filter them&#xA;&gt;&gt;&gt;&gt; in parallel.&#xA;&gt;&gt;&gt;&gt;&#xA;&gt;&gt;&gt;&#xA;&gt;&gt;&gt; Yes, I&#39;ll grant that this is a benefit of your suggestion.&#xA;&gt;&gt;&gt;&#xA;&gt;&gt;&#xA;&gt;&gt; Yeah parallel filtering would be pretty nice. We&#39;ve implemented a serial&#xA;&gt;&gt; filtering for btcwallet [1] for the use-case of rescanning after a seed&#xA;&gt;&gt; phrase import. Parallel filtering would help here, but also we don&#39;t yet&#xA;&gt;&gt; take advantage of batch querying for the filters themselves. This would&#xA;&gt;&gt; speed up the scanning by quite a bit.&#xA;&gt;&gt;&#xA;&gt;&gt; I really like the filtering model though, it really simplifies the code,&#xA;&gt;&gt; and we can leverage identical logic for btcd (which has RPCs to fetch the&#xA;&gt;&gt; filters) as well.&#xA;&gt;&gt;&#xA;&gt;&gt; [1]: https://github.com/Roasbeef/btcwallet/blob/master/chain/&#xA;&gt;&gt; neutrino.go#L180&#xA;&gt;&gt;&#xA;&gt;&gt; _______________________________________________ bitcoin-dev mailing list&#xA;&gt;&gt; bitcoin-dev at lists.linuxfoundation.org https://lists.linuxfoundation.&#xA;&gt;&gt; org/mailman/listinfo/bitcoin-dev&#xA;&gt;&gt;&#xA;&gt;&gt;&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20180522/cdeb1da6/attachment.html&gt;</html></oembed>