# hardhat-starter-kit: Chainlink feeds, VRF and Automation on Hardhat

> The Chainlink Hardhat starter kit is boilerplate for testing, deploying and shipping Chainlink Solidity code, with the three classic features wired up, Price Feeds, VRF and Automation, plus local mocks, a staging test suite, coverage, linting and a fuzzing container. The README's first line warns that this branch is the Hardhat 2 kit and that Hardhat 3 lives elsewhere.

**smartcontractkit/hardhat-starter-kit** — A repo for boilerplate code for testing, deploying, and shipping chainlink solidity code. 

- Repository: https://github.com/smartcontractkit/hardhat-starter-kit
- Stars: 1,277 · Forks: 509
- Language: JavaScript
- License: NOASSERTION
- Published: 2026-10-19 · Updated: 2026-10-19 · Language: en
- Canonical page: https://hysenlabs.com/projects/smartcontractkit-hardhat-starter-kit

## Three Chainlink features, and the two that live elsewhere

The starter kit implements three Chainlink features on the Hardhat development environment: Chainlink Price Feeds, Chainlink VRF, and Chainlink Automation. The README says it plainly, and that is the entire scope.

The two newer products are pointed elsewhere, and the README is careful to say so. For Chainlink Functions there is a separate Hardhat starter kit, with a Foundry version coming soon. For Chainlink CCIP, the Cross Chain Interoperability Protocol, there are separate Hardhat and Foundry starter kits.

That division is a fair reflection of how Chainlink's own surface has grown, and it matters for a reader deciding which repository to start from. A contract that consumes a price feed, requests a random number or registers an upkeep is served here. A contract that calls an off-chain function or sends a message across chains is not.

The tip at the top of the README is also about this kind of drift. Chainlink Any API is removed from this starter kit, because it has been replaced by Chainlink Functions, and the README points at the Functions starter kit instead. The kit is therefore pinned to a particular generation of Chainlink's products, and the version of the contracts package in the dependencies decides which generation.

## The branch warning, and the remapping that goes with it

The very first block of the README is an important note. This branch contains the Hardhat 2 starter kit, and for Hardhat 3 there is a separate branch, which is linked. This branch uses Solidity remapping and the hardhat-preprocessor plugin to resolve imports correctly, and the README says that if you have errors when compiling dependencies you should consult the Remapping section.

That is a specific and common failure. When a Solidity project depends on a package that itself imports files, the compiler needs to be told where those files live, and the usual mechanism is a remapping file. The hardhat-preprocessor plugin exists to apply that remapping to dependency imports as well as to your own code, which is what stops a dependency failing to resolve its own internal paths.

The README treats this as a first-class concern, and the repository backs it up: there is a remappings.txt file at the root and a remappings-helper.js alongside it, and the Remapping section of the README is called out in the table of contents.

The other version split is the TypeScript one. The README's Typescript section is two lines long, and it is a branch switch rather than a configuration flag, which is a simpler and more robust approach than a build matrix, at the cost of a separate copy of the project.

## Getting it running, and the test that proves it

The requirements section lists git, Node.js and Yarn, with a check for each, and it is unusual in being explicit that Yarn is preferred over npm, while still noting that npx and npm work fine if you prefer them. The quickstart then reduces to a clone, an install, and a test.

```bash
git clone https://github.com/smartcontractkit/hardhat-starter-kit/
cd hardhat-starter-kit
```

The install step has a wrinkle worth knowing. The recommendation is to use npm 7 or later, and with an older npm you also need to install the packages the toolbox normally brings in, which the README spells out as a long npm install --save-dev line covering the toolbox, the network helpers, the chai matchers, the ethers and etherscan plugins, chai, ethers, the gas reporter, solidity-coverage and the typechain packages. The yarn equivalent is given as well, since the requirement list mentions Yarn.

And then the test:

```bash
npx hardhat test
```

which is also available as npm run test or yarn test.

