Hardhat — the must have tool in web3 development

One of the most famous ethereum development environments is a Hardhat.

Hardhat — the must have tool in web3 development

One of the most famous ethereum development environments is a Hardhat.

It consists of different components for editing, compiling, debugging and deploying smart contracts and dApps. All of this parts, create together the very efficient environment.


Agenda:

  • intro,
  • Hardhat runner,
  • Hardhat network,
  • Hardhat for vscode,
  • Hardhat chai matchers,
  • Hardhat network helpers,
  • Conclusion.

Hardhat runner

Hardhat Runner is called, the main component for interaction with while using Hardhat. Easily said, It is a super efficient task runner, which helps managing and automating the tasks during the development of smart contracts and dApps.

To get started quickly, just install Hardhat from the command line, with command:

npm install — save-dev hardhat

Creating project is proceeded by:

npx hardhat

run in the project directory.

Runner allows to execute different tasks like:

  • Check,
  • Clean,
  • Compile,
  • Console,
  • Coverage,
  • Flatten,
  • Help,
  • Node,
  • Run,
  • Test,
  • Typechain,
  • Verify.

All mentioned tasks are simply run, by adequate command, for example compiling requires execution of:

npx hardhat compile

Remember, to get successful tasks executions, it is required to fulfill basic configuration of smart contracts and its file structure.


Hardhat network

Hardhat also provides local ethereum network node, designed to fulfill the demand of testing properly, how contracts behave after deployment.

Moreover, Hardhat network adds new block with each new transactions without delays.

What is more, it is backed by the ‘@ethereumjs/vm’

EVM implementation, the same one used by ganache, Remix and Ethereum Studio.


Hardhat for vscode

Hardhat is available as an extension for vscode, it supports solidity language and provides editor integration for Hardhat projects. There are also many features which will be added in the near future.


Hardhat chai matchers

Hardhat adds ethereum specific capabilities to the chai assertion library, what makes testing smart contracts easy to write and test.


Hardhat network helpers

Hardhat also provides a convenient JavaScript interface to the JSON-RPC functionality of Hardhat network. It allows to easy interaction with the ecosystem, by adding specific block with predefined values, manipulate balance of wallets, etc.


Conclusion

Hardhat used properly, can provide a lot of value to the decentralized project. As a very friendly ethereum environment, testing, compiling and deploying is done smoothly and very efficiently.

Tool like Hardhat should be taken under observation, by every new adept of web3.