It’s time for my next semi-annual “monthly update”. As a bonus for waiting a few extra days, I also have an update from @losh11 about the progress he and Hector have made with their LTC development.
Loshan’s Update
Over the past few months, significant effort has gone into bringing MWEB support to light clients. This required an update to Litecoin Core, adding new p2p messages, which light clients can fetch from full nodes and verify. This process has been described in LIP006 and has now been implemented and merged into Litecoin Core.
We plan to promptly release a new minor build of Litecoin Core v0.21.3, which includes these changes, alongside serving BIP157/BIP158 filters by default and various other bug fixes. Originally we had planned to release MWEB light client server in the next major release of Litecoin Core v24; however, we felt it necessary to expedite this new feature. A release candidate of Litecoin Core v0.21.3 will be available very shortly. Full node operators who would like to support MWEB light clients should upgrade as soon as possible.
For our client side implementation, we chose to work on top of the LTCSuite libraries. To summarise, a light client node makes a request to fetch MWEBUTXOs, HogExAndMWEBHeaders and MWEBLeafset from v0.21.3 peers (at various stages). The light client will validate this data. Then the client will identify outputs belonging to the wallet, and store it. The last step is to construct transactions to spend funds, this includes support for pegins/pegouts/mweb txs.
Developer Hector Chu has submitted pull requests to the following libraries:
ltcd: MWEB Light Client by hectorchu · Pull Request #35 · ltcsuite/ltcd · GitHub
ltcwallet: MWEB Light Client by hectorchu · Pull Request #10 · ltcsuite/ltcwallet · GitHub
neutrino: MWEB Light Client by hectorchu · Pull Request #10 · ltcsuite/neutrino · GitHub
lnd: MWEB Light Client by hectorchu · Pull Request #8 · ltcsuite/lnd · GitHub
Further code review and testing is currently in progress, before MWEB support is merged in. If you are interested in code review, and knowledgeable, please feel free to contact us.
We have also updated ltcsuite libraries to stay in sync with our upstream, btcsuite. This brings along many improvements, such as: taproot support, cpu optimisations for mempool scanning, rescanning uses batch fetching BIP158 filters for non-MWEB litecoin blocks. As of the moment, lndltc is synced with lnd v0.17.3, neutrino is synced with upstream’s v0.16. There are still some minor fixes required (to fix tests) before the MWEB pull requests can be merged and release versions tagged.
Additionally, Hector has also replaced the legacy litecoin backend for the Litecoin Foundation’s Litewallet mobile wallet, with ltcsuite. This means Litewallet (newborn - the internal alpha) can now make MWEB txs. A future release of Litewallet with MWEB is planned for the near future.
v24 Release (My Update)
The MWEB wallet code underwent significant refactoring in order to add MWEB support to PSBTs and Descriptors.
PSBTs
Partially Signed Bitcoin Transactions (PSBTs) are a standardized format for passing around in-process transactions. These are useful for hardware wallets to help separate signing from transaction building, and also useful for multisig wallets where PSBTs are passed between the signers, with each adding their signature and passing to the next.
We were able to extend the PSBT standard to include MWEB transaction components, which led to a large refactoring of much of the wallet code to support transactions in various states of completion, whereas before, they were always able to just assume MWEB transactions being passed around in the code were complete and fully signed.
Transaction building all seems to be working correctly now for v24, and is much cleaner, better tested, and more stable than before. I’ll be reaching out to hardware wallet manufacturers to make sure the PSBT design we went with works for them, but aside from that, this task can be considered complete.
Descriptors
In a nutshell, Output Descriptors are just a convenient way of representing individual or collections of output scripts and addresses. They’re used by the wallet to track and manage addresses and keys owned or watched by the wallet.
You can read all about them here, or refer to the official documentation.
Despite being released in Bitcoin Core v17, Litecoin Core intentionally never supported them because it was a complete change to how the wallet handled keys and everything related to them, which happens to cover quite a bit (generating addresses, signing transactions, backing up and restoring wallets, etc.). Descriptor wallets even have a different database (Sqlite, instead of BerkeleyDB) and a separate set of RPC APIs (the standardized bridges that allow other apps to interact with Litecoin Core). We wanted to make sure we got the design correct before enabling descriptor wallets, which I believe we finally have, so v24 will have full support for descriptor wallets.
Some boring technical details
We needed a way to describe the MWEB stealth addresses belonging to a wallet. This ultimately meant a way of describing the master_scan_key
(a
) and the master_spend_pubkey
(B
), which are the 2 keys that can be used to generate an ~infinite number of stealth subaddresses (see LIP-0004 - Subaddress Generation).
There were a number of ways we could’ve represented the 2 stealth address master keys, but after some trial and error, we finally settled on mweb([master_seed_key]/[bip32_path]/x)
, where:
- [master_seed_key]` is the wallet’s seed xprv or xpub key
[bip32_path]
is the BIP32 path to the parent key of the master_scan_key
(a
) and the master_spend_pubkey
(B
) (See: BIP-0032 - Child Key Derivation)
x
just means the master_scan_key
(a
) is the hardened child key with index 0, and the master_spend_pubkey
(B
) is the hardened child key with index 1
As an example, a wallet with the descriptor mweb(xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/0'/100'/x)
describes all MWEB stealth subaddresses that can be derived from the master_scan_key
(a
) at xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/0'/100'/0'
and the master_spend_pubkey
(B
) at xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/0'/100'/1'
.
What’s Left?
The 2 main tasks remaining before building a release candidate that the community can start testing is view key support, which I’m wrapping up the implementation for, and we need a fix for syncing stability issues we’re experiencing as a result of a new presync process bitcoin added to eliminate their existing checkpointing system.
Updated Task List:
Integrate pre-MWEB litecoin into bitcoin’s v24 codebase (All commits prefixed with “Litecoin:”)
Fix syncing stability issues caused by new presync process (Not Started)
Merge in the previously-released MWEB code (Several commits, starting with this one)
P2P Support for Light Clients (Finished, to be released early in v21.0.3. Review)
Enable descriptor wallets w/ MWEB address support (Finished, see descriptor.cpp in this commit)
MWEB Support for PSBTs (Finished)
View key support (Finalizing implementation, tests still needed)
Payment Proofs (Design outlined in LIP-0004, excluding from release due to lack of demand)
Community Beta Testing (Not started)
Release Notes (Not started)
Guix Build & Publish (Not started)