Using the Hardhat 3 plugin template
This guide shows you how to use the official GitHub template repository to build your own Hardhat 3 plugin. The template includes all the boilerplate needed for a new plugin.
Prerequisites
Section titled “Prerequisites”To use the template, you’ll need Node.js 22+ and pnpm installed on your machine.
Using the template repository
Section titled “Using the template repository”To create a new repository based on the template, click here and follow the instructions on GitHub.
Then, clone your new repository to your local machine.
Understanding your new repository
Section titled “Understanding your new repository”The repository you just created is structured as a pnpm monorepo with the following packages:
packages/plugin: The plugin itself, including the plugin boilerplate.packages/example-project: An example Hardhat 3 project that uses the plugin.
You’ll do all development in the packages/plugin directory, while packages/example-project is a playground to experiment with your plugin and manually test it.
To learn how to write automated tests for your plugin, read this guide.
Trying out your plugin
Section titled “Trying out your plugin”Before changing anything, let’s test the boilerplate plugin.
pnpm installpnpm buildTry the plugin out in packages/example-project with:
cd packages/example-projectpnpm hardhat my-taskThis should print Hola, Hardhat!.
Learn more
Section titled “Learn more”Learn more about the Hardhat 3 plugin template’s setup by reading its README.md.