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

In this section, we'll explain the requirements and basics for running your own Chainlink node.

It's important to note that nodes can fulfill requests for open APIs out-of-the-box using our core Adapters without needing any 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" rel="noreferrer, noopener">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 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 -y 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:

Create a Directory

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

Create a local directory to hold the Chainlink data:

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

Create an Environment File

Run the following as a command to create an environment file and populate with variables specific to the network you're running on.

echo "ROOT=/chainlink
LOG_LEVEL=debug
ETH_CHAIN_ID=3
MIN_OUTGOING_CONFIRMATIONS=2
LINK_CONTRACT_ADDRESS=0x20fe562d797a42dcb3399062ae9546cd06f63280
CHAINLINK_TLS_PORT=0
SECURE_COOKIES=false
ALLOW_ORIGINS=*" > ~/.chainlink-ropsten/.env
echo "ROOT=/chainlink
LOG_LEVEL=debug
ETH_CHAIN_ID=4
MIN_OUTGOING_CONFIRMATIONS=2
LINK_CONTRACT_ADDRESS=0x01BE23585060835E02B77ef475b0Cc51aA1e0709
CHAINLINK_TLS_PORT=0
SECURE_COOKIES=false
ALLOW_ORIGINS=*" > ~/.chainlink-rinkeby/.env
echo "ROOT=/chainlink
LOG_LEVEL=debug
ETH_CHAIN_ID=42
MIN_OUTGOING_CONFIRMATIONS=2
LINK_CONTRACT_ADDRESS=0xa36085F69e2889c224210F603D836748e7dC0088
CHAINLINK_TLS_PORT=0
SECURE_COOKIES=false
ALLOW_ORIGINS=*" > ~/.chainlink-kovan/.env
echo "ROOT=/chainlink
LOG_LEVEL=debug
ETH_CHAIN_ID=1
CHAINLINK_TLS_PORT=0
SECURE_COOKIES=false
ALLOW_ORIGINS=*" > ~/.chainlink/.env

Set your Ethereum Client URL

Using an external Ethereum client?

If you're using a 3rd party service to connect to the blockchain, skip to the External Provider section to set the ETH_URL environment variable. We provide general guidance, but you will need to obtain the websocket connection string to add to your environment file.

Ethereum Client on the Same Machine

Next you need to get the URL for the Ethereum client. The command below will help you obtain the IP address of the container that your Ethereum client is running on. This will only work if you have started an Ethereum client on the same machine as your Chainlink node.

ETH_CONTAINER_IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' $(docker ps -f name=eth -q))

Then run the following command to add the Ethereum client's URL to your environment file. If you are using an external Ethereum client, use the External tab below, and update CHANGEME to the websocket address used for connectivity.

echo "ETH_URL=ws://$ETH_CONTAINER_IP:8546" >> ~/.chainlink-ropsten/.env
echo "ETH_URL=ws://$ETH_CONTAINER_IP:8546" >> ~/.chainlink-rinkeby/.env
echo "ETH_URL=ws://$ETH_CONTAINER_IP:8546" >> ~/.chainlink-kovan/.env
echo "ETH_URL=ws://$ETH_CONTAINER_IP:8546" >> ~/.chainlink/.env

Ethereum Client as an External Provider

If you are using an external provider for connectivity to the Ethereum blockchain or you are running an Ethereum client on a separate instance, you may use the command below for your network. Be sure to update the value for CHANGEME to the value given by your provider or the address and port of your separate instance.

echo "ETH_URL=CHANGEME" >> ~/.chainlink-ropsten/.env
echo "ETH_URL=CHANGEME" >> ~/.chainlink-rinkeby/.env
echo "ETH_URL=CHANGEME" >> ~/.chainlink-kovan/.env
echo "ETH_URL=CHANGEME" >> ~/.chainlink/.env

(Optional) Set the Remote DATABASE_URL Config

If you want to use your Chainlink node with a remote PostgreSQL database, see the Connecting to a Remote Database page at this point. Use the example below to configure your DATABASE_URL setting in your environment file.

DATABASE_URL=postgresql://$USERNAME:$PASSWORD@$SERVER:$PORT/$DATABASE

For a primary/secondary Chainlink node architecture, you may also want to set the DATABASE_TIMEOUT configuration as well.

echo "DATABASE_TIMEOUT=0" >> ~/.chainlink-ropsten/.env
echo "DATABASE_TIMEOUT=0" >> ~/.chainlink-rinkeby/.env
echo "DATABASE_TIMEOUT=0" >> ~/.chainlink-kovan/.env
echo "DATABASE_TIMEOUT=0" >> ~/.chainlink/.env

Start the Chainlink Node

Now you can run the Docker image:

cd ~/.chainlink-ropsten && docker run -p 6688:6688 -v ~/.chainlink-ropsten:/chainlink -it --env-file=.env smartcontract/chainlink local n
cd ~/.chainlink-rinkeby && docker run -p 6688:6688 -v ~/.chainlink-rinkeby:/chainlink -it --env-file=.env smartcontract/chainlink local n
cd ~/.chainlink-kovan && docker run -p 6688:6688 -v ~/.chainlink-kovan:/chainlink -it --env-file=.env smartcontract/chainlink local n
cd ~/.chainlink && docker run -p 6688:6688 -v ~/.chainlink:/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 will need to send some ETH to your node's address in order for it to fulfill requests. You can view your node's ETH address when the node starts up or on the Configuration page of the GUI.

You can now connect to your Chainlink node's UI interface by navigating to http://localhost:6688. If using a VPS, you can create a SSH tunnel to your node for 6688:localhost:6688 to enable connectivity to the GUI. Typically this is done with ssh -i $KEY $USER@$REMOTE-IP -L 6688:localhost:6688 -N. A SSH tunnel is recommended over opening up ports specific to the Chainlink node to be public facing. See our Best Security and Operating Practices page for more details on how to secure your node.


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.