Skip to main content

Set up a development environment for Etherlink

Etherlink is 100% compatible with Ethereum technology, which means that you can use any Ethereum-compatible tool for development, including Hardhat, Foundry, Truffle Suite, and Remix IDE. For more information on tools that work with Etherlink, see Developer toolkits in the Etherlink documentation.

In this tutorial, you use Hardhat to manage development tasks such as compiling and testing smart contracts. You also use Viem, which is a lightweight, type-safe Ethereum library for JavaScript/TypeScript. It provides low-level, efficient blockchain interactions with minimal abstraction.

  1. Install npm.

  2. Initialize an Node project with NPM:

    npm init -y
    npm install -D typescript @types/node ts-node
  3. Install Hardhat and initialize it:

    npm install -D hardhat
    npx hardhat init
  4. In the Hardhat prompts, select Create a TypeScript project (with Viem).

  5. At the prompt Do you want to install this sample project's dependencies with npm (@nomicfoundation/hardhat-toolbox-viem)? (Y/n) select Y.

  6. Install @openzeppelin/contracts to use the Math library for safe calculations:

    npm i @openzeppelin/contracts
  7. Install dev libraries for verifying your smart contract:

    npm i -D @nomicfoundation/hardhat-verify

    Verify is a feature that verifies contracts on an Ethereum block explorer by checking the compiled code against the source code. Verifying your contracts provides source code transparency and a source reference for some tools to generate utility code.

  8. (Optional) If you are using VsCode for development, install the Hardhat/Solidity plugin from Nomic: Solidity plugin for VsCode

arrow icon

Prev

Introduction

Next

arrow icon
Create a smart contract