Post
Topic
Board Development & Technical Discussion
Re: public key to mnemonic
by
o_e_l_e_o
on 30/11/2020, 19:43:27 UTC
Until now, it wasn't a problem I was generating a random private key then I was getting the 260-bit public key, I cut the last 2 hex characters to achieve 256 bits and then I could get 24 words.
A public key is not 260 bits, and cutting two hex characters is equivalent to cutting 8 bits, not 4.

A full uncompressed public key is 520 bits long, which is 130 hex characters. This takes the form of the prefix byte 04 followed by two 256 bit numbers - the x coordinate and the y coordinate.

A compressed public key is 264 bits long which is 66 hex characters. You drop the 256 bit y coordinate, and change the prefix byte to either 02 or 03[/t] depending on whether the y coordinate is even or odd.