I would like to have a p2wpkh
blockfilterindex
type to outsource Wasabi’s filter generation to Bitcoin Core, as our filter generation is orders of magnitude slower and we would like to bring this to the client side too, so our users with full nodes would be able to validate that our server does not cheat.
I previously created a blockfilterindex
extensibility proposal to enable filter type combinations: #18221. So the followup PR of this issue will make sure it adheres to it. Since the PR is ready already, I’ll omit to go into the implementation details in this issue, rather concentrate on the goal, the benefits of end users and how we ruled out the alternative solutions.
The Goal
We would like to enable our users to upgrade Wasabi to be a full node with one click.
This feature is already implemented and rolled out to production (shipping with Core, fee estimation, tx broadcasting, mempool serving etc..) except the (most important) validation part of it is yet to be added.
Alternative Solutions
I’ve been long struggling with how to enable this for our users and we ended up working together with a brilliant dev, @dangershony, who maintained the C# Bitcoin full node for years. Unfortunately we had to rule out all the possible alternatives.
One alternative would be using importmulti
, but we would not like to rely on the wallet feature of Bitcoin Core, rather stick to the node functionality.
Another alternative could be to slowly replace our filters with Bitcoin Core’s filters on the client side, but that would require reindexing all of our wallets, which in some cases could take half a day. Also mixing filter types feels dirty and can result in unexpected issues.
We also considered bringing our own filter generation algorithm to the client side, but this is one of the oldest brain class of our codebase that serves a critical functionality so touching this could be problematic. It currently takes 2-3 days for us to create our filters on a powerful server, even though we are using p2wpkh
filters and only building them from segwit activation. Bitcoin Core creates these filters within 2 hours. Why we are so slow is out of the scope of this issue, but here’s the clue: input scripts aren’t part of a transaction.
Further we considered just blindly going through all the blocks and process all the transactions and make sure the server doesn’t lie. The performance here is also unacceptable.
Finally we would also don’t like to use bloom filters, as it is on the edge of obsolation and having multiple filters to achieve the same purpose feels dirty from a complexity point of view.
Benefits to the End User
@gmaxwell has suggested to articulate the benefits to the end user for changes to the codebase, thus this section.
Adding new filter types and filter type combinations (https://github.com/bitcoin/bitcoin/issues/18221) would enable a privacy oriented light wallet surge to be built on top of Bitcoin Core.
Maybe more importantly Bitcoin Core providing the filters to Wasabi enables a clean architecture and a seamless UX for users willing to run a full node that comes with Wasabi.
It is quite unique in a sense that no other popular light wallets went to the extent of building a full node into their software, especially not in a way that only requires a a single click configuration, so if our feature gets out of “work in progress” phase there may be an influx of full node users, which is good for the network.
What we stand to lose is that this full node feature will be delayed into the future so far that I may not be here when the next clean solution presents itself and maybe the Wasabi team won’t be willing to work on it as frankly it has little business value.
What’s Next?
This issue described our motivation and the context of the feature request, our pull request is coming up soon, so we discuss the specifics.