Skip to main content
1 of 2

How to calculate the Hashes in Lightning

I was wondering how I calculate the hashes regarding BOLT03 Specification:

The Revocation Pubkey is calculated like this:

revocationpubkey = revocation_basepoint * SHA256(revocation_basepoint || per_commitment_point) + per_commitment_point * SHA256(per_commitment_point || revocation_basepoint)

How do I calculate this hash: Is it like all in hex:

SHA256(revocation_basepoint || per_commitment_point) = SHA256(compressed revocation_basepoint with prefix  || compressed per_commitment_point with prefix)

or is it like all in hex:

SHA256(revocation_basepoint || per_commitment_point) = SHA256(revocation_basepoint_x|| revocation_basepoint_y || per_commitment_point_x || per_commitment_point_y)