What is the difference or the meaning of these two headers of input scripts?

1) 4730440220 2) 4830450221

I see a lot of them in transactions but I don't understand the difference.



Basically it is the length of a signature. In this encoding scheme we find R or S values for sigs, that can have a different length, making the whole string being 72,73 or 74 bytes long.

Pieter described it here: Why the signature is always 65 (1+32+32) bytes long?

and here: What are the parts of a Bitcoin Transaction "Input" script?

I think older tx even had 0x49 at the beginning, then both R and S values would have a length of 33 bytes. I can't find the link, but I was under the impression, that since bitcoin core release 13 these length don't appear anymore (to be verified).

There is also some older reference here: https://bitcointalk.org/index.php?topic=8392.0

| improve this answer | |

For most transactions, the input scriptSig will be a push of the signature followed by a push of the public key. The "push" part is done with script opcodes which say how long it is, and the signature is encoded as DER.

47/48 are the push opcodes, to say 0x47 or 0x48 bytes will follow. Then the signature is encoded as: 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S] [sighash-type] So the total length in your examples is either 0x44 or 0x45, and the R-length is 0x20 or 0x21.

| improve this answer | |
  • So they do the same thing in two different ways? If so, why don't use one way? – lemanb84 Jan 25 '18 at 21:49
  • No, one of them is if the R-length is 0x21 and the other is for R-length 0x20. Depends how long R is in the signature. – MeshCollider Jan 25 '18 at 21:51

Your Answer

