<oembed><type>rich</type><version>1.0</version><author_name>npub19helcfnqgk2jrwzjex2aflq6jwfc8zd9uzzkwlgwhve7lykv23mq5zkvn4</author_name><author_url>https://nostr.ae/npub19helcfnqgk2jrwzjex2aflq6jwfc8zd9uzzkwlgwhve7lykv23mq5zkvn4</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2018-05-21&#xA;📝 Original message:Hi Y&#39;all,&#xA;&#xA;The script finished a few days ago with the following results:&#xA;&#xA;reg-filter-prev-script total size:  161236078  bytes&#xA;reg-filter-prev-script avg:         16123.6078 bytes&#xA;reg-filter-prev-script median:      16584      bytes&#xA;reg-filter-prev-script max:         59480      bytes&#xA;&#xA;Compared to the original median size of the same block range, but with the&#xA;current filter (has both txid, prev outpoint, output scripts), we see a&#xA;roughly 34% reduction in filter size (current median is 22258 bytes).&#xA;Compared to the suggested modified filter (no txid, prev outpoint, output&#xA;scripts), we see a 15% reduction in size (median of that was 19198 bytes).&#xA;This shows that script re-use is still pretty prevalent in the chain as of&#xA;recent.&#xA;&#xA;One thing that occurred to me, is that on the application level, switching&#xA;to the input prev output script can make things a bit awkward. Observe that&#xA;when looking for matches in the filter, upon a match, one would need access&#xA;to an additional (outpoint -&gt; script) map in order to locate _which_&#xA;particular transaction matched w/o access to an up-to-date UTOX set. In&#xA;contrast, as is atm, one can locate the matching transaction with no&#xA;additional information (as we&#39;re matching on the outpoint).&#xA;&#xA;At this point, if we feel filter sizes need to drop further, then we may&#xA;need to consider raising the false positive rate.&#xA;&#xA;Does anyone have any estimates or direct measures w.r.t how much bandwidth&#xA;current BIP 37 light clients consume? It would be nice to have a direct&#xA;comparison. We&#39;d need to consider the size of their base bloom filter, the&#xA;accumulated bandwidth as a result of repeated filterload commands (to adjust&#xA;the fp rate), and also the overhead of receiving the merkle branch and&#xA;transactions in distinct messages (both due to matches and false positives).&#xA;&#xA;Finally, I&#39;d be open to removing the current &#34;extended&#34; filter from the BIP&#xA;as is all together for now. If a compelling use case for being able to&#xA;filter the sigScript/witness arises, then we can examine re-adding it with a&#xA;distinct service bit. After all it would be harder to phase out the filter&#xA;once wider deployment was already reached. Similarly, if the 16% savings&#xA;achieved by removing the txid is attractive, then we can create an&#xA;additional&#xA;filter just for the txids to allow those applications which need the&#xA;information to seek out that extra filter.&#xA;&#xA;-- Laolu&#xA;&#xA;&#xA;On Fri, May 18, 2018 at 8:06 PM Pieter Wuille &lt;pieter.wuille at gmail.com&gt;&#xA;wrote:&#xA;&#xA;&gt; On Fri, May 18, 2018, 19:57 Olaoluwa Osuntokun via bitcoin-dev &lt;&#xA;&gt; bitcoin-dev at lists.linuxfoundation.org&gt; wrote:&#xA;&gt;&#xA;&gt;&gt; Greg wrote:&#xA;&gt;&gt; &gt; What about also making input prevouts filter based on the scriptpubkey&#xA;&gt;&gt; being&#xA;&gt;&gt; &gt; _spent_?  Layering wise in the processing it&#39;s a bit ugly, but if you&#xA;&gt;&gt; &gt; validated the block you have the data needed.&#xA;&gt;&gt;&#xA;&gt;&gt; AFAICT, this would mean that in order for a new node to catch up the&#xA;&gt;&gt; filter&#xA;&gt;&gt; index (index all historical blocks), they&#39;d either need to: build up a&#xA;&gt;&gt; utxo-set in memory during indexing, or would require a txindex in order to&#xA;&gt;&gt; look up the prev out&#39;s script. The first option increases the memory load&#xA;&gt;&gt; during indexing, and the second requires nodes to have a transaction index&#xA;&gt;&gt; (and would also add considerable I/O load). When proceeding from tip, this&#xA;&gt;&gt; doesn&#39;t add any additional load assuming that your synchronously index the&#xA;&gt;&gt; block as you validate it, otherwise the utxo set will already have been&#xA;&gt;&gt; updated (the spent scripts removed).&#xA;&gt;&gt;&#xA;&gt;&#xA;&gt; I was wondering about that too, but it turns out that isn&#39;t necessary. At&#xA;&gt; least in Bitcoin Core, all the data needed for such a filter is in the&#xA;&gt; block + undo files (the latter contain the scriptPubKeys of the outputs&#xA;&gt; being spent).&#xA;&gt;&#xA;&gt; I have a script running to compare the filter sizes assuming the regular&#xA;&gt;&gt; filter switches to include the prev out&#39;s script rather than the prev&#xA;&gt;&gt; outpoint itself. The script hasn&#39;t yet finished (due to the increased I/O&#xA;&gt;&gt; load to look up the scripts when indexing), but I&#39;ll report back once it&#39;s&#xA;&gt;&gt; finished.&#xA;&gt;&gt;&#xA;&gt;&#xA;&gt; That&#39;s very helpful, thank you.&#xA;&gt;&#xA;&gt; Cheers,&#xA;&gt;&#xA;&gt; --&#xA;&gt; Pieter&#xA;&gt;&#xA;&gt;&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20180521/feb53119/attachment.html&gt;</html></oembed>