DEV Community

Cover image for HardHat w/ Contracts

Posted on

HardHat w/ Contracts

Greetings to everyone,
So to start the month of Feb off right, I had started using the framework called HardHat. It is great for testing and deploying smart contracts so I had to take a look into it further. While investigating the framework, I found myself taking a liking to it more so than Truffle which took me by surprise. While Truffle has been the leading framework of use when handling smart contracts, it seems many are going with the framework as well. Today I wanted to discuss a few features of HardHat in hopes that it gives a greater insight to the nice product.

Created by Nomic Labs, Hardhat helps developers manage and automate the common tasks of the process of building smart contracts. The focus is mainly on the solidity debugging and comes built-in with Hardhat Network. It's a local Ethereum network for development and a CLI to interact with the core functionalities. What makes this phenomenal is that HH has a local blockchain built inside while Truffle uses ganache. Found this to be a easier way of testing providing much feedback of the contract written in the CLI. While taking a browse at the documentation, I found that it is quite clear like Truffle. Guess the docs made in the blockchain framework space was major focus unlike traditional frameworks. The community of Hardhat isn't as big as Truffle, however it is growing. Discord server is created by Hardhat to find many topics on different channel. Not to speak too long, here's a list of things I gathered that were great in my book.

Hardhat Key Features

  • Run Solidity locally, testnet and mainnet
  • debug first framework
  • 12 word phrases can be created
  • TypeScript support
  • Preferred over Truffle
  • Local node of blockchain
  • Designed as a library
  • Multi solidity versions in one contract can be used.
  • connect a dApp project to the Hardhat network or others.
  • use javascript - console.log for writing messages within Solidity language

Discussion (0)