Installing and Configuring the Hardhat Contract Sizer Plugin

The Hardhat Contract Sizer is a plugin developed by the community that helps you measure the size of your smart contracts by displaying their compiled bytecode size directly in the terminal. This is particularly useful during development, as it allows you to quickly spot contracts that may exceed the permitted size limit.

Keep in mind that, on the Ethereum mainnet, the maximum allowed size for a deployed smart contract is 24 KiB (24,576 bytes). Exceeding this limit will cause deployment to fail.

To install the plugin, run the following command:

npm install --save-dev hardhat-contract-sizer

Next, import the plugin in your hardhat.config.js file:

require("hardhat-contract-sizer");

Last updated