BP-WG / descriptor-wallet

Library for building descriptor-based bitcoin wallets using rust-bitcoin
Apache License 2.0
58 stars 27 forks source link

Provide dedicated descriptors for change addresses with tapret #57

Closed crisdut closed 1 year ago

crisdut commented 1 year ago

Discussed in https://github.com/BP-WG/descriptor-wallet/discussions/53

Originally posted by **crisdut** October 12, 2022 According to this [comment](https://github.com/BP-WG/descriptor-wallet/blob/master/src/bin/btc-cold.rs#L172), the descriptor change is provided by the same wallet used to provide the inputs. I think the command line needs an optional parameter to allow choose your change descriptor. This important feature for TapRet commitments, because always we need a TapTree to add commitment. **TapRet commitment user case (example):** 1. We create a Taptree output descriptor with OP_CHECKSIG. ``` change_desc="tr(A,pk(B))#mjnpzw6a" ``` 2. We construct a PSBT file. ``` btc-cold construct --input --allow-tapret-path 1 --account-file --change $change_desc ``` 3. After `RGB finalize`, the Taptree is updated with the commitment script 4. If we want to spend the bitcoins of the output descriptor, we need to create a new wallet based on the script of the step 1 ``` btc-cold create $change_desc --account-file ``` 5. Use the new wallet to construct a new PSBT file. Does make sense?

I will start work on this issue.

dr-orlovsky commented 1 year ago

You are right about that existance of tapret commiments makes it harder to deal with change outputs; but I do not agree that this should be addressed by creating a dedicated descriptor. Instead, my plan was to support extended descriptor format supporting tapret fragment and a list of tweaks which should be looked for at specific indexes.

dr-orlovsky commented 1 year ago

Like I did in this early prototype concept: https://github.com/BP-WG/stingerjet-docs

See the end of the README, the taprets final section of a sample.

dr-orlovsky commented 1 year ago

Just not to duplicate messages I propose to continue discussion on the proper way of supporting tapret commitments in wallet descriptors in https://github.com/BP-WG/descriptor-wallet/discussions/53

Closing in favor of issue which tracks the status (https://github.com/BP-WG/descriptor-wallet/issues/58)

crisdut commented 1 year ago

Just not to duplicate messages I propose to continue discussion on the proper way of supporting tapret commitments in wallet descriptors in #53

Ok, I'm sorry.

I created an issue just because I started implementation of the solution.