How to use Chainlink with Truffle/Ganache without unboxing a new app? (I have an app already, I don't want to unbox a new one)

I'm trying to get the Chainlink price feeds working in local development using Ganache / Truffle.

How is something like accomplished?

  • What do you mean without unboxing a new app? Do you have a box with enables local testing with Chainlink? Commented Dec 29, 2020 at 22:36
  • There are tutorials that mention using Truffle unbox to get a boilerplate Chainlink app. I don't have any boxes personally
    – GN.
    Commented Dec 29, 2020 at 23:24

1 Answer 1


To work with Chainlink price feeds in your local environment and deployment framework, you'll want to fork a blockchain.

I've included using hardhat and brownie in this answer as they have forking that comes already installed.

For just ganache

The easiest way is to use the forking feature.

ganache-cli --fork=http://infura.io/mainnet

When you run the client, you can fork mainnet and then just use the price feed contract addresses as normal but on your local chain.

For truffle

Truffle has two options:

1. Truffle teams forking

2. Write your own ganache-cli server

Truffle doesn't come pre-installed with a forking feature, but you can sign up for truffle teams and use a forking feature through that. Or, you could write your own server.

Hardhat forking

Hardhat is a truffle-like smart contract deployment and testing framework. It comes with a forking feature that forks a blockchain to it's hardhat virtual environment (similar to ganache local blockchain). In your hardhat config, you just write the following:

networks: {
  hardhat: {
    forking: {
      url: "https://eth-mainnet.alchemyapi.io/v2/<key>"

Additionally, you can run a hardhat local chain with the command:

npx hardhat node --fork https://eth-mainnet.alchemyapi.io/v2/<key>


Brownie is a python deployment framework that also has forking. You can check out the documentation if you'd like to learn more.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.