Now its time to say Good Bye π to our good old friend Ropsten-Rinkeby. It is very important to shift your previous dapp to a new testnet in order to shill your projects in future .
This will be the fastest way of migrating your previous projects or dapps on the Mumbai or Goerli network. So without wasting any time , let me show you how you can do that :
Steps to follow :
- Move into the contract folder of your dapp
- Open your contracts folder in vs-code/yourFavTextEditor and copy all the content of the
Contract.sol
file.
Now open Remix IDE and create new file by clicking here. Name it anything you want and paste all the content of the
Contract.sol
file.After pasting all the content type
CTRL + S
for compiling the contract.
- After hitting
CTRL+S
you will see a green tick like this . If not then copy paste your contract again until a green tick appears like this. If it is appearing then you are good to go.
Now its time to click on the
Deploy and Run Transactions
tab . (yellow)Now click on the drop down menu and select the
Injected Provider - Metamask
option .Now metamask will popup and you will have to change your network on the
polygon testnet
orgoerli testnet
according to your preference .
- Now click on the
DEPLOY
button . Provide any arguments if it asks for any. In my case there is no argument .
(Make sure you are deploying the right contract π)
- After clicking deploy , the metamask will popup , just confirm the transactionπ. After confirming you will scroll down and will see your contract is deployed π.
- Click as shown in the image to copy your contract address and move back into your frontend files and update the contract address as shown .
PROBABILITY : Usually contract address
and contract ABI
is stored in the Constants
folder's index.js or constants.js
file .
Congratulations π₯³ππ Your dapp is now shifted to the polygon/goerli network.
Additional things you can do .
Some of the additional things that you can do is change your hardhat.config
file , So if someone wants to use your dapp in future , he can do that as well.
For that you have to change 2 things
Network : Change your network to
goerli
ormumbai
RPC Url : Change the RPC URL to
https://rpc.ankr.com/eth_goerli
forGoerli
network orhttps://rpc.ankr.com/polygon_mumbai
for the polygon'smumbai
network.
In my case I am deploying it to the polygon network so I will use the polygon RPC url.
And that's it for this blog . Do share it with the fellow developers . π¨βπ»π©βπ»π¨βπ»