Skip to content

Conversation

@OttoAllmendinger
Copy link
Contributor

This PR enhances the WASM UTXO module with several improvements to address
handling and network validation:

  1. Add optional addressFormat parameter to the address function, allowing
    control over output format (e.g., cashaddr for BCH/ECASH)

  2. Add network parameter to output script validation to ensure scripts are
    only created for networks that support specific features:

    • Add OutputScriptSupport struct for compatibility verification
    • Implement per-network script validation logic
    • Document supported features across different networks
  3. Rename Network class to UtxolibNetwork for better semantics and to
    avoid confusion with other network objects while maintaining functionality

BTC-2652

…tion

Add support for specifying the address format when generating addresses
in the fixedScriptWallet module. This allows controlling the output
format (e.g., cashaddr for BCH/ECASH) when needed.

Added JSDoc documentation explaining the addressFormat parameter usage
and the available format options for Bitcoin Cash and eCash networks.

Issue: BTC-2652

Co-authored-by: llm-git <[email protected]>
@OttoAllmendinger OttoAllmendinger force-pushed the BTC-2652.harden-output-script-creation branch 2 times, most recently from ba18483 to 05436e9 Compare October 29, 2025 10:13
OttoAllmendinger and others added 2 commits October 29, 2025 11:20
Add proper validation for supported script types based on network
capabilities. This adds checks for SegWit and Taproot support in the
output script generation methods, ensuring scripts are only created
for networks that support them.

- Add OutputScriptSupport struct to verify script compatibility
- Add network parameter to outputScript function
- Implement per-network script validation logic
- Document supported features across different networks

Issue: BTC-2652

Co-authored-by: llm-git <[email protected]>
Rename Network class to UtxolibNetwork to better represent its purpose
as a compatibility layer with utxo-lib. This helps avoid confusion with
other network objects while maintaining functionality.

Issue: BTC-2652

Co-authored-by: llm-git <[email protected]>
@OttoAllmendinger OttoAllmendinger force-pushed the BTC-2652.harden-output-script-creation branch from 05436e9 to 20951a5 Compare October 29, 2025 10:20
@OttoAllmendinger OttoAllmendinger marked this pull request as ready for review October 29, 2025 10:36
@OttoAllmendinger OttoAllmendinger requested a review from a team as a code owner October 29, 2025 10:36
Comment on lines +4 to +7
/**
* Most coins only have one unambiguous address format (base58check and bech32/bech32m)
* For Bitcoin Cash and eCash, we can select between base58check and cashaddr.
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be a good idea for us to migrate to only cashaddr for descriptor wallets

@OttoAllmendinger OttoAllmendinger merged commit bbc3098 into master Oct 29, 2025
1 check passed
@OttoAllmendinger OttoAllmendinger deleted the BTC-2652.harden-output-script-creation branch October 29, 2025 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants