Marketplace has launched, further enabling blockchain developers! Learn more

How to setup a Chainlink node

September 21, 2022

Overview

Smart-contracts are the heart and soul of all the development happening on the Ethereum blockchain, and as more and more people develop on Ethereum, smart contracts are becoming more complex.

Sometimes a smart contract wants information about the real world, like the price of ethereum or a basketball game score. When this requirement exists, these smart contracts need to deal with external data, which is known as off-chain data that does not already reside on the blockchain, this data needs to be in the same format as on-chain data. The difficulty with connecting this outside data to blockchain in a language that both on-chain and off-chain sources can understand is limiting smart contracts' extensive usability. As a result, Oracles were introduced into the blockchain ecosystem to bring the off-chain data to on-chain. Oracles retrieve and feed external data to the blockchain and smart contracts via web APIs. But, centralized oracles can diminish the benefits of a blockchain as they can be faulty and alterable. This is where Chainlink comes into the picture. Chainlink aims to provide tamper-proof inputs and outputs for complex smart contracts and connect them to real-world events and data. Chainlink has gained a fair amount of popularity in the blockchain community. The Chainlink network is built on independent node operators, making it decentralized Oracle technology, unlike other Oracle designs that depend on a centralized entity as a gateway. The node operators are rewarded with the LINK tokens for doing high-quality, honest work. Chainlink nodes have job specifications registered with each node to execute jobs coordinated by the on-chain Oracle contracts.

Running a Chainlink node allows you to provide external data directly to smart contracts. In this guide, we will configure our Chainlink node and become a node operator on the Ethereum mainnet.

Prerequisites

Booting our Ethereum node

For our purposes today, we could use pretty much any Ethereum client, such as Geth or OpenEthereum (fka Parity). Since that is a bit too involved for getting our Chainlink node running, we'll just grab an endpoint from QuickNode to make this easy. After you've created your ethereum endpoint, copy your WebSocket endpoint:

Screenshot of Quicknode Ethereum Endpoint


You'll need this later, so copy it and save it.

Booting your PostgreSQL instance

To run a Chainlink node we also require a PostgreSQL database instance, PostgreSQL is an open-source, object-relational database. built with keeping extensibility, data integrity, and speed in mind. Its concurrency support makes it compatible with ACID transactions and it supports dynamic loading.

If you already have a PostgreSQL database set up, get your connection string in the following form-`postgresql://$USERNAME:[email protected]$SERVER:$PORT/$DATABASE`  and you can head to the next section.

Now, let's see how we can set up our own PostgreSQL instance, we'll use DigitalOcean here.

Step 1: Create a DigitalOcean account if you don't have already and sign in.

Step 2: Click on Create in your DigitalOcean dashboard and select databases, this will take you to a page to configure your database.

Step 3: Select PostgreSQL as your database engine under 'Choose a database engine' section, under 'Choose a Cluster Configuration' section select the smallest node with 1GB-RAM-1-vCPU as you can always upscale the node later but cannot downgrade it, you can also select a Standby node in higher node plans for better reliability.

Step 4: Select a region for your database under the section 'Choose a datacenter', always choose a region your app servers are in or nearest.

Step 5: In the 'Finalize and Create' section there will be an auto-generated name of your database, you can type in a name of your choice too, select a DigitalOcean project your want this database under and even give tags.

Step 6: Now you'll see the database control panel, select "connection string" in the top-right drop-down, and a string will be displayed which we'll use in the latter part of this guide. You can also find your database control panel after you log in to your DigitalOcean account go to the Databases page, then select the name of your database cluster.

Making sure Docker is installed

By now, you should have Docker-CE installed, if not type the following in your terminal aka Command Line (for Ubuntu):

For Ubuntu:

making sure docker is installed

Copy
$ curl -sSL https://get.docker.com/ | 
sudo usermod -aG docker $USER
exit

For macOS:

for macOS, Docker-CE comes with Docker Desktop which can be downloaded from Docker hub, install Docker Desktop and open the Docker.app and the Docker is running.

For Windows:

for Windows, Docker-CE comes with Docker Desktop which can be downloaded from Docker hub, install Docker Desktop and open the Docker.app and the Docker is running.

Related articles 11

Ethereum Full Node vs Archive Node
Published: Apr 8, 2021
Updated: Sep 20, 2022

Ethereum runs on a network of computers (also known as nodes) that verify transactions based on a consensus protocol and ledger, which make up the blockchain. In this guide, you will learn...

Continue reading
Introduction to Ethereum Rollups
Published: Dec 28, 2021
Updated: Sep 9, 2022

Ethereum, the most popular blockchain, has seen scaling issues for quite a long time now. With high gas fees due to congestion being the primary pain point. With the increasing cost to use the...

Continue reading
How to run a Hyperledger Besu node
Published: May 18, 2021
Updated: Sep 9, 2022

As the Ethereum network continues to grow, the need for an enterprise-ready Ethereum client arises. Hyperledger Besu is an enterprise-friendly Ethereum client that can implement both public...

Continue reading
How to Run a Binance Smart Chain Node
Published: Jul 2, 2021
Updated: Oct 11, 2022

Binance Smart Chain, BSC for short, is a blockchain that seeks to provide both an alternative and extension to the Ethereum Blockchain. It has done this through several clever implementations...

Continue reading
How to install and run a Geth node
Published: Apr 5, 2020
Updated: Sep 12, 2022

Ethereum nodes are computers participating in Ethereum blockchain network. These nodes are actual computers running software that verifies, stores, and sometimes creates blocks. The actual...

Continue reading
How to run Nethermind node
Published: May 18, 2021
Updated: Nov 18, 2022

To run an Ethereum node without any problems, it is essential to choose a good node client. Nethermind is one of the oldest and most trusted Ethereum node clients. In this guide, let’s see how...

Continue reading
How to Install and Run a Stacks Node
Published: Aug 26, 2022
Updated: Sep 9, 2022

Stacks 2.0 is an open-source layer-1 blockchain that allows developers to build smart contracts and decentralized blockchain applications. This guide will demonstrate how to install the Stacks...

Continue reading
How to Use Laika with QuickNode
Published: Apr 22, 2022
Updated: Sep 9, 2022

Developers spend most of their time writing code, testing, and fixing bugs. A lot of the time spent with these tasks can be simplified by using a tool like Laika. Laika is a Web3 development...

Continue reading