Hardhat: Reducing Smart Contract Size

In this tutorial, youโ€™ll discover how to analyze and minimize the size of your smart contracts using Hardhat and the Hardhat Contract Sizer plugin.

Goals

By the end of this tutorial, you will be able to:

- Use the Hardhat Contract Sizer plugin to evaluate contract size - Explain common techniques for keeping contract size within limits - Understand how inheritance affects the compiled bytecode size - Identify how external contract references contribute to overall bytecode - Assess how the use of libraries influences contract size - Evaluate the role of the Solidity optimizer in reducing bytecode size

Overview

In the Ethereum and broader blockchain ecosystem, minimizing smart contract size is essential. Smaller contracts require less gas to deploy and execute, resulting in lower costs for users. Thankfully, Hardhat offers the hardhat-contract-sizer plugin, a useful tool for analyzing and optimizing your smart contract sizes efficiently.

Last updated