bitcoindevkit / bitcoindevkit/bdk_wallet
feat: add BIP-431 (TRUC) support
- Dominant language
- Rust
- Stars
- 59
- Forks
- 105
- Avg merge
- 10d 9h
- Merged PRs (30d)
- 1
Description
**Describe the enhancement**
As reported in #419 we don't have proper support for BIP-431 (TRUC) transactions, which have different specification/policy for what outputs/nVersion can be used/mixed together, see [BIP-431](https://github.com/bitcoin/bips/blob/master/bip-0431.mediawiki#user-content-Specification).
As described in-depth on [BIP-431](https://github.com/bitcoin/bips/blob/master/bip-0431.mediawiki#user-content-Specification), and mentioned [here](https://github.com/bitcoindevkit/bdk_wallet/pull/442#pullrequestreview-4197234781) we need to support the following specification:
- [ ] Rule 1: A TRUC transaction signals replaceability, even if it does not signal BIP125 replaceability.
- [ ] Rule 2: Any TRUC transaction's unconfirmed ancestors must all be TRUC. Any descendant of an unconfirmed TRUC transaction must also be TRUC. #442
> _NOTE: A TRUC transaction can spend outputs from confirmed non-TRUC transactions. A non-TRUC transaction can spend outputs from confirmed TRUC transactions._
- [ ] Rule 3: An unconfirmed TRUC transaction cannot have more than 1 unconfirmed ancestor. An unconfirmed TRUC transaction cannot have more than 1 unconfirmed descendant. CPFP Carve Out is not granted to TRUC transactions.
- [ ] Rule 4: A TRUC transaction cannot have a sigop-adjusted virtual size larger than 10,000 vB. #484
- [ ] Rule 5: A TRUC transaction that has an unconfirmed TRUC ancestor cannot have a sigop-adjusted virtual size larger than 1000 vB. #485
- [x] ~~Rule 6: An individual TRUC transaction is permitted to be below the mempool min relay feerate, assuming it is considered within a package that meets the mempool's feerate requirements.~~ **it's not applicable, lmk if i'm mistaken**.
**Use case**
It allows users to properly build TRUC transactions, without the need for any workaround as mentioned here: https://github.com/bitcoindevkit/bdk_wallet/issues/419#issuecomment-4158215640 (specially L2s, such as: Lightning, Ark, ...)
**Impact**
- [x] Blocking production usage
- [ ] Nice-to-have / UX improvement
- [x] Developer experience / maintainability
**Are you using BDK in a production project?**
- [x] Yes
- [ ] No
- [ ] Not yet, but planning to
**Which backend(s) are relevant (if any)?**
- [ ] Electrum
- [ ] Esplora
- [ ] Bitcoin Core RPC
- [x] None / not backend-related (e.g. `bdk_chain`, `bdk_core`)
- [ ] Other (please specify): `____`
**Additional context**
Contributor guide
Assessment
This issue has not been assessed yet.