Derive channel keys from the channel funding pubkey#1093
Derive channel keys from the channel funding pubkey#1093
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1093 +/- ##
==========================================
+ Coverage 82.67% 82.85% +0.18%
==========================================
Files 101 102 +1
Lines 7653 7707 +54
Branches 312 316 +4
==========================================
+ Hits 6327 6386 +59
+ Misses 1326 1321 -5
|
f4e0295 to
40251c6
Compare
To be clear, you assume that the user performing disaster-recovery
right? |
|
Not necessarily, just knowing your seed helps a lot: If commitment transactions have already been published, all you need to to is scan the blockchain for txs that spend a 2-of-2 p2wsh multisig, extract pubkeys, and check if you can spend its to-remote output. This may be enough in many cases, as your peers will eventually close channels that are never used anymore and where they have funds locked in, even if they don't support DLP. Also, if you've funded channels it's very easy to re-compute their channel ids, just look at transactions coming out of your bitcoin wallet. If channels are public you can then find which node you were connected to And in most cases users open channels to very few nodes and should be able to guess which ones |
40251c6 to
4929feb
Compare
This PR changes how we compute channel keys:
User funds can now be recovered from their seed, without using backups (we could say that "we use the bitcoin blockchain to backup channels").
If a user loses their channel backup but still has their BIP32 seed, they can use DLP to request peers they have active channels with to publish their current commitment transaction, extract their funding pubkey from its witness, re-compute their
to-remotekey and spend their output.Compatibility with older versions of eclair is achieved by adding a
versionfield toLocalParamsusing the same pattern as for channel versions (since legacyLocalParamsalso starts with a public key). It has been tested with the following scenarios:LocalParam.versionfield set to 0, and new channels will have theirLocalParam.versionfield set to 1.For users, it means that this feature will only be available for new channels, they still need their backup data to recover legacy channels (note: for recovering channels with peers that support DLP, any backup will do and not just the last one)