0

Why in some transactions the public key after R and S is longer 33 bytes and in others is 65 bytes? There's a difference during the signature check?

Thanks

  • 1
    Possible duplicate of Input script difference – pebwindkraft Jan 27 '18 at 8:54
  • have a look at the questions, and especially their replies, they contain a complete explanation of the way, the signatures are structured. If not the answer, then consider rephrasing your question, it doesn't make sense, as sigs are always having an R and and S component, each being hex 0x47 or 0x48 bytes long. – pebwindkraft Jan 27 '18 at 8:57
  • Hi, I think my question is clear. I asked bot the question for a reason. The first one was about the header script, this one is about the Len of the public key. I want to now why can I have public keys of different length – lemanb84 Jan 27 '18 at 9:26
0

ah, indeed that was not clear to me. The input sigscript is composed of two parts, the signature itself, and the following "condition", that need to be met for spending the tx. Usually this is a public key, but can also be multisig elements or smart contracts.

In the case where a public key follows, there are two representations of public keys: compressed keys and uncompressed keys. How they are generated is explained in a thread here: How are compressed PubKeys generated?. So you can have this representation:

pubkey hex uncompressed (04 + x + y):

04 50863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B2352 2CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6

or this: pubkey hex compressed (02 + x, y=even):

02 50863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B2352

In the case where y=odd, then a 03 is at the beginning. Looking at the length, you have 65 for uncompressed, and 33 bytes for compressed keys.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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