-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Description
Currently, embit provides only partial support for PSBT v2 as defined in BIP-370, with most input fields unimplemented and lacking test coverage.
Observations
1. No Explicit GlobalScope Class
embitcurrently does not define a dedicatedGlobalScopeclass.- Global fields are handled directly in the
PSBTclass through attributes like:self.unknownself.xpubsself.tx_versionself.locktime- and utility methods such as
parse_unknowns().
- This diverges from BIP-370, which specifies an explicit
<globals>scope, distinct from inputs and outputs.
2. Partial PSBTv2 Field Support
InputScopeandOutputScopehave limited support for PSBTv2 fields (e.g.,txid,vout,sequence,value,script_pubkey), conditionally handled whenversion == 2.- However, many new or optional v2 fields from BIP-370 are not implemented.
- The current structure is more v0-centric, with v2 fields sprinkled in, rather than fully modular as per the spec.
3. Implementation Summary
| Scope | Dedicated Class | BIP-370 v2 Fields Supported? | Notes |
|---|---|---|---|
| GlobalScope | ❌ | Partially | Managed inside the PSBT class |
| InputScope | ✅ | Partially | Some v2 fields supported; others missing |
| OutputScope | ✅ | Partially | Similar situation to InputScope |
Proposed Plan
- Refactor to introduce explicit GlobalScope support (optional but encouraged for modularity)
- Implement full parsing and serialization for all defined BIP-370 fields
- Add support for remaining v2-only fields across Input and Output scopes
- Validate against BIP-370 test vectors
- Add comprehensive unit tests to verify behavior
Happy to discuss the design direction and contribute the necessary changes! Let me know if there's already ongoing work I should align with.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels