How to Set Up a Chainlink Node and Fetch ETH Price Data

·

Blockchain technology thrives on trustless, decentralized systems—but smart contracts can't access real-world data on their own. That’s where Chainlink, the leading decentralized oracle network, comes in. In this comprehensive guide, you’ll learn how to build your own Chainlink node on the Kovan testnet and use it to fetch live Ethereum (ETH) price data through a secure, reliable oracle setup.

Whether you're exploring blockchain development or diving into DeFi infrastructure, running a Chainlink node is an essential skill. Let’s walk through the process step by step.


What Is a Chainlink Node?

A Chainlink node acts as a bridge between smart contracts and external data sources. Unlike typical ERC20 tokens, Chainlink uses the ERC677 standard, which extends ERC20 functionality by allowing data to be sent alongside token transfers—enabling automated execution of contract logic upon receipt.

Chainlink supports a wide range of services:

By operating a certified Chainlink node, developers and organizations can earn rewards in LINK tokens while contributing to network reliability and decentralization.


Step 1: Prepare Your Cloud Environment

To run a Chainlink node, you’ll need:

We'll use Google Cloud Platform (GCP) for this tutorial due to its stability and global accessibility. However, alternatives like AWS or Alibaba Cloud work just as well.

Set Up a Virtual Machine on GCP

  1. Go to https://cloud.google.com and create an account using a Visa card (new users get $300 in free credits).
  2. Navigate to the Console and create a new Compute Engine VM instance.
  3. Configure with:

    • Machine type: e2-standard-2 (2 vCPUs, 8GB RAM)
    • Boot disk: Ubuntu 18.04 LTS, SSD 10GB
    • Allow HTTP/HTTPS traffic
  4. Click "Create" and wait about 5 minutes.

Once created, enable networking by searching for “VPC Network” in the console and configuring firewall rules to allow inbound connections on necessary ports.

Create a PostgreSQL Database Instance

Chainlink requires PostgreSQL for storing job logs and configuration data.

  1. In GCP Console, go to SQL > Create Instance.
  2. Choose PostgreSQL.
  3. Set instance ID, password, region, and enable Private IP under connectivity settings.
  4. Wait 5 minutes for provisioning.

After setup:

👉 Start building your blockchain infrastructure today with powerful tools and resources.


Step 2: Deploy the Chainlink Node Using Docker

Now that your environment is ready, connect to your VM and deploy the Chainlink node container.

Connect via SSH with Port Tunneling

Install Google Cloud SDK locally, then run:

gcloud compute --project "your-project-id" ssh --zone "us-central1-a" "your-instance-name" -- -L 6688:localhost:6688

This forwards port 6688 from the remote server to your local machine—essential for accessing the Chainlink GUI.

Install Docker and Configure Environment

Run these commands on the server:

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

Log out and back in for group changes to apply.

Create a config directory:

mkdir ~/.chainlink-kovan

Set environment variables in .env:

ROOT=/chainlink
LOG_LEVEL=debug
ETH_CHAIN_ID=42
MIN_OUTGOING_CONFIRMATIONS=2
LINK_CONTRACT_ADDRESS=0xa36085F69e2889c224210F603D836748e7dC0088
CHAINLINK_TLS_PORT=0
SECURE_COOKIES=false
GAS_UPDATER_ENABLED=true
ALLOW_ORIGINS=*

Connect to Ethereum Network via Infura

Instead of running a full ETH node, use Infura’s free WebSocket endpoint for Kovan:

echo "ETH_URL=wss://kovan.infura.io/ws/v3/YOUR_INFURA_PROJECT_ID" >> ~/.chainlink-kovan/.env

Replace YOUR_INFURA_PROJECT_ID with your actual Infura key (sign up at infura.io).

Link to PostgreSQL Database

Update .env with your DB credentials:

echo "DATABASE_URL=postgresql://chainlink-db-user:[email protected]:5432/postgres" >> ~/.chainlink-kovan/.env

Launch the Chainlink Node

Start the Docker container:

cd ~/.chainlink-kovan && sudo docker run -p 6688:6688 -v ~/.chainlink-kovan:/chainlink -it --env-file=.env smartcontract/chainlink local n

