2

What happens if by randomness you deploy a contract to the same address then an existing EOA?

Would the deployment be rejected? Would it only be rejected if the EOA has no transaction history i.e a nonce of 0?

1 Answer 1

3

You should check EIP-3607

Ethereum addresses are currently only 160 bits long.
This means it is possible to create a collision between a contract account
and an Externally Owned Account (EOA) using an estimated 2**80 computing operations,
which is feasible now given a large budget (ca. 10 billion USD).
The fix in this EIP prevents the worst possible attack, where a safe looking contract
(e.g. a token wrapper or an AMM-type contract) is deployed to attract user funds,
which can then be spent using the EOA key for the same address.

tldr is that it's possible for an attacker to do, even if it would cost a lot of money, but the EIP-3607 is already implemented and theoretically mitigates that possibility

3
  • Thanks for the reply. I presume 2**80 gives you a 50% chance to deploy your contract to the same address? How do they get to a value of 10 billion USD that it would cost to do so?
    – FreddyC
    Oct 27, 2022 at 8:03
  • Any idea @OlivierD?
    – FreddyC
    Dec 4, 2022 at 20:13
  • 1
    Well since we are talking about power of and exponents here, 50% change would be 2^159. So here, 2^80 is 12089 2581961462 9174706176. So each compute, you have 1 chance out of 12089 2581961462 9174706176 to have a collision. But with a powerful computer making, let's say, 10 billions compute a seconde, you could eventually get a collision (even if it would take time and cost 10 billions USD). Not a PhD in math so don't quote me here Dec 6, 2022 at 9:49

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.