Sunday, December 22, 2024

transactions – Calculation of various Pubkeys in Lightning in response to BOLT03

Lightning makes use of totally different Pubkeys to realize extra privateness and safety, I’m not certain how they’re calculated. In BOLT03 it says:

The corresponding personal keys may be equally derived, if the basepoint secrets and techniques are recognized (i.e. the personal keys akin to localpubkey, local_htlcpubkey, and local_delayedpubkey solely):

privkey = basepoint_secret + SHA256(per_commitment_point || basepoint)

I used to be questioning whether or not its the identical per_commitment_point we use for our native dedication revocation path, which secret later will get revealed to revoke the native dedication tx.

Which means that the “to_local” path appears to be like as the next:

OP_IF
    # Penalty transaction
    <revocationpubkey>
OP_ELSE
    `to_self_delay`
    OP_CHECKSEQUENCEVERIFY
    OP_DROP
    <local_delayedpubkey>
OP_ENDIF
OP_CHECKSIG

the place the local_delayedpubkey is calculated like this:

local_delayedpubkey = basepoint_local_delayedpubkey + SHA256(per_commitment_point || basepoint_local_delayedpubkey) * G

and the revocationpubkey is calculated as follows:

revocationpubkey_local = revocation_basepoint_remote * SHA256(revocation_basepoint_remote || per_commitment_point) + per_commitment_point * SHA256(per_commitment_point || revocation_basepoint_remote)

With each paths utilizing the identical per_commitment_point which was created domestically or to jot down it in another way:

per_commitment_point_local

which means that when I’ve to recuperate from a drive shut, I at all times have to not my newest per_commitment_point_local to comb my “to_local” funds after I broadcast my drive shut transaction

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles