Read from some document about EOS key recovery method:

  1. Start from standard EOS address (53byte), for exp: EOS+(50byte base58);
  2. decode (50byte base58) to get 37byte (hex);
  3. remove last 4byte (checksum) then finally get 33byte, which will be the pub key.

My question are:

  1. From my understanding the secp256-r1/k1 both using the ECC key which should be 256b (32Byte) but not 33Byte? So where does one additional byte come from?

  2. Standard ECC key, public key have two section (x and y) both are 256bit--so-called EOS pub key--is that x section of the ECC pub-key? is the y section been used in the application?

  3. As I check a final generated EOS signature, after convert base58 I get a 65byte hex, which is again 1 byte longer than a standard ECDSA signature?

Thanks so much.. below is a sample:

EOS Public key: 53byte
Step#(1.a) remove "EOS" then do base58 decode: (37Byte)
Step#(1.b) remove the last 4bytes: (33byte, why): 

EOS Private key: 51byte

Step#(1.a) do base58 decode: (37Byte)
Step#(1.b) remove the last 4bytes: (33byte, why): 
  • OK I find this developers.eos.io/keosd/docs/…. so for the private key I need remove the 80 pre-fix from the beginning. But no clue for public key yet, does that mean I shall remove 03 from the above publick key hex string?
    – LeonMSH
    Commented Jul 26, 2019 at 3:45

1 Answer 1

  1. As the link in your comment explain, 0x80 prefix is Bitcoin convention. (indicating Bitcoin mainnet)

  2. Due to characteristics of elliptic curve, there are only two points which share same x-coordinate. It means that, if you know x-coordinate and sign of y-coordinate, you can derive complete pair of x- and y-coordinate. That's compressed public key. (Oppositely, uncompressed public key contains complete x- and y-coordinate) Compressed public key consists of prefix (0x2 or 0x3 for sign of y-coordinate) and 32-byte binary for x-coordinate. Uncompressed public key don't need sign information, but has 0x4 prefix to show that it is uncompressed public key.

  3. One additional byte is recovery ID. You can find detailed answer from here.

  • great thanks. For the reply to Q3, is the EOS/Etherum are all derived from Bitcoin? right now I have a EOS signature with 65byte, the first byte looks like 31, not value from 27~30..
    – LeonMSH
    Commented Jul 31, 2019 at 2:05
  • @LeonMSH EOS recovery id follows Bitcoin convention. You had better refer to this. Ethereum has a different way to determine recovery id.
    – conr2d
    Commented Jul 31, 2019 at 7:31
  • Things get a bit more complex... we are playing in EOS signature/verifying and meet some problem so try to using standard form ECDSA for a comparet--it passed test and we then find that signature adopts so-called DER format (which has 71 or 72 bytes...) I think EOS does not take DER format--is that correct understanding? I am referring to this post: bitcoin.stackexchange.com/questions/12554/…
    – LeonMSH
    Commented Jul 31, 2019 at 11:57
  • No, EOS signature isn't encoded in DER. Basically, signature consists of two values, r and s (each value has 32-byte length), and EOS signature serializes them directly, but only difference in DER, it has additional bytes in its format.
    – conr2d
    Commented Jul 31, 2019 at 12:19
  • Many thnaks for your patient..Here is the K1 signature we get from EOS (simply remove middle part for better showing): SIG_K1_Kevn(...)poMqF convert to hex mode it is something like 0x 204DD0C3(...)A8D97E7E, totally 69byte.. so recid 0x20=0d32; 1. The pubkey we are using start as 0x04 so it is uncompress. 2. recid = 27 + v + (if compressed 4 else 0), so we shall use recid=27 + v; 3. v = if(R.X > curve.N) then 2 else 0) | (if R.Y. Is even then 0 else 1); so v=0-3, therefore recid shall not bigger than 0d30. That means something is not right for our playing??
    – LeonMSH
    Commented Aug 1, 2019 at 1:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.