Given an unsigned transaction, constructed using pythereum.transaction, and a signature, created by signing the transaction's hash with a private key, how do I extract the v, r, s values from the signature so they can be added to the unsigned transaction to sign it?

2 Answers 2


The r, s and v values are different slices (in that order) of the signature created by signing a hash value. Refer: https://github.com/ethereumjs/testrpc/pull/19

The ranges of each slice are in the first message of the thread at the above link. Also, note the part about adding 27 to the value of v if v is 0 or 1. The reason for this is an issue whose link is given in that message.


If you can use pyethereum to sign with the private key, then Transaction objects already parse out r, s, and v for you. They are made available as attributes of the same name on the transaction object.

In the code for transaction.sign(key), it sets the variables here:

self.v, self.r, self.s = ecsign(rawhash, key)

(But then your transaction object would already be signed, so you wouldn't need to do any more work, and probably don't need r, s, and v anymore.)

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.