-
Notifications
You must be signed in to change notification settings - Fork 78
Description
Silent payments (BIP352) is a novel approach to static payment codes in Bitcoin, which has the added advantages of eliminating address reuse and the gap limit. These benefits come with a cost however - the recipient must scan the blockchain for incoming payments, a resource intensive process which has thus far prevented widespread adoption of this technology, particularly in light clients.
The approach for light clients described in BIP352 uses compact block filters, which emphasise privacy at the cost of requiring the client to perform download, parsing and computation of the required data. This burden has proved to be too onerous for most practical use cases, particularly on mobile.
Frigate is an experimental Electrum Server which implements a different approach, following the tried and tested route of using a capable server to do the heavy lifting. When used as a public server, Frigate supports performing the computation on GPUs to both dramatically improve performance, but just as critically relieve the burden from the CPU. For data storage and querying, Frigate uses a modern analytical database called DuckDB.
Frigate (the Java project) is a relatively light wrapper around two DuckDB extensions which both perform the same function of scanning the tweak data stored in the database, one using the CPU and the other any available Nvidia GPUs depending on the server configuration. The scanning is started by calling a new Electrum RPC, which has been proposed (and tentatively accepted) for inclusion into an upcoming update of the Electrum protocol. All of this is documented at https://github.com/sparrowwallet/frigate.
Since mempool's electrs project is primarily aimed at public Electrum server instances, this feature request is to implement the same RPC using the GPU-specific DuckDB extension used by Frigate to perform the scanning. The tweak data will need to be computed for both blocks and mempool transactions, and stored in DuckDB which offers a Rust client for this purpose. There is an existing Rust crate which may be useful for calculating the tweak data. There is also a tweak service auditor which may be leveraged to check the validity of stored tweak data. Once the data has been stored, the extension is called via a loaded database function to return the results. The Frigate repo also contains benchmarking information to give an idea of performance of the extension given different GPU builds.
I believe the existence of a capable public Electrum service that can scan for silent payment transactions would be transformative for the technology, in much the same way that the Electrum protocol has transformed the Bitcoin wallets landscape and become the dominant approach to serving wallet-related transactional data.