Running a Chainlink Node

This page explains the requirements and basic instructions for running your own Chainlink node.

Note that nodes can fulfill requests for open APIs out-of-the-box using Tasks without needing any additional configuration.

To provide data from an authenticated API, add an external adapter to enable connectivity through the Chainlink node.

Chainlink Node Diagram

Requirements

You can run a Chainlink node with 0 LINK, but the node will not be able to participate in requests that require a deposit until it has earned some LINK first.

Requesters can specify an amount of LINK that all nodes must deposit as a penalty fee in the event that the node doesn’t fulfill the request. However, since penalty fees are optional, not all requests will require it.

Your Chainlink node should be run on a server that has a public IP address, and meets the following CPU and memory requirements:

  • Minimum: To get started running a Chainlink node, you will need a machine with at least 2 cores and 4 GB of RAM.
  • Recommended: The requirements for running a Chainlink node scale as the number of jobs your node services also scales. For nodes with over 100 jobs, you will need at least 4 cores and 8GB of RAM.

PostgreSQL Database Requirements

In addition to running a Chainlink node, must also run a PostgreSQL database version 11 or newer on a system that meets the following CPU, memory, and storage requirements:

  • Minimum: At least 2 cores, 4GB of RAM, and 100 GB of storage.
  • Recommended: To support more than 100 jobs, your database server will need at least 4 cores, 16 GB of RAM, and 100 GB of storage.

Make sure that your DB host provides access to logs.

If you run your node on AWS, use an instance type with dedicated core time. Burstable Performance Instances have a limited number of CPU credits, so you should not use them to run Chainlink nodes that require consistent performance.

Ethereum Client

Connectivity to an Ethereum client is also required for communication with the blockchain. If you decide to run your own Ethereum client, you will want to run that on a separate machine. Hardware requirements of Ethereum clients can change over time. You can also use a third-party service as your Ethereum client.

Running From Source

To run a Chainlink node from source, use the following instructions.

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 are 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 execution client with websockets enabled and a connected consensus client. See Running an Ethereum Client for details. Optionally, you can use an external service as your client.

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-goerli
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. For a full list of available configuration variables, click here.

echo "ROOT=/chainlink
LOG_LEVEL=debug
ETH_CHAIN_ID=5
CHAINLINK_TLS_PORT=0
SECURE_COOKIES=false
ALLOW_ORIGINS=*" > ~/.chainlink-goerli/.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

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 $ETH_CONTAINER_IP to the websocket address used for connectivity.

echo "ETH_URL=ws://$ETH_CONTAINER_IP:8546" >> ~/.chainlink-goerli/.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-goerli/.env
echo "ETH_URL=CHANGEME" >> ~/.chainlink/.env

Set the Remote DATABASE_URL Config

You will need to connect your Chainlink node with a remote PostgreSQL database. See the Connecting to a Remote Database page for more information. Use the example below to configure your DATABASE_URL setting in your environment file, replacing $VARIABLES with their actual values.

  • $USERNAME: The database username (must be owner)
  • $PASSWORD: The user’s password
  • $SERVER: The server name or IP address of the database server
  • $PORT: The port that the database is listening on
  • $DATABASE: The database to use for the Chainlink node (i.e. “postgres”)
echo "DATABASE_URL=postgresql://$USERNAME:$PASSWORD@$SERVER:$PORT/$DATABASE" >> ~/.chainlink-goerli/.env
echo "DATABASE_URL=postgresql://$USERNAME:$PASSWORD@$SERVER:$PORT/$DATABASE" >> ~/.chainlink/.env

Now you can run the Docker image. Replace <version> with your desired version. Tag versions are available in the Chainlink docker hub. The latest version does not work.

cd ~/.chainlink-goerli && docker run -p 6688:6688 -v ~/.chainlink-goerli:/chainlink -it --env-file=.env smartcontract/chainlink:<version> local n
cd ~/.chainlink && docker run -p 6688:6688 -v ~/.chainlink:/chainlink -it --env-file=.env smartcontract/chainlink:<version> 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, and will be used every time you log into your node. 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, 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 [email protected]$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 the Security and Operation Best Practices page for more details on how to secure your node.

Whats Next

Stay updated on the latest Chainlink news