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

Kaiko Chainlink (Testnet)

This Chainlink has a dedicated connection to Kaiko's API. Kaiko is the leading provider of institutional grade cryptocurrency market data.

This Chainlink currently supports recent direct exchange rates, recent trade aggregates, and recent trades for all supported exchanges and instruments.

Steps for using this oracle

Chainlink Network Details

You will need to use the following LINK token address, oracle address, and Job ID in order to create the Chainlink request.

Ropsten

LINK Token address: 0x20fE562d797A42Dcb3399062AE9546cd06f63280
Oracle address: 0xa8EE2a4a0F010E66A0f1C4321865D3dbeE3070Cb
JobID: 3c18e6d848224523b61d7e27baf4d3a8

Create your Chainlinked contract

Import Chainlinked.sol into your contract so you can inherit the Chainlinked behavior.

pragma solidity ^0.4.24;

import "chainlink/contracts/ChainlinkClient.sol";

contract KaikoChainlink is ChainlinkClient {

  uint256 oraclePayment;

  constructor(uint256 _oraclePayment) public {
    setPublicChainlinkToken();
    oraclePayment = _oraclePayment;
  }
  // Additional functions here:
  
}

Tasks

Request Parameters

Parameters are required unless specifically marked as optional:

  • region: (string) us or eu.
  • endpoint: (string) URI excluding domain and query string.
  • params: (string, optional) Query string
  • times: (int) See Multiply adapter
  • copyPath: (string or array of strings) See Copy adapter

Refer to the Kaiko Market Data API documentation for how to construct endpoints and params. For information on available exchanges and instruments, refer to the Kaiko Reference Data API documentation or Instrument Explorer.

Chainlink Examples

We have provided a full example Chainlinked Contract to request the most recent spot price for a given asset pair.

This example shows how to create the request for the Chainlink node:

function requestSpotPrice
(
  address _oracle,
  bytes32 _jobId
) 
  public
  onlyOwner
{
  Chainlink.Request memory req = buildChainlinkRequest(_jobId, this, this.fulfill.selector);
  req.add("region", "us");
  req.add("endpoint", "v1/data/trades.v1/spot_direct_exchange_rate/btc/usdt/recent");
  req.add("params", "interval=1m&limit=2");
  req.addInt("times", 100);
  req.add("copyPath", "data.-1.price");
  sendChainlinkRequestTo(_oracle, req, oraclePayment);
}

Here is an example of the fulfill method:

uint256 public currentPrice;

function fulfill(bytes32 _requestId, uint256 _price)
  public
  recordChainlinkFulfillment(_requestId)
{
  currentPrice = _price;
}

Kaiko Chainlink (Testnet)


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.