<p>The secp256k1 arithmetic is defined over the finite field of integers modulo <em>2<sup>256</sup> - 2<sup>32</sup> - 977</em>.</p>
<p>The following code works:</p>
<pre class="lang-py prettyprint-override"><code>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)
</code></pre>
<p>with output:</p>
<pre><code>True
32748224938747404814623910738487752935528512903530129802856995983256684603122
32748224938747404814623910738487752935528512903530129802856995983256684603122
</code></pre>

CC BY-SA 4.0
2022-10-15T12:36:35.500Z
2022-10-17T19:05:14.327Z
2022-10-17T19:05:14.327Z
Pieter Wuille
<p>This is my Python program:</p>
<pre class="lang-py prettyprint-override"><code>Acurve = 0
Bcurve = 7
Gx = 0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798 
Gy = 0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8

print(Gy**2 == Gx**3 + Bcurve)
print(Gy**2)
print(Gx**3 + Bcurve)
</code></pre>
<p>This is the output:</p>
<pre><code>False
1067362225016502275772194909503713869376985974142797512091458491530306631211206623652669436957676354343630306950631573032330832513385319878364322508915776
166977061698153803977729810299616665720111080589888563362701662779994291659333477169534477572723704285154275133397811778652651956291844366636068483203593094558427352525126936769086968791554813695916119291254705683450242657305024007
</code></pre>
<p>Why is the equation not satisfied for the generator point?</p>

<python><cryptography><secp256k1>
Why bitcoin's generator point does not satisfy Elliptic Curve Cryptography equation?
Devanshu Linux
# Why bitcoin's generator point does not satisfy Elliptic Curve Cryptography equation?

(Asked by: username_0 on 2022-10-15)

This is my Python program:

```py
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?

**Tags:** python, cryptography, secp256k1


---

## 1 answers

### Answer by username_1 on 2022-10-15. Score: 7 | Accepted answer

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

The following code works:

```py
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

```


---

