blockchainethereumsolidityevm

Can CREATE2 be used to simulate the nonce in CREATE?


Let's say there is a contract deployed on BSC, using CREATE, with a high tx nonce - for example 100. Now I need to deploy a contract to the same address on another network (ETH mainnet). Is there a way to match the address of the first contract, using CREATE2? Or is the only way to achieve this, to send 99 transactions on ETH (which can be expensive), to match the account's nonce with what it was on BSC at the moment of deployment of the original contract?

If that's not possible, maybe there's an easier (and cheaper) way to get the account to nonce 99 than sending 99 empty transactions?

The reason I need to do this, is I need to recover some ETH accidentally sent to that address by one of the users.


Solution

  • Theoretically, you could try to find a collision by providing a specific salt value that, combined with other params (deployer address and contract bytecode), results in the same contract address. But practically, that's impossible to find because of too many possible salt values.

    So the simple answer is - no. You'll have to send the 99 transactions on the other chain to reach the same nonce. Or forgo this deposit if it's not worth the transaction fees.