Follow

Follow
How to Migrate a DApp from Goerli to Sepolia Using QuickNode

How to Migrate a DApp from Goerli to Sepolia Using QuickNode

Aayush Gupta's photo
Aayush Gupta
ยทMay 3, 2023ยท

2 min read

Play this article

Table of contents

  • 1. Updating the RPC node
  • 2. Deploying the contract on the new chain
  • 3. Adjusting the frontend

In this tutorial, you will learn how to migrate your DApp from Goerli to Sepolia using QuickNode, a fast and reliable RPC node provider.

As you may know, the Goerli network has faced several issues recently, from the low availability of test funds to network downtime. Considering this, it makes perfect sense to take your testing from Goerli to Sepolia.

1. Updating the RPC node

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

Go to their RPC Endpoints Service section by clicking on this link and click on the "Create an endpoint" button.

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

Select the network, and click "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 this at hand, we can now replace the old Goerli RPC URL in our DApp with the new Sepolia RPC URL. Let's go!

I assume 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 must replace it with a new Sepolia RPC node.

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

2. Deploying the contract on the new chain

First, ensure 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

You will receive an updated contract address if everything works according to plan. If you added console.log in your deploy script, you would receive an output similar to this:

3. Adjusting the 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'.

Remember to push your code to GitHub, so all the world can see your fantastic 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!

ย 
Share this