4

As I know, standard ECDSA digital signature algorithm returns two values (according to this article or Wikipedia), but transaction push services or APIs, like this one, require one string as a signature. Can anyone explain, what is that string, and how can I get it with those values? Is it possible with OpenSSL? Thank you very much!

Guest_User
  • 63
  • 1
  • 4

1 Answers1

3

The ECDSA digital signature scheme returns two values. To be specific, the X and Y values computed on the elliptic curve are returned.

In Bitcoin the signture is DER encoded, which is represented as a string containing the X and Y values and also some header data. But both X and Y can easily be extracted from it when reading the string from left to right.

In fact the Bitcoin protocol uses more information than only those concerning the X and Y values. For example, the size of the DER encoded signature is specified, but also a so called signature type is used to define which part of the transaction the signature was computed for.

Take a look here under the section "Signing the transaction" to see exactly how it works. In the table you will see how a computed signature is used in a scriptSig.

The details regarding the DER encoding was discussed here.

Bjarne Magnussen
  • 937
  • 5
  • 16