feat: Implement DLC Input Splicing for Reusing Funding Outputs#172
Merged
Conversation
- add InputSupplementationMode enum for explicit input control - add DlcInputInfo interface for splice transaction metadata - add DLC-specific input creation and validation methods - add client API method signatures for splicing operations - extend Input class with isDlcInput() and DLC input support
- add GetInputsForAmountWithMode for explicit input supplementation control - implement findDlcFundingPrivateKey to derive keys across wallet addresses - enhance GetPrivKeysForInputs to handle DLC inputs via key derivation - add spliced DLC transaction creation with mixed input type support - implement DLC-specific signing: GetRawDlcFundingInputSignature, SignDlcFundingInput - fix CreateFundingTx to sign clean transaction for proper multisig completion - add calculateMaxCollateral and createDlcFundingInput client methods - support FundingInput[] parameters in createDlcOffer and acceptDlcOffer - preserve DLC metadata in fundingInputToInput/inputToFundingInput conversions - handle two-phase DLC signing: offerer creates signature, acceptor completes
- add end-to-end test for single-funded to spliced DLC flow - test DLC funding output reuse in subsequent DLC transactions - add generateEnumCollateralContractInfo with proper outcome hashing - verify DLC input signing, transaction creation, and execution - test proper handling of mixed input types (DLC + regular inputs)
🦋 Changeset detectedLatest commit: aeb2027 The changes in this PR will be included in the next version bump. This PR includes changesets to release 17 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
- node-dlc 1.1.0 includes support for splices contracts through dlcinput
- enhanced private key search range from 20 to 1000 addresses - fixed UTXO to Input object conversion in funding methods - used SignDlcFundingInput for proper DLC input signatures - added derivation path validation and error handling - fixed input supplementation mode for unusual addresses - added dynamic pubkey ordering detection in splicing tests
bennyhodl
reviewed
Jul 29, 2025
- replace duplicated private key finding logic with dedicated findDlcFundingPrivateKey method - add contractId field to DlcInputInfo interfaces and related structures - replace placeholder contract IDs with actual contract ID from hex - update method signatures to include contractId parameter - update tests to pass contract IDs for DLC input creation Addresses review comments about code duplication, placeholder values, and missing contract ID handling
Replace inline type definition with proper DlcInputInfoRequest type and handle resulting number|bigint type coercions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements DLC input splicing functionality, enabling DLC funding outputs to be reused as inputs in subsequent DLC transactions. This is essential for advanced DLC workflows like splicing, rolling contracts, and multi-party DLC chains.
Dependencies
This PR requires AtomicFinance/node-dlc#228 to be merged first, which adds the underlying DLC Input support for spliced contracts.
Key Features
DLC Input Splicing
Explicit Input Control
None,Optional,Required)Advanced Key Management
Enhanced Transaction Creation
CreateSplicedDlcTransactionswhen DLC inputs are presentTechnical Implementation
Core Types
InputSupplementationModeenum for explicit input controlDlcInputInfointerface for DLC-specific input metadataInputclass withisDlcInput()and DLC input supportKey Methods Added
calculateMaxCollateral()- Determine maximum funding with given inputscreateDlcFundingInput()- Create DLC inputs from funding transactionsfindDlcFundingPrivateKey()- Derive keys across wallet addressesGetInputsForAmountWithMode()- Input supplementation with explicit controlCFD-DLC-JS Integration
GetRawDlcFundingInputSignature- DLC-specific input signingSignDlcFundingInput- Complete DLC multisig input signingVerifyDlcFundingInputSignature- Verify DLC input signaturesCreateSplicedDlcTransactions- Handle mixed input typesTesting
Use Cases Enabled
Breaking Changes
None - all changes are backward compatible. Existing DLC creation flows work unchanged.
Migration Guide
Existing code requires no changes. New splicing functionality is opt-in through new parameters:
Test Results
This implementation enables sophisticated DLC workflows while maintaining full backward compatibility with existing code.
Related Work