0

I have already deployed my smart contract on Ropsten network for testing using truffle suite. The command line I used was:

truffle deploy --network ropsten

Now, I have made some changes to my contract and again want to deploy it for testing. Do I just run the above command once again or is there some other way where we first destruct the existing contract and then redeploy it?

Thanks.

  • For testing - why would you need to destroy the previously deployed contract? – goodvibration Jan 18 at 11:52
  • Side note - you might wanna start your tests on something like ganache before jumping to something like ropsten. Public test nets are designated for advanced testing, after having thoroughly verified each one of your contracts as well as the entire system (i.e., interactions between your contracts). In other words, you should very rarely reach a point where you need to redeploy a contract. – goodvibration Jan 18 at 11:55
0

There's no way to destroy contracts in general. They can be set to self destruct if such functionality is codes in then but this is quite rare. Normally old contracts just stay where they are and people just stop using them.

If you issue the same deploy command again you will get a new contract at a new address. There's no harm in doing it this way. Except of course if you work in the main net then you actually have to pay real Ethers for the transaction.

Truffle includes functionality called migrations which basically reduces the need to redeploy contracts if there are no changes. But this is mostly useful for bigger projects which have multiple contracts to deploy.

| improve this answer | |
  • thanks for explaining this :) – Tanay Bhartia Jan 18 at 16:11

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.