Deployed: https://rinkeby.etherscan.io/address/0x121e370ae349425d0d744f6db43c2f43e777f972#code

pragma solidity 0.8.3;

contract Test {
    uint256 public a;
    constructor (uint256 _a) public {
        a = _a;

contract DeployTest {
    function deploy(bytes32 _salt, uint256 param) public {
        new Test{salt: _salt}(param);

Transaction 1

Transaction 2

I was expecting that the new deployment will override the old one?

I was looking at this article: https://hackernoon.com/using-ethereums-create2-nw2137q7

In Solidity assembly, create2() takes 4 parameters: 1: The amount of wei to send to the new contract as msg.value. This is 0 for this example. 2–3: The location of the bytecode in memory 4: The salt — that we will calculate in step 3. We leave this as a parameter so it can we provided after we have calculated it.

I'm not using assembly. I'm using Solidity code and constructor parameters.

I will do some more experiments but maybe you'll know - can I override the existing contract if I use the same salt but different constructor parameters?

3 Answers 3


No it's impossible to override an existing contract in Ethereum. From EIP-684:

If a contract creation is attempted, due to either a creation transaction or the CREATE (or future CREATE2) opcode, and the destination address already has either nonzero nonce, or nonempty code, then the creation throws immediately, with exactly the same behavior as would arise if the first byte in the init code were an invalid opcode. This applies retroactively starting from genesis.

  • Hi Mars, I normally don't do this, but if you've found this answer helpful, when you are back could you please upvote and accept it?
    – eth
    Commented Nov 18, 2023 at 2:15

Yes, it is possible to replace the contract either by calling SEFLDESTRUCT and using CREATE2 or using an upgradable pattern such as the one from open zeppelin:

Whenever you deploy a new contract using deployProxy in the OpenZeppelin Upgrades Plugins, that contract instance can be upgraded later. By default, only the address that originally deployed the contract has the rights to upgrade it.





Replying to Cesar's message, yes right it may be possible to redeploy to the same address. This is how the Tornado Cash DAO hack happened. However, please note that SELF DESTRUCT will finally be disabled in EIP 4758, that is to be included Cancun Hardfork EIP 4758: https://ethereum-magicians.org/t/eip-4758-deactivate-selfdestruct/8710/23

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.