If I have a signed transaction such as 0xf86c098504a817c800825208943535353535353535353535353535353535353535880de0b6b3a76400008025a028ef61340bd939bc2195fe537567866003e1a15d3c71ff63e1590620aa636276a067cbe9d8997f761aecb703304b3800ccf555c9f3dc64214b297fb1966a3b6d83 (taken from https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md), how do I go about extracting the v,r and s values from this without using some external library?


This part of the signed transaction contains the v, r, and s fields:


We can go through each byte (One byte is two characters in the above transaction)

The values are:


r_length=(0xa0-0x80)=0x20=32 (bytes)




The encoding of an Ethereum transaction is called RLP and you can find the find it definition in the Ethereum Yellow Paper.

  • Brilliant, thank you. Just one more question: How did you know which part of the transaction contained the v,r, and s fields? – Nico Apr 11 at 4:06
  • Nevermind, I got it - it's because v is 1 byte, r and s are 32 bytes. Plus the 2 bytes indicating the length of r and s that makes 67 bytes, which is the length of the string you posted. Thanks! – Nico Apr 11 at 4:18
  • Yes. But the RLP encoding also shows that the v value has a length of one byte since values from 1 to 127 are simple encoded as their byte value; values above that has a value indicating the length of the number in bytes followed by the actual value. Also, the three last values of a signed transaction are always v, r, s in that order. – Thorkil Værge Apr 11 at 7:52

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.