How To Migrate Dapp from Goerli to Sepolia using QuickNode

How To Migrate Dapp from Goerli to Sepolia using QuickNode

In this tutorial, we will learn how to migrate your dapp from Goerli to Sepolia using QuickNode. QuickNode is the fastest and most reliable RPC Node Provider. As you may know, the Goerli network has faced several issues recently, starting from the low availability of test funds to network downtime. Considering this, it makes perfect sense to take your testing from Goerli to Sepolia.

Steps Involve in Migrating

  1. Update the RPC Node

  2. Re-Deploy the Smart Contract

  3. Make adjustments in frontend

1. Update the RPC Node

The first task for migrating your dapp is to get the RPC node of the new test network. For our example, we will be using the Sepolia test network, and we will use QuickNode as the node provider.

Go to their RPC Endpoints Service section by clicking on this link

  • Click on the Create an endpoint Button.

  • Select the chain. In our case, we will be selecting Ethereum.

  • Select the network, and click on continue.

  • Click on the Create endpoint button.

  • Go to the HTTP Provider and copy the RPC URL.

That's it. You now have the RPC node. With the RPC node in hand, we can now replace the old Goerli RPC URL in our dapp with the new Sepolia RPC URL. Let's go!

I am assuming that you are using Hardhat as your Solidity development framework. If you are following any quality tutorial or documentation, you most likely store your RPC Key in a .env file. In this case, you will need to replace it with a new Sepolia RPC node.

Now in your hardhat.config.js file. replace goerli with sepolia inside the networks and etherscan sections.

2. Re-Deploy the Smart Contract

First, make sure that you have some test ETH in your wallet, which you will use to deploy the smart contract. You can obtain some test ETH using the Sepolia Faucet.

Run the command to deploy your smart contract.

yarn hardhat run scripts/deploy.js --network sepolia

If everything works according to plan, you will receive an updated Contract Address. If you added console.log in your deploy script (which you should), you will receive an output similar to this:

3. Make adjustments in frontend

Update your smart contract address in your Frontend folder or index file.

Set the chainId to 11155111, as in chainId == 11155111, and replace the word 'Goerli' with 'Sepolia'.

Don't forget to push your code to GitHub so all the world can see your amazing work.

I hope you learned something new and solved the problem. Thanks for reading. Have fun!

You can follow me on Twitter, GitHub and Linkedin. Keep your suggestions and comments coming!

Did you find this article valuable?

Support Aayush Gupta by becoming a sponsor. Any amount is appreciated!