bitcoindevkit / bdk

A modern, lightweight, descriptor-based wallet library written in Rust!
Other
838 stars 301 forks source link

Can we remove policy module and use rust-miniscript ? #1382

Open notmandatory opened 5 months ago

notmandatory commented 5 months ago

Can we use the new planning module now?

casey-bowman commented 5 months ago

It seems there is related work @tcharding is doing in rust-psbt, too. See his comment here.

I hope to learn more as I delve into the code myself this weekend. Hopefully I can contribute at least some review on the move to the planning module.

Last night I upgraded a POC on Jupyter notebook which I'd put together based on @danielabrozzoni's Multisigs & Carrots workshop repo. Now it works with BDK 1.0.0-alpha.7. The POC creates a taproot output with multiple timelocks for a channel factory. In parallel, the participants sign a PSBT with this taproot as an input. The PSBTs are combined and the result finalized. I tested it successfully on regtest using esplora this morning. I had to separate into two lines the creation of each policy from its subsequent compilation into miniscript, to make the type Miniscript<String, Tap>, explicit.

I especially value being able to work with policies in a composable fashion and earlier this week wrote up a plan to make templates for policies and their associated extended public keys. Yesterday I noticed a similar idea regarding templates for descriptors that was brought up in January as part of a draft BIP that would let PSBTs convey descriptors without transaction info. My sense is that this would be good at the level of any sub-policy, to let policies be conveyed by PSBTs.

Anyway I'll go back to lurking, but I hope eventually to contribute.

ValuedMammal commented 5 months ago

@casey-bowman You might have some good ideas for a future book of bdk tutorial about spending policies.

casey-bowman commented 5 months ago

@casey-bowman You might have some good ideas for a future book of bdk tutorial about spending policies.

Definitely. I'd like to give back somehow, and the tutorial looks like a great resource in the making. I see there's mention of a DescriptorTemplate in it. As I work in implementing and playing around with what I envision for the policy templates, I hope to share some of these ideas and make them congruent with existing descriptor templates.

notmandatory commented 5 months ago

I'm moving this out of the 1.0 milestone since the existing policy mechanism works and switching to the new planning module will take too much time to implement and test right now.

danielabrozzoni commented 5 months ago

I'm moving this out of the 1.0 milestone since the existing policy mechanism works and switching to the new planning module will take too much time to implement and test right now.

Agreed, I'm also not sure if it would make sense to implement the planning module separately from the txbuilder overhaul.