1

I am trying to create a function which can be used to get the v, r, s parameters (ECDSA) of the signature.
So i am thinking to pass a random tx hash from etherscan and it will return v,r,s parameters of the signed tx.

Can somebody please help me in this?

2 Answers 2

0

Unfortunately it seems both web3.js v0.20 and v1.0 will strip r, s, v parameters.

But if you use the JSON RPC directly it return those values.

In the wiki https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyhash they gave an example using curl:

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b"],"id":1}'

// Result
{
    ... // some other data

    "v":"0x25", // 37
    "r":"0x1b5e176d927f8e9ab405058b2d2457392da3e20f328b16ddabcebc33eaac5fea",
    "s":"0x4ba69724e8f69de52f0125ad8b3c5c2cef33019bac3249e2c0a2192766d1721c"
  }
}
0

if you use the raw tx hash from etherscan you can get the v,r,s. for this raw tx example:

0xf86c01850c4b201000825208949cbfd6ebdb9cfcccd6b043f43e524583486d455e880490283b23ec8f768025a067da959a6d114d42016b5fb43ff8ae018efe6e4c784d40dfb2f2aad8fb2d4f6ca00b019b1e457b592e5bfd553e3b73742de625c7b65145494a57dbca17e5e9d842

in that hash, look for "a0".

0xf86c01850c4b201000825208949cbfd6ebdb9cfcccd6b043f43e524583486d455e880490283b23ec8f768025 a067da959a6d114d42016b5fb43ff8ae018efe6e4c784d40dfb2f2aad8fb2d4f6c a00b019b1e457b592e5bfd553e3b73742de625c7b65145494a57dbca17e5e9d842

1 byte, 2 chars before first "a0" is the v value:

  v=25

32 bytes after first "a0" is the r value

     a0 =160
     0x80=128

     a0-0x80=160-128=32 bytes

 r=67da959a6d114d42016b5fb43ff8ae018efe6e4c784d40dfb2f2aad8fb2d4f6c

32 bytes after second "a0" is the s value

s=0b019b1e457b592e5bfd553e3b73742de625c7b65145494a57dbca17e5e9d842

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.