user126847: Ok, so I get address generation now, and I understand that X is hashed, however for verification of a signature, we need the public point, (x,y)
How would one get Y from X?
Lets take an example, im gonna use my generator (0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798,0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8) and use private "10" (using a = 0, b = 7, p = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f) to get:
(0xa0434d9e47f3c86235477c7b1ae6ae5d3442d49b1943c2b752a68e2a47e247c7,0x893aba425419bc27a3b6c7e693a24c696f794c2ed877a1593cbee53b037368d7)
Now we remove Y, to only have: 0xa0434d9e47f3c86235477c7b1ae6ae5d3442d49b1943c2b752a68e2a47e247c7
Meaning that we need to get Y from X, how would I do this? I never seen this explained really and everything I tried doesn't result in the correct Y value

user208: The secp256k1 curve equation is:

Points (x,y) for which y2 = x3 + 7 mod p, where p = 2256-232-977

If we solve this for y, we get y = ±√(x3 +7) mod p.
Of course, this is not a normal square root, but a square root for the field of integers modulo p, but otherwise this equation is correct. To compute such a modular square root, the Tonelli-Shanks algorithm is used. It can deal with many cases, depending on the structure of the modulus, but for our p modulus it simplifies to just:

√a mod p = a(p+1)/4 mod p (for any prime p for which p+1 is a multiple of 4).


126847: <p>Ok, so I get address generation now, and I understand that X is hashed, however for verification of a signature, we need the public point, (x,y)</p>
<p>How would one get Y from X?</p>
<p>Lets take an example, im gonna use my generator (0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798,0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8) and use private &quot;10&quot; (using a = 0, b = 7, p = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f) to get:</p>
<p>(0xa0434d9e47f3c86235477c7b1ae6ae5d3442d49b1943c2b752a68e2a47e247c7,0x893aba425419bc27a3b6c7e693a24c696f794c2ed877a1593cbee53b037368d7)</p>
<p>Now we remove Y, to only have: 0xa0434d9e47f3c86235477c7b1ae6ae5d3442d49b1943c2b752a68e2a47e247c7</p>
<p>Meaning that we need to get Y from X, how would I do this? I never seen this explained really and everything I tried doesn't result in the correct Y value</p>
 208: <p>The secp256k1 curve equation is:</p>
<ul>
<li>Points <em>(x,y)</em> for which <em>y<sup>2</sup> = x<sup>3</sup> + 7</em> mod <em>p</em>, where <em>p = 2<sup>256</sup>-2<sup>32</sup>-977</em></li>
</ul>
<p>If we solve this for <em>y</em>, we get <em>y = ±√(x<sup>3</sup> +7) mod p</em>.</p>
<p>Of course, this is not a normal square root, but a square root for the field of integers modulo <em>p</em>, but otherwise this equation is correct. To compute such a modular square root, the <a href="https://en.wikipedia.org/wiki/Tonelli%E2%80%93Shanks_algorithm" rel="nofollow noreferrer">Tonelli-Shanks</a> algorithm is used. It can deal with many cases, depending on the structure of the modulus, but for our <em>p</em> modulus it simplifies to just:</p>
<ul>
<li><em>√a mod p = a<sup>(p+1)/4</sup> mod p</em> (for any prime <em>p</em> for which <em>p+1</em> is a multiple of <em>4</em>).</li>
</ul>
