1

Is there a way to sign a transaction to be accepted on a specific chain?

In other words, if I want to sign an offline transaction via geth, say 0.5 eth from external address A to external address B, is there a way to specify the desired chain to be Kovan/Mainnet/etc in the transaction?

I'm hoping to prevent a malicious actor from broadcasting the hash of the signed transaction on another chain (like mainnet, when the txn was meant for a testnet). E.g. replay attack

On geth, I've tried to sign a transaction offline through eth.signTransaction( ):

var tx = eth.signTransaction({from:YOURADDRESS, to:TOADDRESS, gas:GAS, gasPrice:GASPRICE, nonce:19, value:500000000000000, networkId:1},YOURADDRESS)

In place of the "networkId" parameter, I've tried the following combinations of parameters and arguments:

  • networkId:1
  • networkId:42
  • chainId:1
  • chainId:42

The tx.raw or hash of the signed transaction for each confirguration returns the same bytecode. I was even able to broadcast and submit a txn on kovan with a chainId:1 argument.

Pls help. Thank you in advance!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.