Introducing Hardhat Ignition: A refreshed deployments experience
Navigating the headaches of deployment execution is now a thing of the past
Navigating the headaches of deployment execution is now a thing of the past
What is Hardhat Ignition?
Hardhat Ignition is a declarative system for deploying smart contracts on Ethereum. It enables you to define smart contract instances you want to deploy, and any operation you want to run on them. By taking over the deployment and execution, Hardhat Ignition lets you focus on your project instead of getting caught up in the deployment execution details. It’s a better end-to-end deployment experience.
Why should I use it?
Hardhat Ignition solves many pain points related to the development, execution, and maintenance of deployment code. The main ones are:
- Boilerplate: Ad hoc deployment code frequently requires managing execution details rather than focusing solely on your deployment.
- Execution Unreliability: Complications like gas spikes, dropped transactions, and accidental nonce reuse make current deployment solutions unpredictable. Handling every failure scenario in ad-hoc code is impractical, and existing deployment solutions often don’t handle these either.
- Partial Deployment Recovery: Recovering from a halted partial deployment often demands on-the-fly code modifications during execution.
- Execution Adjustments: Changing the way your deployments and operations are executed can require costly modifications to your deployment code. An example is operating your contracts with an EOA initially, and later transitioning to a multisig after being in production for some time.
- Deployment Modifications: Upgrades or component additions to a live system require new ad-hoc deployment code.
A refreshed deployment experience
Hardhat Ignition comes with many features that improve the deployment developer experience across the board. Some of our favorite features are:
- Declarative Deployments: You describe what you want to deploy, and Hardhat Ignition takes care of the rest. Every network error edge case is handled for you. Zero boilerplate code.
- Recovery Capability: If a deployment halts, adjust your module and continue. Ignition resumes from the interruption point. No hacky adaptations of ad-hoc deployment code to be able to continue.
- Flexible Execution Strategies: Describe your contract action (call, deploy, etc), then separately choose the execution strategy. Whether it’s an EOA, CREATE2, a multisig, or a different contract, you can change execution characteristics without modifying your action definition. The code that worked to call a contract from an EOA will keep working when it runs through a smart contract wallet. This will be available in an upcoming release.
- Incremental Module Updates: Update a deployed module and rerun. Hardhat Ignition automatically integrates new components without redeploying existing ones.
- Gas Fee Management: Automatic adjustments of gas fees during deployment, ensuring transactions are confirmed even during unexpected price surges.
- Transaction Parallelization: Speed up deployment by analyzing your system’s dependency graph and batching independent transactions for simultaneous execution.
- Deployment Plan Visualization: Build a clear understanding of your deployment process with the visualization report.
Hardhat Ignition simplifies Ethereum contract deployments while enhancing execution resilience, adaptability, and effectiveness.
Describing a deployment
The most fundamental aspect of using Hardhat Ignition is writing deployment modules. Below, we have a simple module defining a SaturnV
contract instance that depends on the LunarExplorationModule
contract, which we'll provide as an argument to call to SaturnV.load
after the contracts have been deployed.
Deploying a module
As we execute the deployment for the module above, we can appreciate how Hardhat Ignition batches operations and executes steps in a parallel fashion.
Extending a deployment
If a completed deployment requires changes, whether to modify the state with calls or to introduce new components, you don’t have to write additional integration code. Simply adjust the modules and rerun the deployment. Hardhat Ignition takes over from there. In the following example, we add a SaturnV.launch
call to our previously deployed module.
Recovering from interruptions
Teams with experience managing smart contract systems in production are familiar with the real-world scenarios one can face: nodes may go down, infrastructure providers might suffer outages, and connectivity can be unreliable, among others. Hardhat Ignition considers these scenarios as within expectations and is able to resume a deployment that got interrupted.
Roadmap
We’re launching a feature-rich release, but there’s a long list ahead of us to keep improving Ethereum deployments. The next priorities we’re going to be working on are:
- Better TypeChain support
- CREATE2 support
- Better ABI validation
- Viem support, in addition to ethers v6
- Wagmi integration
- Smaller deployment artifacts
Follow this issue on Github to stay tuned to the next major release.
Check it out
We’d love to hear your feedback, so give it a try! Here are some useful links:
If you like it, please star the repo on Github, and let us know what you think!