I am trying to re-compile the ChainlinkEthPrice contract found in the Kaleido Sample Gallery here: https://kaleido-io.github.io/kaleido-samples-gallery/#/kaleido-samples-gallery/chainlink.

Codes as follows:

pragma solidity ^0.4.24;

import "./Chainlinked.sol";

contract ChainlinkEthPrice is Chainlinked {

    struct EthPriceAtBlock
        uint    blockNumber;
        uint    blockTimestamp;
        bytes32 requestId;
        uint256 reportedPrice;

    EthPriceAtBlock[] public ethPrices;
    bytes32 jobId;

    constructor(bytes32 _jobId, address linkTokenAddr, address oracleAddr)
        jobId = _jobId;

    function requestEthereumPrice(string _currency)
        public returns (bytes32 requestId)
        ChainlinkLib.Run memory run = newRun(jobId, this, "fulfillEthereumPrice(bytes32,uint256)");
        run.add("url", "https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD,EUR,JPY");
        run.add("path", _currency);
        run.addInt("times", 100);
        requestId = chainlinkRequest(run, LINK(0));

    function fulfillEthereumPrice(bytes32 _requestId, uint256 _reportedPrice)
        public checkChainlinkFulfillment(_requestId)
            blockNumber: block.number,
            blockTimestamp: block.timestamp,
            requestId: _requestId,
            reportedPrice: _reportedPrice
       emit RequestEthereumPriceFulfilled(_requestId, _reportedPrice, block.number, block.timestamp);

    event RequestEthereumPriceFulfilled(
        bytes32 indexed requestId,
        uint256 indexed reportedPrice,
        uint256 blockNumber,
        uint256 blockTimestamp

    function getDataCount()
        public view returns (uint length)
        return ethPrices.length;

    function getData(uint idx)
        public view returns (uint blockNumber, uint256 reportedPrice)
        return (ethPrices[idx].blockNumber, ethPrices[idx].reportedPrice);

Received the following errors:

browser/chainlink.sol:27:59: TypeError: Invalid type for argument in function call. Invalid implicit conversion from literal_string "fulfillEthereumPrice(bytes32,uint256)" to bytes4 requested.
    ChainlinkLib.Run memory run = newRun(jobId, this, "fulfillEthereumPrice(bytes32,uint256)");

browser/chainlink.sol:31:43: TypeError: Type is not callable
    requestId = chainlinkRequest(run, LINK(0));

browser/chainlink.sol:31:43: TypeError: Invalid type for argument in function call. Invalid implicit conversion from tuple() to uint256 requested.
    requestId = chainlinkRequest(run, LINK(0));

Wondering if anyone can help with this. Thank you!

  • 3
    Tip: If there is no specific reason to use exactly this to fetch the ETH price, I would recommend using Oraclize.it - it is well documented and has a plugin in Remix for testing.
    – n1cK
    Jan 8, 2019 at 18:39
  • There is an important why I didn't use Oraclize. I am doing this on Kaleido.io, a private blockchain platform which uses chainlink.
    – Jackson Ng
    Jan 9, 2019 at 12:03
  • 2
    I commented on your answer too: Oraclize also works on eth-compliant private blockchains, via the ethereum-bridge (github.com/oraclize/ethereum-bridge). So you can port over all your existing, Oraclize-using smart-contract architecture no problem!
    – gskapka
    Jan 9, 2019 at 15:21

2 Answers 2


Whilst I can't help specifically with those errors, I can help with creating a smart-contract that gets the current price of ETH in USD using Oraclize per the comment on your question:

pragma solidity 0.5.0;

import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";

contract EthPriceTicker is usingOraclize {

    string public ethPriceUSD;

    event LogEthPrice(string priceUSD);

    function __callback(bytes32 myid, string memory result, bytes memory proof) public {
        require(msg.sender == oraclize_cbAddress());
        ethPriceUSD = result;
        emit LogEthPrice(result);

    function getEthPriceInUSD() public payable {
        oraclize_query("URL", "json(https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD,EUR,JPY).USD");


  • Copy and paste the above into Remix (a solidity IDE)
  • Ensure your have a solc compiler version greater than 0.5 selected.
  • Compile the contract
  • Load the Oraclize plugin from the settings tab at the top right hand side
  • Switch to the run tab and click on deploy
  • Once deployed, expand the tab that appeared below to see the functions in the contract. Then click on getEthPrice& watch the Oraclize plugin do its thing.

Thanks to the folks who suggested Oraclize - which is what I have been using for my projects on the public blockchain. I used Chainlink here because it works with Kaleido.io, a private blockchain platform that I use for my project.

Anyway, Thomas Hodges from ChainLink has helped me with this. These were the changes he made:


ChainlinkLib.Run memory run = newRun(jobId, this,"fulfillEthereumPrice(bytes32,uint256)");


ChainlinkLib.Run memory run = newRun(jobId, this, this.fulfillEthereumPrice.selector);

And from:

requestId = chainlinkRequest(run, LINK(0));


requestId = chainlinkRequest(run, 0);

Now it works just the way it should.

  • 2
    Good work getting it up and running. If you're already familiar with Oraclize, you'll be thrilled to know that Oraclize already works with any eth-compliant private block-chains, via the ethereum-bridge (github.com/oraclize/ethereum-bridge) So you can port over all your existing smart-contracts with no issue!
    – gskapka
    Jan 9, 2019 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.