BOLT #3: pubkey = basepoint + SHA256(per_commitment_point || basepoint) * G Both args and the result are 33-byte compressed pubkeys.
(basepoint, per_commitment_point)
| 79 | |
| 80 | |
| 81 | def derive_simple_pubkey(basepoint, per_commitment_point): |
| 82 | """BOLT #3: pubkey = basepoint + SHA256(per_commitment_point || basepoint) * G |
| 83 | |
| 84 | Both args and the result are 33-byte compressed pubkeys. |
| 85 | """ |
| 86 | tweak = _sha256(per_commitment_point, basepoint) |
| 87 | tweak_g = coincurve.PublicKey.from_valid_secret(tweak) |
| 88 | combined = coincurve.PublicKey.combine_keys([coincurve.PublicKey(basepoint), |
| 89 | tweak_g]) |
| 90 | return combined.format(compressed=True) |
| 91 | |
| 92 | |
| 93 | def derive_revocation_pubkey(revocation_basepoint, per_commitment_point): |
no test coverage detected