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?
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 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
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