transactions – Calculation of various Pubkeys in Lightning based on BOLT03

0
25


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 non-public keys could be equally derived, if the basepoint secrets and techniques are identified (i.e. the non-public keys comparable 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.

That 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 write down it otherwise:

per_commitment_point_local

which means that when I’ve to get better from a pressure shut, I all the time must not my newest per_commitment_point_local to comb my “to_local” funds after I broadcast my pressure shut transaction

LEAVE A REPLY

Please enter your comment!
Please enter your name here