6

Substrate supports multiple signature schemes: ecdsa, sr2551, ed25519. When sending a signed transaction how does substrate know what scheme to use for signature verification?

1 Answer 1

9

It is a SCALE-encoded MultiSignature enum. so in SCALE encoding the first byte tells you which variant the value is. So you will notice that ed25519 signatures always start with 0x00, sr25519 with 0x01, and ecdsa with 0x02.

So in a fully serialized transaction, the "signature" is actually 0x <scheme> + <signature>.

1
  • Do you know where in the code base encoded bytes are decoded to MultiSignature based on the scheme type?
    – Shunsuke
    Mar 13 at 8:22

Your Answer

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

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