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!

Building on Chainlink? Click here to get started!

Get Started

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, which means you don't need a complete development environment to run a node.

Requirements

  • Docker-CE. Quick instructions for setting up Docker is below:
sudo amazon-linux-extras install docker
sudo systemctl start docker
sudo gpasswd -a $USER docker
exit
# log in again
curl -sSL https://get.docker.com/ | sh
sudo systemctl start docker
sudo usermod -aG docker $USER
exit
# log in again
curl -sSL https://get.docker.com/ | sh
sudo usermod -aG docker $USER
exit
# log in again
curl -sSL https://get.docker.com/ | sh
sudo systemctl start docker
sudo usermod -aG docker $USER
exit
# log in again
curl -sSL https://get.docker.com/ | sh
sudo usermod -aG docker $USER
exit
# log in again
  • 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 -p ~/.chainlink-ropsten/tls
mkdir -p ~/.chainlink-rinkeby/tls
mkdir -p ~/.chainlink-kovan/tls

For extra security, create the TLS certificates so that you can use HTTPS to connect to your node:

openssl req -x509 -out  ~/.chainlink-ropsten/tls/server.crt  -keyout ~/.chainlink-ropsten/tls/server.key \
  -newkey rsa:2048 -nodes -sha256 \
  -subj '/CN=localhost' -extensions EXT -config <( \
   printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
openssl req -x509 -out  ~/.chainlink-rinkeby/tls/server.crt  -keyout ~/.chainlink-rinkeby/tls/server.key \
  -newkey rsa:2048 -nodes -sha256 \
  -subj '/CN=localhost' -extensions EXT -config <( \
   printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")
openssl req -x509 -out  ~/.chainlink-kovan/tls/server.crt  -keyout ~/.chainlink-kovan/tls/server.key \
  -newkey rsa:2048 -nodes -sha256 \
  -subj '/CN=localhost' -extensions EXT -config <( \
   printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")

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.

You'll need to change the ETH_URL value if you are not running your Ethereum client following this guide.

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
TLS_CERT_PATH=/chainlink/tls/server.crt
TLS_KEY_PATH=/chainlink/tls/server.key
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
TLS_CERT_PATH=/chainlink/tls/server.crt
TLS_KEY_PATH=/chainlink/tls/server.key
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
TLS_CERT_PATH=/chainlink/tls/server.crt
TLS_KEY_PATH=/chainlink/tls/server.key
ALLOW_ORIGINS=*" > .env

Now you can run the Docker image:

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

docker run --link eth -p 6689:6689 -v ~/.chainlink-ropsten:/chainlink -it --env-file=.env smartcontract/chainlink local n
docker run --link eth -p 6689:6689 -v ~/.chainlink-rinkeby:/chainlink -it --env-file=.env smartcontract/chainlink local n
docker run --link eth -p 6689:6689 -v ~/.chainlink-kovan:/chainlink -it --env-file=.env smartcontract/chainlink local 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 https://localhost:6689. If using a VPS, replace localhost with your public IP address and add port 6689 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 install

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_TLS_PORT=0
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_TLS_PORT=0
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_TLS_PORT=0
export ALLOW_ORIGINS=*

Run the node

chainlink local n

Running a Chainlink Node


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.