The scripts in the package.json show the shape of the project. Compile is hardhat compile, test is hardhat test test/unit/*.spec.js, and test-staging is the same idea against the staging directory with the sepolia network, so the staging tests are separated from the unit tests by directory rather than by a flag. The package name is hardhat-starter-kit at version 2.1.1, and the runtime dependency list is short, with dotenv as the only production dependency and everything else a dev dependency.

## Local network, mock contracts and the deployment script

The usage section starts with a hint that is worth following literally. If you run npx hardhat --help you get the list of tasks the environment provides, and that is the fastest way to learn what the kit actually offers.

Deploying is one command:

```bash
npm run deploy
```

which runs hardhat run scripts/deployment/main.js, deploys the contracts to a local network, and, if you are on a local network, also deploys mock Chainlink contracts for you to interact with. That last part is the reason the kit is useful in a workshop: a VRF request that needs a randomness oracle and an Automation upkeep that needs a keeper both need something on the other end, and a mock is what makes the local loop close.

A local network is the other command:

```bash
npx hardhat node
```

and the README describes what you get, a local blockchain, private keys, contracts deployed from the deployment folder scripts, and an endpoint you can add to an EVM wallet.

For a real or test network, the README is explicit that you edit the networks section of hardhat.config.js, where defaultNetwork and the networks map live, and that you need three things: an RPC URL, a private key, and ETH and LINK tokens, either testnet or real. The worked example uses the Sepolia testnet, with the values supplied through environment variables, and the repository ships an .env.example for that.

## The quality tooling is the real content of the kit

Beyond the Chainlink wiring, the package scripts are a decent template for a Solidity project, and the fuzzing script is the standout.

```bash
npm run lint
npm run format
npm run coverage
npm run fuzzing
```

Linting is solhint over the contracts, with a fix variant, and the repository carries a .solhint.json configuration and a .solhintignore. Formatting is prettier across the repository, with prettier-plugin-solidity, and there is a .prettierrc and a .prettierignore. Coverage is hardhat coverage with a .solcover.js configuration. Husky and lint-staged are present, so the formatting and linting run on commit rather than only in CI.

Fuzzing is the interesting one, and it is a single line:

```bash
docker run -it --rm -v $PWD:/src trailofbits/eth-security-toolbox
```

The whole Trail of Bits security toolbox, mounted over the project, with no configuration to write. For a starter kit that means a team gets a property-based fuzzing harness for its contracts on the first day, which is the sort of thing nobody remembers to set up later.

The dependency list supports the picture. It has the Chainlink contracts at a pinned 1.5.0, ethers v5 rather than v6, the Hardhat 2 toolchain with the toolbox, the network helpers, the chai matchers, the ethers and etherscan plugins, typechain for typed contract bindings, solidity-coverage, the gas reporter, solhint with its prettier plugin, and the hardhat-preprocessor that does the import remapping.

## Where this starter kit is the wrong choice

The first wrong-tool case is Hardhat 3. The README's first note says this branch is the Hardhat 2 kit and points to a hardhat-3 branch, and the package pins hardhat at 2.22.3. A team starting a new project on Hardhat 3 should take the other branch, and a team that copies this one will find the environment behaving differently.

The second is a project that needs Chainlink Functions or CCIP. The kit covers Price Feeds, VRF and Automation and sends you to other starter kits for the rest, so a contract that calls an off-chain function has to be built somewhere else and the parts have to be brought together by hand.

The third is a team that wants a maintained dependency rather than a template. This is boilerplate to copy, not a library to install, and the evidence is in the version numbers. The listed releases stop at 1.1.1 from April 2022, while the package version is 2.1.1, so the GitHub release history and the shipped package have drifted apart, and the Chainlink contracts dependency is pinned to 1.5.0.

The fourth is a project that wants Foundry rather than Hardhat. The whole point of a starter kit is that it removes a setup decision, and this one removes it in favour of Hardhat. A team with a Foundry-based stack will gain less from it than from the equivalent kit built for their toolchain.

## Conclusion

Adopt this starter kit if you are building a Chainlink contract and want the boilerplate for feeds, VRF and Automation with a working test and deploy path on Hardhat 2, and copy it rather than depending on it. Do not adopt it if you are on Hardhat 3, since the README points to a separate branch for that, and do not expect it to cover Chainlink Functions or CCIP, which have their own starter kits. Before you start, read the Remapping section of the README, because the hardhat-preprocessor setup is what makes dependency imports resolve, and check the version of the Chainlink contracts package you pin against your compiler settings.

## FAQ

### Which Chainlink features does the hardhat-starter-kit implement?

Three: Chainlink Price Feeds, Chainlink VRF and Chainlink Automation, on the Hardhat development environment. Chainlink Functions and Chainlink CCIP have their own separate starter kits, and the Any API has been removed in favour of Chainlink Functions.

### Is this the Hardhat 3 version of the starter kit?

No. The README states that this branch contains the Hardhat 2 starter kit and points to a hardhat-3 branch for Hardhat 3, and the package pins hardhat at 2.22.3.

### How do I run the tests in the Chainlink hardhat-starter-kit?

Clone the repository, install the dependencies, and run npx hardhat test, which is also available as npm run test or yarn test. The test script targets the unit specs, and a separate test-staging script runs the staging specs against the sepolia network.

### What does the fuzzing script in the hardhat-starter-kit do?

It runs the Trail of Bits security toolbox in Docker against the project directory, with docker run -it --rm -v $PWD:/src trailofbits/eth-security-toolbox, so a property-based fuzzing harness is available with no configuration.

### What licence is the Chainlink hardhat-starter-kit released under?

MIT, with the LICENSE file at the repository root, and the package name is hardhat-starter-kit at version 2.1.1. The listed GitHub releases stop at 1.1.1 from 2022-04-12, and the last push was on 2026-09-22.

## Sources

- [Issues](https://github.com/smartcontractkit/hardhat-starter-kit/issues)
- [README](https://github.com/smartcontractkit/hardhat-starter-kit/blob/main/README.md)
- [Releases](https://github.com/smartcontractkit/hardhat-starter-kit/releases)
- [smartcontractkit/hardhat-starter-kit on GitHub](https://github.com/smartcontractkit/hardhat-starter-kit)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/smartcontractkit-hardhat-starter-kit
