2

This is my Python program:

Acurve = 0
Bcurve = 7
Gx = 0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798 
Gy = 0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8

print(Gy**2 == Gx**3 + Bcurve)
print(Gy**2)
print(Gx**3 + Bcurve)

This is the output:

False
1067362225016502275772194909503713869376985974142797512091458491530306631211206623652669436957676354343630306950631573032330832513385319878364322508915776
166977061698153803977729810299616665720111080589888563362701662779994291659333477169534477572723704285154275133397811778652651956291844366636068483203593094558427352525126936769086968791554813695916119291254705683450242657305024007

Why is the equation not satisfied for the generator point?

1 Answer 1

7

The secp256k1 arithmetic is defined over the finite field of integers modulo 2256 - 232 - 977.

The following code works:

M = 2**256 - 2**32 - 977
Acurve = 0
Bcurve = 7
Gx = 0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798 
Gy = 0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8

print((Gy**2 - Gx**3 - Bcurve) % M == 0)
print(Gy**2 % M)
print((Gx**3 + Bcurve) % M)

with output:

True
32748224938747404814623910738487752935528512903530129802856995983256684603122
32748224938747404814623910738487752935528512903530129802856995983256684603122
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.