Search
This page explains how to install and use the Chainlink Library in your projects, either manually or via the user of the Chainlink Starter Kits.
Important
If you're new to smart contract development and want a step-by-step guide, try out our Getting Started guide.
Chainlink is supported by Hardhat, Brownie, Truffle and other frameworks.
If you already have a project, you can add Chainlink to it by using the following package managers.
Install using NPM:
npm install @chainlink/contracts --save
Install using Yarn:
yarn add @chainlink/contracts
If you're creating a new project from scratch, these commands will help you set up your project to interact with Chainlink tools and features via the use of our Starter Kits.
To learn more about Hardhat, see the Hardhat Documentation.
Clone the starter kit. The starter kit includes Hardhat, so you don't need to install it separately.
git clone https://github.com/smartcontractkit/hardhat-starter-kit
cd hardhat-starter-kit
For instructions on how to use the starter kit, refer to the Hardhat starter kit README.
For more details on how to use Chainlink with Hardhat, see our blog post about How to use Hardhat with Chainlink.
Before you begin, install Brownie.
With Brownie installed, run the commands below to open a Brownie project in a new directory.
mkdir MyChainlinkProject
cd MyChainlinkProject/
brownie bake chainlink-mix
cd chainlink-mix
For instructions on how to use the starter kit, refer to the Brownie starter kit README.
For more details on how to use Chainlink with Brownie, see the Develop a DeFi Project Using Python blog post.
Before you begin, install Truffle with NPM:
npm install truffle -g
Once installed, unbox the Truffle Starter Kit:
mkdir MyChainlinkProject
cd MyChainlinkProject/
truffle unbox smartcontractkit/truffle-starter-kit
For instructions on how to use the starter kit, refer to the Truffle starter kit README.
For more details on how to use Chainlink with Truffle, see our blog post about Using Truffle to interact with Chainlink Smart Contracts.
To learn more about DappTools, refer to the DappTools Documentation.
Install Dapp tools using the Installation instructions in the Dapp tools GitHub repository.
After you install the tools, clone the starter kit and install the dependencies:
git clone https://github.com/smartcontractkit/dapptools-starter-kit
cd dapptools-starter-kit
make # This installs the project's dependencies.
For instructions on how to use the starter kit, refer to the DappTools starter kit README.
For more details on how to use Chainlink with DappTools, see the How To Use DappTools blog post.
To learn more about Foundry, refer to the Foundry Documentation.
Install Foundry using the Installation instructions on GitHub.io.
After you install Foundry, clone the starter kit and install the project dependencies:
git clone https://github.com/smartcontractkit/foundry-starter-kit
cd foundry-starter-kit
make # This installs the project's dependencies.
For instructions on how to use the starter kit, refer to the Foundry starter kit README.
Once you have the Chainlink library installed, you can leverage the Chainlink ecosystem.
If you're interested in retrieving up to date crypto prices in your contracts, learn more about our Data Feeds.
If you need to consume randomness in your contracts, learn about Chainlink VRF.
And if you want your contracts to retrieve data from off-chain APIs, learn about Using Any API.
See our blog post on Testing Chainlink Smart Contracts or watch the Chainlink Hackathon Workshop.
Tests samples can be found on Hardhat Starter Kit and Truffle Starter Kit respectively.