Skip to content

Key Management #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
TheBlueMatt opened this issue Jul 23, 2018 · 12 comments
Closed

Key Management #81

TheBlueMatt opened this issue Jul 23, 2018 · 12 comments
Milestone

Comments

@TheBlueMatt
Copy link
Collaborator

...is almost entirely unhandled.

Generally, we need the final claim keys (ie channel_monitor_claim_key and channel_close_key) to be provided by the user (probably derived in some reliable way) and the rest are really our internal keys but should be generated from a secret the client gives us.

@ariard
Copy link

ariard commented Oct 15, 2018

Hey, started to dig into it with a review of lnd stuff on it. So something similar like having a LightningWalletManager in charge of LN pure services and lay under it a WalletController trait (giving us UTXOs, protocol exit points, master seed). Maybe LightningWalletManager should suck up some actual keyring material like ChannelKeys and why not preimages and revocation points ?
Hopefully will show some code layout soon to ease the discussion.

@TheBlueMatt
Copy link
Collaborator Author

I don't think we need anything that fancy - I think we explicitly should not be tracking UTXOs outside of ChannelMonitors. Ideally all we'd have is a single HD master key and some well-defined way of deriving keys from it such that the client can easily scan the chain for outputs that are theirs, but I think we'll need something more flexible where we can inform the user that a given UTXO (as discovered by a ChannelMonitor) is theirs and can be spent with HD path X (eg for unrevoked HTLC-Timeout/Success outputs, we probably want to just tell the user about them and let them figure out when to spend them, though for shutdown_scriptpubkeys things can be much simpler).

@ariard
Copy link

ariard commented Oct 16, 2018

About the UTXO it isn't the ones in on-chain channel txs but the ones spent by funding_tx, lnd have some kind of ChannelReservation to avoid double-spend of input while waiting for channel opening workflow completion. But yes surely too fancy, at least for 0.1.

Okay so basically, 3 services to manage : derivation from master key, association of HD path X to spendable output from commitment tx and HTLC tx and provision upstream of channel_monitor_claim_key/shutdown_key given us by user.

For the 256-bit master seed, derivation scheme is this one for me ?
master seed --> per-connection seed --> per-chain seed --> per-channel seed --> per-commitment secret

@ariard
Copy link

ariard commented Oct 16, 2018

And maybe we want tracking of remote per-commitment secrets and so latest preimages to ease backup in only one place? But I think we can do it latter

@TheBlueMatt
Copy link
Collaborator Author

TheBlueMatt commented Oct 16, 2018 via email

@ariard
Copy link

ariard commented Oct 16, 2018

Okay, noted, will stick to the bare minimum

@TheBlueMatt
Copy link
Collaborator Author

How far did you get here? I'd like to make some quick progress on this by next weekend for LN-hackday NY.

@TheBlueMatt TheBlueMatt modified the milestones: 0.1, 0.0.6 Oct 16, 2018
@TheBlueMatt
Copy link
Collaborator Author

TheBlueMatt commented Oct 16, 2018 via email

@yuntai
Copy link
Contributor

yuntai commented Oct 24, 2018

I'm gonna try to hack together a solution for #55 in the coming day or three, but want to move forward on this quickly as well, so no rush, but if you aren't active on it I'll take it over.

On October 16, 2018 7:50:17 PM UTC, Matt Corallo @.***> wrote: How far did you get here? I'd like to make some quick progress on this by next weekend for LN-hackday NY. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: #81 (comment)

oh, have you started #55? I started poking around it today and think it can get it done by the weekend.

@TheBlueMatt
Copy link
Collaborator Author

TheBlueMatt commented Oct 24, 2018 via email

@yuntai
Copy link
Contributor

yuntai commented Oct 24, 2018

cool! I will be back onto onion stuff.

@TheBlueMatt
Copy link
Collaborator Author

Fixed in #225.

TheBlueMatt added a commit to TheBlueMatt/rust-lightning that referenced this issue Jul 28, 2019
It suggested figuring something else out after lightningdevkit#81, but the API we
settled on after lightningdevkit#81 (which I think is just fine) doesn't allow for
anything cleaner, so this is fine as-is.
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

No branches or pull requests

3 participants