Skip to content

Using a custom Solidity compiler

Hardhat supports custom compilers. To use them, you’ll need to manually download the compiler binary and reference it in the Solidity settings of your hardhat.config.ts file.

Configure the path to the custom compiler binary using the path property. You can use this property in both the simple and extended formats of the solidity property. For example, using the simple format:

hardhat.config.ts
import { defineConfig } from "hardhat/config";
export default defineConfig({
//...
solidity: {
version: "0.8.29",
path: "/path/to/compiler", // Replace with the actual path to the compiler
},
});

Or using the extended format:

hardhat.config.ts
import { defineConfig } from "hardhat/config";
export default defineConfig({
//...
solidity: {
compilers: [
{
version: "0.8.29",
path: "/path/to/compiler",
},
],
},
});