Lesson 6 redeploying same contract to Goerli produces different contract address each time #2294
-
Deploying the same code over and over again on testnet I expected it to deploy into the same contract address (and thus throw some error saying something like contract already exists) but I get a new contract address each time. Is this because each transaction that deploys the code is different, something like the nounce incrementing each time changes the hashed address outcome? If so, the section of the code that verifies the contract source code returns "Already verified" which I was not expecting given the new contract address. This outcome was a bit unexpected to me. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
@AbrahamoLincolni : Contract once its deployed it cannot be altered or changed its Immutable. And Every time you deployed your contract it will give you a unique contract address. And about verification, If you are not making any changes to your contract and deploying unchanged contract over and over again, In your verification bit you will get this message because your contract byte code is already been verified once, so it is available on etherscan and also a 100% match, so it will instantly verifies your contract, so thats how you are getting that message. Though deployed contract address each time will be different and unique! But If you make some changes in your contract, It will have to verify again because now that byte code will not be available on etherscan. Hopefully, It will clear your doubt! |
Beta Was this translation helpful? Give feedback.
-
No, you are confused w/ deployment vs verification. Every time we deploy a contract, the address will be different (as it is a different txn altogether). But when we are verifying the contract, we have a conditional in our code to account for if if it is already verified (as contract addresses do not change against time, i.e. they remain the same). |
Beta Was this translation helpful? Give feedback.
@AbrahamoLincolni : Contract once its deployed it cannot be altered or changed its Immutable.
And Every time you deployed your contract it will give you a unique contract address.
And about verification, If you are not making any changes to your contract and deploying unchanged contract over and over again,
In your verification bit you will get this message
Already Verified!
because your contract byte code is already been verified once, so it is available on etherscan and also a 100% match, so it will instantly verifies your contract, so thats how you are getting that message.
Though deployed contract address each time will be different and unique!
But If you make some changes in your con…