Chainlink Developers

Welcome to the Chainlink documentation site. You'll find comprehensive guides and documentation to help you start working with Chainlink as quickly as possible, as well as support if you get stuck. Click here for an introductory walkthrough on how to create a Chainlink request on the Ropsten test network!

Running a Chainlink Node

Running a Chainlink node allows you to provide external data directly to smart contracts. The Chainlink node can support fulfilling requests for open APIs out-of-the-box using our core Adapters, without additional configuration. If you would like to provide data from an authenticated API, you can add an external adapter to enable connectivity through the Chainlink node.

The Chainlink node is middleware, operating between the blockchain and external data. More information on our architecture is available <a href="https://docs.chain.link/v1.0/docs/architecture-overview" target="_blank">here</a>.

The Chainlink node is middleware, operating between the blockchain and external data. More information on our architecture is available here.

Using Docker

It's recommended to run the Chainlink node with Docker. This is because we continuously build and deploy the code from from our repository on Github to Dockerhub, which means you don't need a complete development environment to run a node.

Requirements

  • Docker-CE.
  • A fully synced Ethereum client with websockets enabled. Client specific instructions can be found below:

Steps

Once you have your Ethereum client running and fully synced, you're ready to run the Chainlink node.

First, download the latest version:

docker pull smartcontract/chainlink:latest

Create a local directory to hold the Chainlink data:

mkdir ~/.chainlink-ropsten
mkdir ~/.chainlink-rinkeby
mkdir ~/.chainlink-kovan

Run the following as a command to create an environment file and populate with your variables. If using an external service for your Ethereum client, you will need to update the ETH_URL to the websocket address for connectivity.

echo "ROOT=/chainlink
LOG_LEVEL=debug
ETH_URL=ws://eth:8546
ETH_CHAIN_ID=3
MIN_OUTGOING_CONFIRMATIONS=2
MIN_INCOMING_CONFIRMATIONS=0
LINK_CONTRACT_ADDRESS=0x20fe562d797a42dcb3399062ae9546cd06f63280
CHAINLINK_TLS_PORT=0
CHAINLINK_DEV=true
ALLOW_ORIGINS=*" > .env
echo "ROOT=/chainlink
LOG_LEVEL=debug
ETH_URL=ws://eth:8546
ETH_CHAIN_ID=4
MIN_OUTGOING_CONFIRMATIONS=2
MIN_INCOMING_CONFIRMATIONS=0
LINK_CONTRACT_ADDRESS=0x01BE23585060835E02B77ef475b0Cc51aA1e0709
CHAINLINK_TLS_PORT=0
CHAINLINK_DEV=true
ALLOW_ORIGINS=*" > .env
echo "ROOT=/chainlink
LOG_LEVEL=debug
ETH_URL=ws://eth:8546
ETH_CHAIN_ID=42
MIN_OUTGOING_CONFIRMATIONS=2
MIN_INCOMING_CONFIRMATIONS=0
LINK_CONTRACT_ADDRESS=0xa36085F69e2889c224210F603D836748e7dC0088
CHAINLINK_TLS_PORT=0
CHAINLINK_DEV=true
ALLOW_ORIGINS=*" > .env

Now you can run the Docker image:

Note: Remove --link eth if you are not running your Ethereum client following this guide.

docker run --link eth -p 6688:6688 \
           -v ~/.chainlink-ropsten:/chainlink \
           -it --env-file=.env \
           smartcontract/chainlink n
docker run --link eth -p 6688:6688 \
           -v ~/.chainlink-rinkeby:/chainlink \
           -it --env-file=.env \
           smartcontract/chainlink n
docker run --link eth -p 6688:6688 \
           -v ~/.chainlink-kovan:/chainlink \
           -it --env-file=.env \
           smartcontract/chainlink n

The first time running the image, it will ask you for a password and confirmation. This will be your wallet password that you can use to unlock the keystore file generated for you. Then, you'll be prompted to enter an API Email and Password. This will be used to expose the API for the GUI interface. When running the node again, you can supply the -p option with a path to a text file containing the wallet key password, and a -a option, pointing to a text file containing the API email and password. Instructions on how to do that are here.

You can now connect to your Chainlink node's UI interface by navigating to http://localhost:6688. If using a VPS, replace localhost with your public IP address and add port 6688 to your firewall for allowed incoming traffic.

Building the binary locally

You can also run the Chainlink node on your machine natively after compiling a binary.

Requirements

Steps

Add Yarn with NPM

sudo npm install -g yarn

Download Chainlink

go get -d github.com/smartcontractkit/chainlink
cd $GOPATH/src/github.com/smartcontractkit/chainlink

Install Chainlink

make bootstrap

Set your environment variables (we recommend direnv). An example .envrc file is given below:

export LOG_LEVEL=debug
export ETH_URL=ws://localhost:8546
export ETH_CHAIN_ID=3
export MIN_OUTGOING_CONFIRMATIONS=2
export MIN_INCOMING_CONFIRMATIONS=0
export LINK_CONTRACT_ADDRESS=0x20fe562d797a42dcb3399062ae9546cd06f63280
export CHAINLINK_DEV=true
export ALLOW_ORIGINS=*
export LOG_LEVEL=debug
export ETH_URL=ws://localhost:8546
export ETH_CHAIN_ID=4
export MIN_OUTGOING_CONFIRMATIONS=2
export MIN_INCOMING_CONFIRMATIONS=0
export LINK_CONTRACT_ADDRESS=0x01BE23585060835E02B77ef475b0Cc51aA1e0709
export CHAINLINK_DEV=true
export ALLOW_ORIGINS=*
export LOG_LEVEL=debug
export ETH_URL=ws://localhost:8546
export ETH_CHAIN_ID=42
export MIN_OUTGOING_CONFIRMATIONS=2
export MIN_INCOMING_CONFIRMATIONS=0
export LINK_CONTRACT_ADDRESS=0xa36085F69e2889c224210F603D836748e7dC0088
export CHAINLINK_DEV=true
export ALLOW_ORIGINS=*

Run the node

chainlink n