1
$\begingroup$

Is there any formula for deriving the $y$-coordinate using the $x$-coordinate and the slope in the secp256k1 elliptic curve?

For example:

Calculate the slope:

slope = 75359724952757581356787150982223137069297282952438962440225639443485944634025

Calculate the new $x$-coordinates:

x = 112711660439710606056748659173929673102114977341539408544630613555209775888121

Calculate the new $y$-coordinates:

y = 25583027980570883691656905877401976406448868254816295069919888960541586679410

Each of the above values are valid points in the elliptic curve.

$\endgroup$
3
  • 1
    $\begingroup$ Have you tried looking at the math behind elliptic curves? Points are defined by an equation which you can find online easily. $\endgroup$
    – Gareth Ma
    Sep 5 at 2:01
  • $\begingroup$ A valid x coordinate defines one of two points. It's unclear the slope of what the other given is. $\endgroup$
    – fgrieu
    Sep 5 at 8:28
  • $\begingroup$ "Each of the above values are valid points in the elliptic curve" There is one slope and two coordinates. At most there is one point defined in the question: $(x, y)$, which begs the question if you've got enough understanding of ECC calculations. $\endgroup$
    – Maarten Bodewes
    Sep 7 at 9:49

2 Answers 2

1
$\begingroup$

In python we have (see this):

slope = (3 * pow(x, 2, p) * pow(2 * y, -1, p)) % p

So

y = (3 * pow(x, 2, p) * pow(2 * slope, -1, p)) % p

Example

p = 2 ** 256 - 2 ** 32 - 2 ** 9 - 2 ** 8 - 2 ** 7 - 2 ** 6 - 2 ** 4 - 1
x = 112711660439710606056748659173929673102114977341539408544630613555209775888121
y = 25583027980570883691656905877401976406448868254816295069919888960541586679410
slope = 75359724952757581356787150982223137069297282952438962440225639443485944634025 
y_ = 3 * pow(x, 2, p) * pow(2 * slope, -1, p) % p
assert y == y_
$\endgroup$
2
$\begingroup$

The octet-string-to-ec-point conversion subroutine contains steps that de-compresses a EC point with only x-coordinates into X-Y tuple.

The spec's available on SECG website, section 2.3.4 of SEC#1 v2.0

$\endgroup$

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.