Skip to content

Chainlink Oracles on Moonbeam

Chainlink Banner

Disclaimer: Projects themselves entirely manage the content in this guide. Moonbeam is a permissionless network. Any project can deploy its contracts to Moonbeam.


Chainlink is a decentralized oracle network that provides reliable tamper-proof inputs and outputs for complex smart contracts on any blockchain. In simpler terms, Chainlink enables your smart contracts to access real-world data securely.

Chainlink's oracle solution is now available on the Moonbase Alpha TestNet. Two types of oracle request models are available:

  • Basic Request Model — a simple model where a user requests a transaction, and a single oracle source fulfills that request. Although simple, it relies on the user trusting the oracle source as the source of truth
  • Decentralized Data Model — adds an on-chain aggregation data, where data is aggregated from a decentralized network of independent oracle nodes. One example is Chainlink Price Feeds, which aggregate asset price data

You can read more about Chainlink in the following links:

You can contact the team via the following communication channels:

Moonbase Alpha Implementation

Chainlink oracle solution and smart contracts are currently deployed in the Moonbase Alpha TestNet with both Kovan and Rinkeby Ethereum's TestNets.

Basic Request Model

You can find all the contract's addresses that are relevant Basic Request Model in the following table:

Contract Address
Oracle Contract 0x1d693d883BeAeE16edD0D7588D6a9f7E1967E798
LINK Token 0xa36085F69e2889c224210F603D836748e7dC0088

The initial request can be made by using the following Client contract, which you can deploy to the Moonbase Alpha TestNet using Remix and MetaMask. When deploying the contract, you need to provide the LINK token address.

Once deployed, you have the requestPrice() function. This function initiates the request that is fetched by the oracle via events emitted by the oracle contract. The function needs the oracle address, the job specification ID, and the payment to be sent to the oracle (for TestNet purposes, it can be set to zero). The job specification ID (job ID for short) relates to the request type you make to the oracle. The list of job IDs available is presented in the following table:

Base/Quote Job ID Reference
BTC to USD 82ceee2897824a0e8b014ed4ed2ab31e
ETH to USD 60160cdd0e10489681967e9d7ef4c927
DOT to USD 6f6371a780324b90aaf195a0d39c723c
KSM to USD 30a1686f657249f4b6ab01e384b2beaa
AAVE to USD 541b8f7db7374d78b38285ef1b8bfacc
ALGO to USD cdb48696e2314133a1dc8ea27922dd24
BAND to USD 6b0983e0cb6d4aca908b615302a9d672
LINK to USD aad8dbdb0c1840ab905728d85117b681
SUSHI to USD b4b07d0fc218455caaff2223a05ec208
UNI to USD 22b567acabdb419abe8136a2bab6ade8

Once you sent a request as a transaction. The oracle will fulfill this request and write the result to the currentPrice variable.

Price Feeds

A decentralized oracle network updates price feeds. Each oracle node is rewarded for publishing the price data to an Aggregator contract. The information is only updated if a minimum number of responses from Oracle nodes are received (during an aggregation round).

The end-user can retrieve price feeds with read-only operations via a Consumer contract, referencing the correct Aggregator interface (Proxy contract). The Proxy acts as a middleware to provide the Consumer with the most up-to-date Aggregator for a particular price feed.

Each price feed can be read using a straightforward contract interface pointed to the corresponding consumer contract:

pragma solidity ^0.6.6;

interface ConsumerV3Interface {
     * Returns the latest price
    function getLatestPrice() external view returns (int);

     * Returns the decimals to offset on the getLatestPrice call
    function decimals() external view returns (uint8);

     * Returns the description of the underlying price feed aggregator
    function description() external view returns (string memory);

This interface provides the following functions:

  • getLatetPrice — returns the latest price available in the consumer contract
  • decimals — returns the decimals of the corresponding price feed, as numbers in smart contracts are represented as unsigned integers
  • description — returns a brief description of the price feed being queried

Currently, there is a consumer contract for the following price pairs:

Base/Quote Consumer Contract
BTC to USD 0x86f11CffCB1A86Ecb79643FCa1a3C666a61F84Fd
ETH to USD 0xE33691Ba3cF532D4025cF0f47679eFe430d4A618
DOT to USD 0x235A40b872e543b6238df7Ff55E2D8eCAE80a6bd
KSM to USD 0x9Df2E2179ddb4D9197451946104068e08eD3E49F
AAVE to USD 0xD1e52C81FD72fFc6dA3bF083297E6C37852E93DA
ALGO to USD 0x0183d1C98442510DD7aaB0E2d09863c47FFF4dF1
BAND to USD 0x124A3EE742737BC30307d1F82c5406bf79aBa4d6
LINK to USD 0xC58B34ea686Db2d567835de7AB58fC678b6f186A
SUSHI to USD 0x21B52fFF227cD9F425E817f9E1eaA0eB8cd647e1
UNI to USD 0x5Cd72748F94a8597f563D92687A8D2A5074b10E5