3

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?

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.

  • 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 Nov 16 '17 at 7:30
  • So stuff like this can happen: medium.com/bitclave/… ^ story about how someone recovered ether sent to the wrong contract – llz Nov 16 '17 at 12:05
  • 2
    @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 Nov 17 '17 at 4:06

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.