Signature Parameters – How to Get Signature Parameters From a Transaction

go-ethereumparityraw-transactionsignaturetransactions

In my application I have to manually verify certain transaction signatures on the ethereum blockchain. Atm I am running geth and parity nodes and query transaction information via the rpc interface but it seems to be missing the ecdsa sig params.

From what I see, both geth and parity do not seem to expose signature parameters via the rpc interface like bitcoind does (it exposes the input and output scripts with get_rawtransaction). Is there an easy way to access them or do both geth and parity strip signatures in their local blockchain caches once signatures were verified for some reason? I am wondering because even ecp only seems to parse the raw transactions from blocks into txhash,rcpt,from,amount,price,gaslimit,payload (=data), blockid missing the signature params (or are they hidden in the payload field?).

What would be an option to get complete raw transaction information as if I'd just signed it with web3.eth.sign()?

Best Answer

In the transaction object returned by eth_getTransaction to my geth instance does include the ECDSA parameters:

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params": ["0x47ced780ecca7c273243dded62c6a240f3ba4332ab067345909a304d7294cfda"],"id":1}' localhost:8545

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "blockHash": "0x7126318b5736f655049fcb7c3f6ef02d0986a5553cb1b1fbc0ca188543b1e60a",
    "blockNumber": "0x339d04",
    "from": "0xea674fdde714fd979de3edf0f56aa9716b898ec8",
    "gas": "0x15f90",
    "gasPrice": "0x4a817c800",
    "hash": "0x47ced780ecca7c273243dded62c6a240f3ba4332ab067345909a304d7294cfda",
    "input": "0x",
    "nonce": "0x15dcf8",
    "to": "0xf34a762291e2578b79646cbf296abf4f5a242b3d",
    "transactionIndex": "0x0",
    "value": "0x16978c7c04171dc",
    "v": "0x26",
    "r": "0xe448b291661c63d8add23a8be2eb726e92ace5c100e902ee75a6396f8df8d221",
    "s": "0x197fb2e88dc2d4e8f606faf6abdb8012d21b024939756ceaf2d39b4bef619fa4"
  }
}

Note the v, r, and s parameters: these are what you need to verify the signature. I'm not sure why these aren't in the official RPC spec, but they are available if you need them

Related Topic