Bitcoin Forum
May 02, 2024, 06:13:27 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Public Key x,y coordinates, when is y ever negative?  (Read 108 times)
davi1d (OP)
Newbie
*
Offline Offline

Activity: 5
Merit: 6


View Profile
April 02, 2023, 04:03:30 PM
Merited by o_e_l_e_o (4), ABCbits (2)
 #1

I was looking through ECDSA math and feel like I am missing something related to the x,y coordinates of a public key, searched around but did not find answers so coming here hoping for some help / guidance.

My question is:  Is there a private key where the y coordinate of the public key created through the ECDSA secp256k1 curve ever a negative y?  From what I can tell is 'no', but then I wonder why even bring the sign into the bitcoin code as a prefix?  I must be missing or misunderstanding something.

What leads me to think this way is how mod function attached to determination of a y coordinate as well as numerous examples and attempts.

Thanks
1714630407
Hero Member
*
Offline Offline

Posts: 1714630407

View Profile Personal Message (Offline)

Ignore
1714630407
Reply with quote  #2

1714630407
Report to moderator
1714630407
Hero Member
*
Offline Offline

Posts: 1714630407

View Profile Personal Message (Offline)

Ignore
1714630407
Reply with quote  #2

1714630407
Report to moderator
1714630407
Hero Member
*
Offline Offline

Posts: 1714630407

View Profile Personal Message (Offline)

Ignore
1714630407
Reply with quote  #2

1714630407
Report to moderator
"Bitcoin: the cutting edge of begging technology." -- Giraffe.BTC
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714630407
Hero Member
*
Offline Offline

Posts: 1714630407

View Profile Personal Message (Offline)

Ignore
1714630407
Reply with quote  #2

1714630407
Report to moderator
1714630407
Hero Member
*
Offline Offline

Posts: 1714630407

View Profile Personal Message (Offline)

Ignore
1714630407
Reply with quote  #2

1714630407
Report to moderator
pooya87
Legendary
*
Offline Offline

Activity: 3444
Merit: 10522



View Profile
April 02, 2023, 04:46:13 PM
Merited by o_e_l_e_o (4), ABCbits (2), davi1d (1)
 #2

why even bring the sign into the bitcoin code as a prefix?
We don't use sign for any of the integers used in elliptic curve cryptography because the modular arithmetic is used. In calculations of ECDSA, etc. we may end up with negative values which by contract all numbers should be reported as positives so they are converted to their positive equivalent inside the used group. For example using modulo 7, a negative number like -5 becomes 2 that is -5≡2 (mod 7).

It's the same principle for negative a value like -y or when "negating" the y coordinate, you'd compute P-y (mod P) to get the positive value between 0 and P.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18509


View Profile
April 02, 2023, 07:48:32 PM
Last edit: April 03, 2023, 08:34:49 AM by o_e_l_e_o
Merited by ABCbits (2), davi1d (1)
 #3

My question is:  Is there a private key where the y coordinate of the public key created through the ECDSA secp256k1 curve ever a negative y?  From what I can tell is 'no', but then I wonder why even bring the sign into the bitcoin code as a prefix?  I must be missing or misunderstanding something.
Given that the secp256k1 curve is defined modulo p, then there are no negative coordinates as anything which would be negative will loop round mod p and end up positive. As pooya87 says, -y = p-y.

Given that the curve equation is y2 = x3 + 7, then for every x coordinate there are two valid y coordinates. And because p is an odd prime, negating y by doing p-y as above will change its parity. This means that one y coordinate will always be even, and the other will always be odd. This allows us to compress public keys simply by specifying the parity of the y coordinate as a prefix.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!