Hardhat

Setting Up a Hardhat OraichainEVM Local Development Environment

Hardhat is a comprehensive Ethereum development environment that enables you to compile, deploy, test, and debug your Solidity code, also supporting EVM-compatible blockchains.

Install Dependencies

To get started, ensure you have Node.js installed, then initialize a new project and install Hardhat:

mkdir oraichain-evm-hardhat
cd oraichain-evm-hardhat
npm init -y
npm install --save-dev hardhat

Initialize Hardhat

Create a basic Hardhat project setup:

npx hardhat

Choose "Create a basic sample project" and proceed with the prompts.

For now, let’s check what the default template looks like:

tree . -d -L 1
.
├── lib
├── script
├── src
└── test

5 directories

Open contracts/Lock.sol with the following contract:

Configure the OraichainEVM Network

Modify hardhat.config.js to add the OraichainEVM network configuration:

Compile Contracts

Compile your Solidity contracts using:

Deploy Contracts

Deploy your contract with a Hardhat script. Create scripts/deploy.js:

Run the deployment script:

Run Tests

Run tests using Hardhat's testing environment:

Execute Scripts

You can further execute custom scripts for interaction with your contracts similarly by specifying the network:

Hardhat provides flexibility and robust tooling for your Solidity dApp development on EVM-compatible chains like OraichainEVM.

Last updated

Was this helpful?