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
embit currently does not define a dedicated GlobalScope class.
- Global fields are handled directly in the
PSBT class through attributes like:
self.unknown
self.xpubs
self.tx_version
self.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
InputScope and OutputScope have limited support for PSBTv2 fields (e.g., txid, vout, sequence, value, script_pubkey), conditionally handled when version == 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
Happy to discuss the design direction and contribute the necessary changes! Let me know if there's already ongoing work I should align with.
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
GlobalScopeClassembitcurrently does not define a dedicatedGlobalScopeclass.PSBTclass through attributes like:self.unknownself.xpubsself.tx_versionself.locktimeparse_unknowns().<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.3. Implementation Summary
PSBTclassProposed Plan
Happy to discuss the design direction and contribute the necessary changes! Let me know if there's already ongoing work I should align with.