Comments (3)
First of all, congrats for having opened issue #100! 🎉
Now on a more serious note.. I only gave a quick read to your PR, so take this more as a few general tips, but not as a proper review:
-
I agree with what you said about the
PsbtWallet
trait not being "flexible" enough. On the other end, I think it's pretty much impossible to imagine every possible use-case a real wallet might have, especially in a library like rust-bitcoin which tries to be even more low level than BDK. My suggestion there would be to define a type in the trait called something like "Options", so that whenever the trait is implemented it is possible to define what options the wallet needs, and then takeSelf::Options
increate_transaction
. For instance, if BDK were to use it in the future, it would do so by setting that "Options" toTxBuilder<Cs: CoinSelectionAlgorithm>
. Other, simpler, wallets could just set it to aVec<(Script, u64)>
for instance. -
Yeah I think it's pretty much mandatory to support signing both single inputs and full transactions: while I would prefer to always be able to sign single inputs (to allow, for instance, the mixing of input types in a single transaction) some existing software doesn't allow you to do so. One place where I encountered this was while working on neerg, since Green's backend takes the entire transaction and tries to sign every input. Moreover, not only it needs to sign the whole transaction at once, but it also checks for the presence of the other signatures, and it refuses to sign if they are not there. This lead me to add a
SignerOrder
type that is used to define in which order the signers should be polled in case there are more than one of them. -
The way I see it, I don't think "signers developers" (like HW manufacturers) should really care about PSBT software: I would rather see them adopt a single piece of software like HWI which exposes a generalized interface for every HW. Then, on top of it we can build PSBT software that interfaces with HWI. I believe what we have here in BDK covers pretty much all of the "quirks" any signer could have, but it requires having some kind of "state" that keeps track of which signer has already signed, which kinda sucks. I guess the options for rust-bitcoin are either defining one trait for the "signer", and then a "container" struct which is also a "signer" and internally polls the individual signers in the right order (let's call this "the BDK way"), or just defining the trait for a single signer and let the caller handle everything else (which is probably also reasonable for a library that is not trying to be a wallet by itself like rust-bitcoin IMHO).
By the way, my personal opinion is that this whole "PSBT workflow" is not really necessary in rust-bitcoin. I guess at some point you have to draw the line and say "this is too high level for this library". IMHO rust-bitcoin should just be "low level stuff" for bitcoin. Even signing is not there (afaik), which totally makes sense to me. You have all the utilities that allows you to build a signer, so it's not necessary to have one right in the library. As long as you have a nice way to build, inspect and extract psbts it's probably fine. But that's just my two cents, and I haven't really followed the discussion, so I might also have missed something. In that case, I'll happily change my mind!
from bdk.
I see. Tbh, I was kinda surprised by bdk
suddenly exisiting ^^ so adding these traits would have been part of a longer term effort to get wallet building blocks in there. But you are probably right, these are best kept in another crate given the real world complexities.
from bdk.
This has been open for a while and we've seen that most of the discussion in the rust-bitcoin repo went nowhere, so we are closing this for now...
from bdk.
Related Issues (20)
- Introduce `bdk_persist` crate HOT 2
- need custom lookahead HOT 2
- Release 1.0.0-alpha.10 HOT 1
- Unable to `calculate_fee` when syncing with electrum HOT 1
- Upgrade rust-bitcoin to 0.32 HOT 8
- Add support for testnet4
- Create nightly job to bump clippy rust version
- Use `bitcoin::Amount` everywhere HOT 3
- ci: cronjob to bump the pin on clippy HOT 2
- example: Fix wallet examples HOT 3
- Release 1.0.0-alpha.11 HOT 2
- Help spending a tr aggregated key using musig2 HOT 5
- txout_index, `Descriptor` not needed in `keychains_to_descriptors`
- InsufficientFunds is duplicated within coin_selection::Error and CreateTxError enums HOT 1
- More tests for `bdk_electrum` fee calculation HOT 1
- Create a `bdk_floresta` chain source crate HOT 3
- `Wallet::insert_tx` should not have `position` input HOT 2
- Human Readable Names Support
- Release 1.0.0-alpha.12 HOT 1
- Add user-facing events for applying updates after syncing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bdk.