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

CoinGecko Chainlink (Testnet)

This Chainlink has a dedicated connection to CoinGecko's API. In addition to tracking price, volume and market capitalization, CoinGecko tracks community growth, open-source code development, major events and on-chain metrics.

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: 0xc99B3D447826532722E41bc36e644ba3479E4365
JobID:

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 BraveNewCoinChainlink is ChainlinkClient {
  
  uint256 oraclePayment;

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

Tasks

Request Parameters

coin

Required

The symbol for the cryptocurrency.

Examples: btc, eth, ltc.

Solidity example

req.add("coin", "eth");

market

Required

The market currency symbol.

Examples: usd, eur, cny.

times

Required

The number to multiply the result by (since Solidity can't handle decimal places).

Solidity example

req.addInt("times", 100);

Chainlink Examples

The examples below utilize the different endpoints available from this Chainlink:

function requestPrice
(
  address _oracle,
  bytes32 _jobId,
  string _coin,
  string _market
)
  public
  onlyOwner
{
  Chainlink.Request memory req = buildChainlinkRequest(_jobId, this, this.fulfill.selector);
  req.add("coin", _coin);
  req.add("market", _market);
  req.addInt("times", 100);
  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;
}

Available Currencies

Digital Currencies

For a full list of available currencies, please check CoinGecko's websites: https://www.coingecko.com/en

CoinGecko 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.