<div dir="ltr">Hi all,<br><br>I recently released bwt [0], an HD wallet indexer implemented in Rust, using<br>a model similar to that of Electrum Personal Server.<br><br>It uses the bitcoind wallet functionality to do the heavy lifting and builds<br>additional indexes on top of that, which can be queried using the Electrum<br>RPC protocol, as well as a more modern, developer-friendly HTTP REST API.<br><br>The electrum server can also be used as an electrum plugin [1], which<br>integrates the server straight into the electrum client. From the user's<br>perspective, this allows connecting electrum directly to a full node.<br><br>The HTTP API is my take on a modern design for a wallet tracking API aimed<br>at app developers. Some use-cases include using it as a backend for wallets<br>(similarly to Samuari's Dojo) or to track deposits to a watch-only xpub<br>(similarly to BTCPay's NBXplorer).<br><br>Compared to using the bitcoind RPC directly, bwt provides:<br><br>- The ability to track an xpub and automatically have new addresses derived<br>  and imported as needed, according to the gap limit.<br><br>- Two additional indexes, one for looking up the transaction history of<br>  addresses, and another one for looking up txo spends (a map of<br>  funding_txid:vout => spending_txid:vin).<br><br>- Real-time updates using Server-Sent Events [2] (a long-lived streaming HTTP<br>  connection) or Web Hooks [3] (an HTTP request sent to a configured URL).<br>  The updates being sent [4] directly provide information about the funded<br>  and spent wallet txos, instead of the client figuring it out from the tx.<br><br>- Some API conveniences and simplifications, like including key origin<br>  information directly alongside inputs/outputs [5], the ability to specify<br>  key origins in place of addresses (eg. GET /hd/15cb9edc/8/utxos), a compact<br>  history format [6], and an easy way to catch-up with missed events [7].<br>  Unless explicitly asked for, the API omits information about non-wallet<br>  inputs/outputs and protocol-level details like scriptsig and witnesses,<br>  which are typically not needed for higher-level app development.<br><br>The indexer is designed in a way that minimizes RPC requests to bitcoind. By<br>using labels to store key origin information, it is able to index incoming<br>transactions using the information available from `listtransactions` alone<br>(plus 3 extra rpc requests that don't grow with the number of transactions),<br>but requires 1 additional rpc call per outgoing transaction (to learn which<br>prevouts were spent). It can index 10k incoming txs in under a second, or a<br>mixture of 5k/5k in under 5 seconds. The index is currently entirely in-<br>memory and does not get persisted. The indexer logic can be seen in [8].<br><br>One major item on the roadmap that I'm hoping to tackle soon is support for<br>output script descriptors.<br><br>If anyone is interested in contributing, the README has some useful developer<br>resources [9] and a handy script for setting up a development environment.<br><br>This is an early alpha release, recommended for use with testnet/regtest.<br><br>All feedback welcome!<br><br>Cheers,<br>Nadav<br><br>[0] <a href="https://github.com/shesek/bwt">https://github.com/shesek/bwt</a><br>[1] <a href="https://github.com/shesek/bwt#electrum-plugin">https://github.com/shesek/bwt#electrum-plugin</a><br>[2] <a href="https://github.com/shesek/bwt#server-sent-events">https://github.com/shesek/bwt#server-sent-events</a><br>[3] <a href="https://github.com/shesek/bwt#web-hooks">https://github.com/shesek/bwt#web-hooks</a><br>[4] <a href="https://github.com/shesek/bwt#event-categories">https://github.com/shesek/bwt#event-categories</a><br>[5] <a href="https://github.com/shesek/bwt#wallet-transaction-format">https://github.com/shesek/bwt#wallet-transaction-format</a><br>[6] <a href="https://github.com/shesek/bwt#get-txssinceblock-heightcompact">https://github.com/shesek/bwt#get-txssinceblock-heightcompact</a><br>[7] <a href="https://github.com/shesek/bwt#catching-up-with-missed-events--re-org-detection">https://github.com/shesek/bwt#catching-up-with-missed-events--re-org-detection</a><br>[8] <a href="https://github.com/shesek/bwt/blob/master/src/indexer.rs">https://github.com/shesek/bwt/blob/master/src/indexer.rs</a> (sync_transactions and load_transactions_since)<br>[9] <a href="https://github.com/shesek/bwt#developing">https://github.com/shesek/bwt#developing</a></div>