What's the magic numbers meaning of 27 or 28 in VRS ( use to ecrover the sender) ? why not 0 or 1? Ecrecover need 0 or 1, but transaction RLP is 27 or 28. Before ecrecover, sub 27 to get 0 or 1. Why not encode the transaction use 0 or 1 directly? What's the magic number 27 and 28 mean?

1 Answer 1


This issue is reported at package 'ethereumjs-util' / function 'fromRpcSig'.

As you can see, the documentation of this function states:

And as you can see, the values 0 and 1 are supported, while the function adds 27 to the last byte in the 65-byte buffer (the last two characters in the 130-character string) in order to support the values 27 and 28 as well.

A similar question has been answered here.

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.