On first launch, you’ll be prompted to set an email and password—save these securely. If login appears, your node is live!


Step 3: Configure Your Node and Fund It

Access the Chainlink dashboard at http://localhost:6688 in your local browser.

Log in with the credentials created during startup.

You’ll notice zero balances for both ETH and LINK tokens—expected on testnet.

Get Testnet Tokens

Request funds from official faucets:

Copy your node’s wallet address from the Configuration tab (Account Address) and paste it into the faucet forms.

Wait a few minutes—the tokens should arrive shortly.


Step 4: Register Your Node with an Oracle Contract

To accept price requests, your node must be registered via an Oracle contract.

Deploy Oracle Contract Using Remix IDE

  1. Open Remix Ethereum IDE
  2. Load Oracle.sol from Chainlink’s GitHub repository
  3. Connect MetaMask to Kovan testnet
  4. Under Deploy, enter the Kovan LINK token address:

    0xa36085F69e2889c224210F603D836748e7dC0088
  5. Select environment: Injected Web3
  6. Deploy the contract

After deployment, call setFulfillmentPermission(your-node-address, true) to authorize your node to fulfill data requests.


Step 5: Create a Job to Fetch ETH Price

Back in the Chainlink GUI, go to Jobs > New Job and paste this JSON:

{
  "name": "Get > Uint256",
  "initiators": [
    {
      "type": "runlog",
      "params": {
        "address": "YOUR_ORACLE_CONTRACT_ADDRESS"
      }
    }
  ],
  "tasks": [
    {
      "type": "httpget"
    },
    {
      "type": "jsonparse"
    },
    {
      "type": "multiply"
    },
    {
      "type": "ethuint256"
    },
    {
      "type": "ethtx"
    }
  ]
}

Replace YOUR_ORACLE_CONTRACT_ADDRESS with the deployed contract address.

Click Create Job and copy the generated Job ID—you'll need it next.


Step 6: Request ETH Price From a Consumer Contract

Deploy ATestnetConsumer.sol in Remix:

  1. Paste the contract code from Chainlink’s GitHub repo
  2. Compile and deploy with the Oracle address and Job ID as constructor args
  3. Fund the contract with test LINK tokens

Call requestEthereumPrice(oracleAddress, jobId).

Wait a few seconds—your node picks up the request, fetches ETH price from an API (e.g., CoinGecko), processes it, and writes it back on-chain.

Finally, call currentPrice() to view the latest ETH value in USD.

👉 Discover how decentralized oracles are powering the future of Web3 applications.


Frequently Asked Questions (FAQ)

Q: Can I run a Chainlink node on mainnet?

Yes, once you’ve mastered the testnet setup, you can deploy on Ethereum mainnet. Just switch configuration values (chain ID, contract addresses, RPC URLs) and ensure you have sufficient ETH and LINK for gas costs.

Q: Do I need my own Ethereum node?

No. While possible, most operators use services like Infura or Alchemy. They provide stable WebSocket endpoints without high hardware demands.

Q: How do Chainlink nodes earn money?

Nodes are paid in LINK tokens when they successfully fulfill data requests from smart contracts. Operators set their own fees based on market demand.

Q: Is Docker required?

While not strictly mandatory, Docker simplifies dependency management and ensures compatibility across environments—highly recommended.

Q: What happens if my node goes offline?

Missed jobs may affect reputation and reduce future earning opportunities. For production use, consider uptime monitoring and backup instances.

Q: Can I run multiple jobs on one node?

Absolutely. A single Chainlink node can handle dozens of jobs simultaneously—ideal for providing various data feeds (e.g., BTC/USD, weather data, sports scores).


Final Thoughts

Building a Chainlink node gives you hands-on experience with one of Web3’s most critical infrastructures: secure, decentralized data delivery. From setting up cloud servers to deploying smart contracts and fetching real-time prices, you now have all the tools needed to contribute to the oracle ecosystem.

As decentralized finance (DeFi), insurance, gaming, and prediction markets grow, so does the demand for reliable off-chain data—making node operation both technically rewarding and potentially profitable.

Keep experimenting, explore external adapters, and consider joining Chainlink’s official certification program to become a trusted oracle provider.

👉 Accelerate your journey into blockchain development with advanced tools and insights.