MCPcopy Create free account
hub / github.com/ElementsProject/lightning / derive_revocation_pubkey

Function derive_revocation_pubkey

tests/test_opening.py:93–103  ·  view source on GitHub ↗

BOLT #3 revocationpubkey, a blinded key: revocation_basepoint * SHA256(revocation_basepoint || per_commitment_point) + per_commitment_point * SHA256(per_commitment_point || revocation_basepoint)

(revocation_basepoint, per_commitment_point)

Source from the content-addressed store, hash-verified

91
92
93def derive_revocation_pubkey(revocation_basepoint, per_commitment_point):
94 """BOLT #3 revocationpubkey, a blinded key:
95
96 revocation_basepoint * SHA256(revocation_basepoint || per_commitment_point)
97 + per_commitment_point * SHA256(per_commitment_point || revocation_basepoint)
98 """
99 h1 = _sha256(revocation_basepoint, per_commitment_point)
100 h2 = _sha256(per_commitment_point, revocation_basepoint)
101 term1 = coincurve.PublicKey(revocation_basepoint).multiply(h1, update=False)
102 term2 = coincurve.PublicKey(per_commitment_point).multiply(h2, update=False)
103 return coincurve.PublicKey.combine_keys([term1, term2]).format(compressed=True)
104
105
106def _add_number(num):

Calls 1

_sha256Function · 0.85

Tested by

no test coverage detected