Table of Contents

Class KeyDerivationService

Namespace
NLightning.Bolts.BOLT3.Services
Assembly
NLightning.Bolts.dll
public class KeyDerivationService
Inheritance
KeyDerivationService
Inherited Members

Methods

DerivePrivateKey(Key, PubKey)

Derives a private key using the formula: basepoint_secret + SHA256(per_commitment_point || basepoint)

public Key DerivePrivateKey(Key basepointSecret, PubKey perCommitmentPoint)

Parameters

basepointSecret Key
perCommitmentPoint PubKey

Returns

Key

DerivePublicKey(PubKey, PubKey)

Derives a public key using the formula: basepoint + SHA256(per_commitment_point || basepoint) * G

public PubKey DerivePublicKey(PubKey basepoint, PubKey perCommitmentPoint)

Parameters

basepoint PubKey
perCommitmentPoint PubKey

Returns

PubKey

DeriveRevocationPrivKey(Key, Key)

Derives the revocation private key when both secrets are known

public Key DeriveRevocationPrivKey(Key revocationBasepointSecret, Key perCommitmentSecret)

Parameters

revocationBasepointSecret Key
perCommitmentSecret Key

Returns

Key

DeriveRevocationPubKey(PubKey, PubKey)

Derives the revocation public key

public PubKey DeriveRevocationPubKey(PubKey revocationBasepoint, PubKey perCommitmentPoint)

Parameters

revocationBasepoint PubKey
perCommitmentPoint PubKey

Returns

PubKey

GeneratePerCommitmentSecret(byte[], ulong)

Generates per-commitment secret from seed and index

public static byte[] GeneratePerCommitmentSecret(byte[] seed, ulong index)

Parameters

seed byte[]
index ulong

Returns

byte[]