Score:1

Is the generator point in the curve in secp256k1?

ye flag

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
poncho avatar
my flag
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...
Reda Bourial avatar
ye flag
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.
fgrieu avatar
ng flag
Hint: the curve's equation $y^2=x^3+7$ is in the [***BASE FIELD***](https://www.secg.org/sec1-v2.pdf#subsubsection.2.1.1). $n$ is the order of the [***ELLIPTIC CURVE GROUP***](https://www.secg.org/sec1-v2.pdf#subsubsection.2.2.1). These are like car and pizza. Parameters for [secp25k1](https://www.secg.org/sec2-v2.pdf#subsubsection.2.4.1).
Reda Bourial avatar
ye flag
could you be more explicit please ? \[moderator note: as stated [there](https://crypto.stackexchange.com/help/on-topic), this group's practice is to only give hint on homework questions; see e.g. this [meta](https://crypto.meta.stackexchange.com/q/1115/555)\].
fgrieu avatar
ng flag
Enough with analogies. The curve's equation $y^2=x^3+7$ is with $x$, $y$, the addition and multiplication operators for a [field](https://en.wikipedia.org/wiki/Field_(mathematics)) noted $\mathbb F_p$ in [this reference](https://www.secg.org/sec1-v2.pdf#subsubsection.2.1.1). 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](https://www.secg.org/sec1-v2.pdf#subsubsection.2.2.1) group [secp256k1](https://www.secg.org/sec2-v2.pdf#subsubsection.2.4.1). That's reason enough for the verification to fail.
Score:2
ye flag

The generator point belongs to the curve when using the right parameters.

DannyNiu avatar
vu flag
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.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.