Is the generator point in the curve in secp256k1?

Here is the fixed script

# Generator point coordinates
x=55066263022277343669578718895168534326250603453777594175500187360389116729240
y=32670510020758816978083085130507043184471273380659243275938904335757337482424
# Order
n=115792089237316195423570985008687907853269984665640564039457584007908834671663
# from the curve equation y^2=x^3+7
should_be_zero= (y**2)-(x**3+7)
print("by applying the equation, this should be equal to 0 :",should_be_zero)
# The remainder from the division by n should be 0
print("should_be_zero divided by n leaves:",should_be_zero%n)


the output

by applying the equation, this should be equal to 0 : -166977061698153803977729810299616665720111080589888563362701662779994291659332409807309461070447932090244771419528434792678509158779752908144538176572381887934774683088169260414743338484604182122883788458741320363571878334796108231
should_be_zero divided by n leaves: 0

• You do realize for any valid $x$ coordinate, there are two possible $y$ coordinates (and both $y$ coordinates correspond to valid points). Perhaps your 'curve' function returns the other one... Dec 15, 2022 at 19:51
• thank you for pointing that out but i've tried the other point with no success, i will try to rephrase my question to eliminate that posibility. Dec 15, 2022 at 21:17
• Hint: the curve's equation $y^2=x^3+7$ is in the BASE FIELD. $n$ is the order of the ELLIPTIC CURVE GROUP. These are like car and pizza. Parameters for secp25k1.
– fgrieu
Dec 15, 2022 at 21:34
• could you be more explicit please ? [moderator note: as stated there, this group's practice is to only give hint on homework questions; see e.g. this meta]. Dec 15, 2022 at 22:18
• Enough with analogies. The curve's equation $y^2=x^3+7$ is with $x$, $y$, the addition and multiplication operators for a field noted $\mathbb F_p$ in this reference. Your code is trying to verify it in another field $\mathbb F_n$, where $n$ is the order (number of elements) of the Elliptic Curve group secp256k1. That's reason enough for the verification to fail.
– fgrieu
Dec 16, 2022 at 5:53

• That is, the modulus for the coordinates is $p$, which is different from the order (number of elements) of the curve $n$. (This detail better be included in the answer. Dec 16, 2022 at 10:43