DEV Community

Cover image for Hardhat vs Truffle: Which one is better for writing Smart Contracts?
Jennifer Bland
Jennifer Bland

Posted on

Hardhat vs Truffle: Which one is better for writing Smart Contracts?

With the rising interest and adoption of Web3, there has been an increased demand for developers that know how to write Smart Contracts. Most people who learn to write Smart Contracts will use Remix which is an online IDE. But an online IDE is not feasible for any size development team. You need a tool to be able to write Smart Contracts on your laptop. In this scenario you have two choices: HardHat or Truffle. Let's explore how they compare.

hardhat logo

Hardhat

Hardhat bills itself as the Ethereum development environment for professionals. It was created by the team at Nomic Labs. It facilitates performing frequent tasks, such as running tests, automatically checking code for mistakes or interacting with a smart contract.

truffle logo

Truffle

Truffle was created by Consensys. Consensys was behind the development of Metamask so it is a company that is very familiar with Web3.

Truffle was the first product available for creating Smart Contracts on your local computer. It seems though that more developers are utilizing HardHat based on adoption.

Benchmarks

To compare the two products, I have put together a list of benchmarks that I will use. Each product will be evaluated on each benchmark. I will pick a winner for each benchmark category.

Weekly Downloads

Weekly downloads is a measurement of how frequently an npm package is utilized. According to npm, Hardhat has 87, 168 weekly downloads. According to npm, Truffle has 35,952 weekly downloads.

Using this metric HardHat is a clear winner.

Winner - Hardhat

Issues

Another metric that npm tracks for packages is the number of issues that have been reported for a product. Generally an issue is opened when somebody has had a problem using the product. npm reports 436 issues with Hardhat. npm reports 469 issues with Truffle.

With the two numbers being very close you might consider this a toss-up between the two. But with less than 1/2 the usage of Hardhat, Truffle is reporting the same number of problems. This means there are many more issues reported per usage for Truffle.

Winner - Hardhat

Documentation

Both Hardhat and Truffle have very good documentation. Both provide clear documentation on how to install their product and how to get up and running with it.

I find the best way to learn how to use a new product is to actually dive in and start using. Good documentation will provide you with guides to help you start doing something with their product. Both Hardhat and Truffle provide guides but I think Hardhat provides more examples.

Winner - Tie

Ease of Use

This metric will always be subjective. I have used both products. From my perspective I feel that Hardhat is more responsive and completes tasks faster than they do with Truffle.

I have had more incidents of my development environment freezing when using Truffle that I have ever had with Hardhat.

Based on my first hand knowledge I prefer to use Hardhat.

Winner - Hardhat

Top comments (0)