4

A contract can be deployed on different chains at the same address by using the same private key with the same nonce on each chain.

Given that forking a chain opens up possible replay attacks on acounts, does deploying parallel contracts also open up similar attacks upon the users of those contracts?

2 Answers 2

1

There is a mechanism to protect against replay attacks on different chains, it's the chainId param in EIP 155. Since you have to specify the chainId in your transaction params, the signed transaction becomes different for every chain, so no, nothing to worry about here.

0

The contract address is a hash generated from the wallet address that deploys it plus the nonce. That's why even if you deploy the same contract on multiple chains, the contract address will most likely be different.

https://ethfiddle.com/lOvRUBOJso - this is a simple fiddle, but if you click create multiple times, you'll see how the contract address changes each time.

That said, I think you have a misunderstanding on how contracts work. The person who calls the functions are the ones signing and paying for the transaction. So just because multiple contracts exist on different chains, doesn't mean that the private/public key pair of the wallet that deployed it is compromised.

3
  • 2
    Contracts can be deployed to the same address by using a new account on both chains. I'm not aware of and cannot think of any attacks from doing this but just wanted to check in given that TX's from external accounts, being the same address, can be replayed across a fork.
    – o0ragman0o
    Commented Nov 16, 2017 at 7:30
  • So stuff like this can happen: medium.com/bitclave/… ^ story about how someone recovered ether sent to the wrong contract
    – llz
    Commented Nov 16, 2017 at 12:05
  • 6
    @o0ragman0o Since EIP 155, the chainId is used in the transaction signature. So two contracts with the same address in different chains are protected against replays attacks, but before EIP 155 it was possible to replay transactions from one chain into another.
    – Ismael
    Commented Nov 17, 2017 at 4:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.