Thanks for the response. Yes, rsv
need to be set in order for web3 to be able to determine the right from address. We know r
and s
. However, prior to signing, we don’t know the value of v
. It can be 27 or 28. We’re using this little trick to get temporary values for rsv
so that we can use those values in the Tx that we want to sign.
I tried a few different ways to determine the public keys but this way works 100% every time. This is the way I tried to explain this in the article.
If you do not set any value for
r
,s
andv
before signing, Ethereum will not be able to determine thefrom
address of the transaction. In turn, it will end up calculating the wrong public key and it won’t be able to send your transaction due to insufficient funds. This is a chicken-egg problem since you do not know thersv
values prior to signing.
Hope it makes more sense now. Let me know if you have any other questions.