Install Instructions
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 Beginner Walkthrough
Install into Existing Projects
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.
NPM
Install using NPM
npm install @chainlink/contracts --save
Yarn
Install using Yarn
yarn add @chainlink/contracts
Create a New Project
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.
Hardhat Starter Kit
Install hardhat
npm install --save-dev hardhat
Then, clone the starter kit
git clone https://github.com/smartcontractkit/hardhat-starter-kit
cd hardhat-starter-kit
For more information on Hardhat, see our blog post How to use Hardhat with Chainlink. Alternatively, visit the repo for more instructions.
Brownie Starter Kit
Install Brownie with pip:
pip install eth-brownie
With Brownie installed, run the commands below to open a Brownie project into a new directory.
mkdir MyChainlinkProject
cd MyChainlinkProject/
brownie bake chainlink-mix
cd chainlink-mix
For more information on working with Brownie, see our blog how to use Brownie with Chainlink or visit the repo to learn more.
Environment variables are required when working with Brownie. Learn how to set environment variables.
Truffle Starter Kit
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 more details on how to use the Truffle, see our blog post. Alternatively, visit the repo for more information.
Using Chainlink Contracts
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.
Testing Chainlink Contracts
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.