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.
-
Initialize an Node project with NPM:
npm init -y
npm install -D typescript @types/node ts-node -
Install Hardhat and initialize it:
npm install -D hardhat
npx hardhat init -
In the Hardhat prompts, select
Create a TypeScript project (with Viem)
. -
At the prompt
Do you want to install this sample project's dependencies with npm (@nomicfoundation/hardhat-toolbox-viem)? (Y/n)
selectY
. -
Install
@openzeppelin/contracts
to use the Math library for safe calculations:npm i @openzeppelin/contracts
-
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.
-
(Optional) If you are using VsCode for development, install the Hardhat/Solidity plugin from Nomic: Solidity plugin for VsCode