Hardhat Ignition

Ethereum’s most sophisticated deployment solution yet, coming in 2022

Hardhat Ignition

Ethereum’s most sophisticated deployment solution yet, coming in 2022

Deploying smart contracts is a crucial step in the Ethereum development process, and it’s always been challenging to get right. Solutions with obvious limitations have been the norm, and it makes sense that it’s been this way. Investing months into building a sophisticated solution that’s only going to save at most a few days of work every so often is not a very attractive plan for many of the teams building on Ethereum. At Nomic Labs, we serve the Ethereum ecosystem’s needs, so this equation is inverted for us: working on deployments is a high leverage undertaking.

Hardhat Ignition is one of the projects that we have been working on in collaboration with Tenderly, who led the initial user research, and it’s progressed enough that we’re happy to tell you about it. It’s still under heavy development after going through multiple iterations, but we’re hoping to launch it by 2022.

Hardhat Ignition will be a deployment system for structuring, automating, and distributing smart contract deployment setups. It will help developers articulate and reliably execute the exact deployment result they’re looking for.

The deployment definition will be declarative, inspired by the dependency injection pattern and the infrastructure as code approach. Contract dependencies will be explicitly specified for each contract through code.

This approach leads to a deployment setup being code that describes initialization and relationships across your contracts — without dealing with sending transactions.

When it comes to execution, Hardhat Ignition will offer a series of features to facilitate and smooth out the often complex process of contract deployment. Some of these will be:

  • Managing multiple deployment environments with different setups.
  • Automated retry and resume mechanisms.
  • Automated gas cost optimization.
  • Transaction batching and parallelization for faster deployments.
  • Tracking of deployed addresses.
  • Automation of contract initialization procedures.

It’s the kind of polish that doesn’t make sense for protocol engineering teams to build in their deployment solutions but that everyone would love to have.

In combination, these features provide the infrastructure needed to confidently and reliably run deployment processes that take a long time without needing to start from scratch somewhere during the process because something went wrong.

Hardhat Ignition is designed around the concepts of contract bindings and modules. A binding will be a definition for how to instantiate a given contract. A module will be a collection of bindings, and a module can contain other modules. Thus, when you execute a deployment you’ll be deploying a module.

The API will probably change by the time it launches, but for illustrative purposes, this is what the most basic module definition will look like:import { buildModule, ModuleBuilder } from '@hardhat/ignition';export const GreeterModule = buildModule(
'GreeterModule',
async (m: ModuleBuilder) => {
const Greeter = m.contract('Greeter', 'Hola mundo!');
}
);

Then npx hardhat deploy and voilà. While this is very simple, the full API supports the structuring of deployments for any smart contract system, regardless of its size or complexity.

For a more realistic view of what this might look like for an actual project, here are internal modules for Tornado Cash, which are simple, and Synthetix, which are a lot more elaborated. These APIs are for internal and illustrative purposes only and will certainly change.

In our post outlining the key directions in which Ethereum’s developer experience needs to improve, we highlighted contract integrations as one of them. A very significant portion of the ecosystem’s engineering effort goes into building integrations, and Hardhat Ignition is meant to hit multiple developer experience birds with one rock.

Deployments are hard and a better solution will bring a lot of value to everyone, but programmatic deployments will unlock a lot more value than simply better deploying.

The modules in a Hardhat Ignition setup will be trivial to package, distribute, and run through a programmatic API, making it easier to provide infrastructure for protocol integrators.

As an example, a protocol like Balancer could distribute its production modules in a Hardhat plugin that also comes with predefined state scenarios for testing. This would allow developers who are integrating Balancer’s protocol to deploy a local instance, populate it with the exact scenario they need to test their integration case and go back to focusing on what they care about: testing their own code.

We’re very excited about this upcoming launch, and we’re looking forward to your thoughts about it on Twitter!