6296 Donnelly Plaza
Hardhat Toolbox, part of the Hardhat 2.10 release, is an updated way to start building projects on Ethereum.
Hardhat Toolbox is an opinionated project starter with minimal boilerplate code and most of the functionality you’ll need already wrapped up into a single package. You’ll no longer need to install and configure the most widely used Hardhat plugins.
Since its launch in 2018, Hardhat was built on the core values of optionality, flexibility, and extensibility. This approach gave developers a modular approach allowing them to choose exactly the tooling functionality that they needed.
As the Ethereum and Hardhat development ecosystems have matured, the developer stack has increased in complexity. So many different options pose a challenge to navigate.
Along the way, Hardhat has grown into one of the top development environments for Ethereum developers, with dozens of community plugins to extend their setup as needed.
The new Hardhat Toolbox experience provides a complete and opinionated experience built on the existing Hardhat platform. Developers have the ability to customize it to meet the needs of their project, opt-out from the default setup, or just start from scratch.
Hardhat Toolbox is a default bundle of the most popular plugins the Hardhat developers, Nomic Foundation, consider to be the easiest way to get started with a new Ethereum project or any EVM compatible blockchain.
Hardhat Toolbox is backward compatible and is not required for new projects is not a requirement.
The Hardhat Toolbox built-in functionality lets developers:
Hardhat 2.10 includes the Hardhat Chai Matchers plugin, a drop-in replacement for hardhat-waffle. Chai matchers is a fork of Waffle that adds Ethereum-specific capabilities to the Chai assertion library with deep integration with Hardhat projects.
Your smart contract tests are easier to write and read with more features and better error messages. You can test that contracts fire certain events, exhibit a specific revert, or that a transaction results in specific changes to a wallet’s balance, and much more.
Installing the Hardhat Toolbox is as simple as installing the two NPM packages to get all of the functionality mentioned above:
$ npm install hardhat @nomicfoundation/hardhat-toolbox
With Yarn, you’ll need to add each of the required libraries. Also, running yarn hardhat will install everything you need to hit the ground running.
The hardhat-network-helpers library that provides utility functions to interact with the Hardhat Network. Say goodbye to having to encode parameters in hexadecimal and hard to understand Hardhat network errors.
Hardhat Network Helpers make low-level interactions with Hardhat’s custom JSON-RPC methods a thing of the past. Network Helpers provide convenience functions for quick and easy interaction with Hardhat Network.
// mine 100 blocks await network.provider.send("hardhat_mine", ["0x64"]); // mine a new block one hour in the future await network.provider.send( "evm_increaseTime", "0xe10" ); await network.provider.send("hardhat_mine"); // take and revert a snapshot const snapshotId = await network.provider.send("evm_snapshot"); await network.provider.send("evm_revert", [snapshotId]);
Using Hardhat Network Helpers:
const helpers = require("@nomicfoundation/hardhat-network-helpers"); await helpers.mine(100); await helpers.time.increase(3600); const snapshot = await helpers.takeSnapshot(); await snapshot.restore()
Along with the release of Hardhat 2.10, the documentation site has been revamped to reflect this new direction, migrating every section and guide towards using Hardhat Toolbox.
Hardhat 2.10 also introduces the first stable version of Hardhat for Visual Studio Code, a VSCode extension that adds language support for Solidity and provides editor integration for Hardhat projects.
While Hardhat 2.10 and the Hardhat Toolbox Ethereum development environment represent a new path going forward, developers still benefit from the power and flexibility that Hardhat provides and getting started is even faster and simpler.