hsmtool: implement new derivetoremote method#7344
Merged
rustyrussell merged 1 commit intoElementsProject:masterfrom Jul 8, 2025
Merged
hsmtool: implement new derivetoremote method#7344rustyrussell merged 1 commit intoElementsProject:masterfrom
derivetoremote method#7344rustyrussell merged 1 commit intoElementsProject:masterfrom
Conversation
Collaborator
Author
|
@ShahanaFarooqui: Since you're touching hsmtool, would you take a look at this PR? I just recently had another use for this function, as I needed to CPFP a peer's unilateral closure, and thus I needed to derive the private key for my P2WPKH output of the peer's commitment transaction so I could sign a child transaction with it. Of course I can continue to apply this patch to my hsmtool locally, but if I keep finding uses for this function, then I would expect others would find it useful as well. Thanks. |
Collaborator
|
@whitslack I would have helped in reviewing it, but it is a bit beyond my expertise! 😊 |
This method has a similar purpose as "guesstoremote" but is for use when the channel's database ID is known. It produces the private key that can spend the to_remote output of the peer's commitment transaction. It assumes the channel was negotiated with option_static_remotekey unless the optional per-commitment point argument is provided. Changelog-Added: hsmtool has a new `derivetoremote` method.
1a2d773 to
0b23a45
Compare
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.
This method has a similar purpose as
guesstoremotebut is for use when the channel's database ID is known. It produces the private key that can spend theto_remoteoutput of the peer's commitment transaction. It assumes the channel was negotiated withoption_static_remotekeyunless the optional per-commitment point argument is provided.Changelog-Added: hsmtool has a new
derivetoremotemethod.Motivation: I implemented this method so that I could import my funds from remote unilateral closures into other wallets. While
guesstoremotecould mostly get the job done, it's needlessly slow when we already know the database ID of the channel, and it doesn't work at all for channels that were negotiated withoutoption_static_remotekey.