Skip to content

new Ethers.Wallet giving me a 132 character public key? #2026

Answered by ricmoo
nolanjannotta asked this question in Q&A
Discussion options

You must be logged in to vote

A public key (uncompressed) is 65 bytes, which is 130 nibbles. The first byte for an uncompressed key is always 04, which indicates the key is uncompressed. The first by of a compressed key is always either 02 or 03, depending on whether the y coordinate is “positive” or “negative” (the first bit is 0 or 1 respectively).

If you are using a library that expects just the raw x and y, you can trim off the first byte (the 04), but most libraries should be able to understand that initial byte and length indicates the following key is uncompressed and trim it off for you.

Make sense?

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@ricmoo
Comment options

@nolanjannotta
Comment options

@ricmoo
Comment options

@nolanjannotta
Comment options

Answer selected by nolanjannotta
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants