The Ethereum Merge: What it Means for Developers

The Ethereum Merge: What it Means for Developers

Aditya Singh's photo
Aditya Singh
ยทSep 26, 2022ยท

4 min read

Play this article

The Ethereum merge has succeeded! Ethereum has moved from Proof of Work to the Proof of Stake consensus mechanism. Let's talk about what it means for developers.

The New Testnets

The Kiln, Rinkeby, and Ropsten testnets are now being deprecated.

Deprecation Timeline:

  • Kiln - Deprecated,
  • Ropsten - Q4 2022,
  • Rinkeby - Q2/Q3 2023

Goerli & Sepolia: The two testnets that client developers will maintain post-merge.

Ethereum developers recommend Sepolia for users and developers who want a lightweight chain to sync to and interact with. Goerli is recommended for stakers to test protocol upgrades and developers who want to interact with a large existing state.

Sepolia Characteristics

  • Closed validator set, controlled by client & testing teams.
  • New testnet, fewer applications deployed than other testnets.
  • Fast to sync and running a node requires minimal disk space.

Follow this guide to setup Sepolia:

learn.block6.tech/sepolia-testnet-cfe6623f0..

Steps to deploying on Sepolia:

  1. Initialising the project.
mkdir hardhat-add && cd hardhat-add

npm init -y && npm install --save-dev hardhat dotenv @nomiclabs/hardhat-ethers && npx hardhat

The terminal output should show something like:

888    888                      888 888               888
888    888                      888 888               888
888    888                      888 888               888
8888888888  8888b.  888d888 .d88888 88888b.   8888b.  888888
888    888     "88b 888P"  d88" 888 888 "88b     "88b 888
888    888 .d888888 888    888  888 888  888 .d888888 888
888    888 888  888 888    Y88b 888 888  888 888  888 Y88b.
888    888 "Y888888 888     "Y88888 888  888 "Y888888  "Y888

๐Ÿ‘ท Welcome to Hardhat v2.11.2 ๐Ÿ‘ทโ€

? What do you want to do? โ€ฆ 
โฏ Create a JavaScript project
  Create a TypeScript project
  Create an empty hardhat.config.js
  Quit

Choose Create an empty hardhat.config.js

Generate source files:

mkdir contracts && mkdir scripts

touch contracts/Add.sol && touch scripts/deploy.js

Create a simple, smart contract in Add.sol file:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

contract Add {
    function add(uint256 a, uint256 b) public pure returns (uint256) {
        return a + b;
    }
}

Create a simple deploy script in deploy.js file:

const hre = require("hardhat");

async function main() {

  const Add = await hre.ethers.getContractFactory("Add");
  const add = await Add.deploy();

  await add.deployed();

  console.log(
    `Add deployed to ${add.address}`
  );
}

main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});

Environment variables setup:

touch .env

Open the .env file and enter:

SEPOLIA_URL=https://rpc.sepolia.org
PRIVATE_KEY="YOUR_ACCOUNTS_PRIVATE_KEY"

Modify the hardhat.config.js file to:

require("dotenv").config();
require("@nomiclabs/hardhat-ethers");

const { SEPOLIA_URL, PRIVATE_KEY } = process.env;

module.exports = {
  solidity: "0.8.9",
  defaultNetwork: "sepolia",
  networks: {
    hardhat: {},
    sepolia: {
      url: SEPOLIA_URL,
      accounts: [`0x${PRIVATE_KEY}`],
    },
  },
};

Compile the Add.sol file with:

npx hardhat compile

You should see:


We have compiled 1 Solidity file successfully.

Deploy the contact with:

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

You should see something like:

Add deployed to 0x1d1C7871a99527A06d0140b04f7e44E3Aff4c20D
// address will be different //

Go to sepolia.etherscan.io and search with your wallet account address.

screencapture-sepolia-etherscan-io-address-0xfa2efbb691d49bb687c908785bf08a581d8b0040-2022-09-22-21_00_19.png

Click Contract Creation

screencapture-sepolia-etherscan-io-address-0x1d1c7871a99527a06d0140b04f7e44e3aff4c20d-2022-09-22-20_51_53.png

Click the contract tab and then click "Verify and Publish."

After filling out a short form, your contract should be published on the testnet blockchain.

Goerli Characteristics

  • Open validator set; stakers can test network upgrades.
  • Large state for testing complex smart contract interactions.
  • Longer to sync and requires more storage to run a node.

To get goerliETH, follow these links:

medium.com/@ethvalidator/a-quick-guide-on-h..

goerlifaucet.com

You'll also need an Alchemy account:

dashboard.alchemy.com

Steps to deploying on Goerli:

Modify the .env file to:

SEPOLIA_URL=https://rpc.sepolia.org
GOERLI_URL=https://eth-goerli.g.alchemy.com/v2/NiATSzYny1Oy-6sqLiBqo7KZIitQHIh9
PRIVATE_KEY="YOUR_ACCOUNTS_PRIVATE_KEY"

Your goerli url may be different according to your dashboard.

Modify the hardhat.config.js file to:

require("dotenv").config();
require("@nomiclabs/hardhat-ethers");

const { SEPOLIA_URL, GOERLI_URL, PRIVATE_KEY } = process.env;

module.exports = {
  solidity: "0.8.9",
  defaultNetwork: "sepolia",
  networks: {
    hardhat: {},
    sepolia: {
      url: SEPOLIA_URL,
      accounts: [`0x${PRIVATE_KEY}`],
    },
    goerli: {
      url: GOERLI_URL,
      accounts: [`0x${PRIVATE_KEY}`],
    },
  },
};

Deploy by running the command:

 npx hardhat run scripts/deploy.js --network goerli

The contract should now be deployed to the Goerli network, and you should be able to see it in etherscan.

The rest of the process remains the same as that of sepolia.

Testing Your Frontend Code and Tooling

Most applications on Ethereum involve much more than on-chain contracts. Now is the time to ensure that your front-end code, tooling, deployment pipeline, and other off-chain components work as intended.

Now is the time to run a complete testing & deployment cycle on Sepolia or Goerli and report any issues with tools or dependencies to those projects' maintainers.

You can raise an issue on this repository in case of uncertainties.

You don't have to do much.

The Ethereum developers designed the Merge to have only minimal impact on a subset of contracts deployed on Ethereum, none of which should be breaking. Most user API endpoints remain stable (unless you use proof-of-work specific methods such as eth_getWork).

ย 
Share this