-2

If I deploy a contract in Test Net , Will it remain in the Test Net or I have to Deploy it VIA Test Net over and over to test The contract?

What I did, I deployed the contract In the Test Net and I can do deploy it over and over and it doesnot show any warning or something like "The Contract already exists". That is why I am confused, is it okay? To deploy the contract via Test Net over and over?

Gizmo
  • 3
  • 3

1 Answers1

0

It depends on how your test script is written. But a usual approach is to test contracts on an emulator (e.g. Ganache or Hardhat) - not a public testnet, and redeploy the contract before each test case.

Petr Hejda
  • 40,554
  • 8
  • 72
  • 100
  • How about the Remix IDE? with the Injected Web3 function? When I press deploy, it directly opens Metamask and I can deploy the contract to any type of Blockchain network. Is it a good way to deploy and test the contract? – Gizmo Apr 05 '22 at 03:16
  • @Gizmo Sure, it's a way to deploy it to a public testnet. My concern is that testnet funds are somewhat scarce, and the deployment and interaction with the testnet contract takes a bit of time. So instead, it seems to be just easier to start an emulated local network where you have more than enough funds and don't have to wait for a transaction to be mined because it's instant as well. – Petr Hejda Apr 05 '22 at 07:56