I am trying to call to an BSC Oracle to make an HTTP request according this ChainLink example. In my example I am goin to use the BSC mainnet 56 and a other JobID obviously:

My steps:

  1. I created the contract with this zenAPIs get request contract and jobID over the BSC Mainnet:

  2. I deployed the contract to the BSC Mainnet. There was an error, but the contract seems created.

The BSCScan transaction.

  1. I funded the contract with ERC677 LINK and the BSC accepted it. (I used this Chainlink official swap for change the Binance sent links to my wallet: https://pegswap.surge.sh/)

  2. I called the requestEthereumPrice() function and the BSC return OK.

  3. I get the "currentPrice" var and REMIX return this error:

"Failed to decode output: Error: data out-of-bounds (length=0, offset=32, code=BUFFER_OVERRUN, version=abi/5.0.7)"

The contract:

 * Network: Binance Smart Chain - Mainnet
 * ZenApis. Job: HTTP get: 
 * https://market.link/nodes/fd5a3998-75bb-4705-9f34-b51f02ed5f0e?network=56
 * https://market.link/jobs/5ddd8a96-8840-4b55-9163-f07674c8c004/spec?network=56
 * Oracle: 0x074715cc07fC0Df9c617F22971Fb2Ff1b1f57278
 * Job ID: c734c40b377544f08a7324f36bda4940 //https://market.link/jobs/5ddd8a96-8840-4b55-9163-f07674c8c004/spec?network=56 
 * Fee: 0.02 LINK
 * LINK Token Address: 0x404460c6a5ede2d891e8297795264fde62adbb75
 * Video tutorial: https://www.youtube.com/watch?v=AtHp7me2Yks

// SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.6.0;

import "https://raw.githubusercontent.com/smartcontractkit/chainlink/develop/evm-contracts/src/v0.6/ChainlinkClient.sol";

contract ChainlinkExample is ChainlinkClient {
  // Stores the answer from the Chainlink oracle
  uint256 public currentPrice;
  address public owner;

  address ORACLE_ADDRESS = 0x074715cc07fC0Df9c617F22971Fb2Ff1b1f57278;
  string constant JOBID = "c734c40b377544f08a7324f36bda4940";

  uint256 constant private ORACLE_PAYMENT = 20000000000000000;// 16 0s = 0.02 LINK  

  constructor() public {
    // Set the address for the LINK token for the network
    owner = msg.sender;
  // Creates a Chainlink request with the uint256 multiplier job
  function requestEthereumPrice() public onlyOwner{
    Chainlink.Request memory req = buildChainlinkRequest(stringToBytes32(JOBID), address(this), this.fulfill.selector);
    req.add("get", "https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD");//{"USD":1797.12}
    req.add("path", "USD");
    req.addInt("times", 100);
    sendChainlinkRequestTo(ORACLE_ADDRESS, req, ORACLE_PAYMENT);

  // fulfill receives a uint256 data type
  function fulfill(bytes32 _requestId, uint256 _price) public recordChainlinkFulfillment(_requestId) { // Use recordChainlinkFulfillment to ensure only the requesting oracle can fulfill
    currentPrice = _price;
  // cancelRequest allows the owner to cancel an unfulfilled request
  function cancelRequest(bytes32 _requestId, uint256 _payment, bytes4 _callbackFunctionId, uint256 _expiration) public onlyOwner {
    cancelChainlinkRequest(_requestId, _payment, _callbackFunctionId, _expiration);

  // withdrawLink allows the owner to withdraw any extra LINK on the contract
  function withdrawLink() public onlyOwner{
    LinkTokenInterface link = LinkTokenInterface(chainlinkTokenAddress());
    require(link.transfer(msg.sender, link.balanceOf(address(this))), "Unable to transfer");
  modifier onlyOwner() {
    require(msg.sender == owner);
   // A helper funciton to make the string a bytes32
  function stringToBytes32(string memory source) private pure returns (bytes32 result) {
    bytes memory tempEmptyStringTest = bytes(source);
    if (tempEmptyStringTest.length == 0) {
      return 0x0;
    assembly { // solhint-disable-line no-inline-assembly
      result := mload(add(source, 32))

1 Answer 1

  1. You can test on any EVM compatible testnet when working with API calls. You don't have to use the BSC testnet. A working oracle from Kovan, Rinkeby, etc will work fine. This way, you can test before going mainnet.

  2. Each oracle on mainnet can whitelist contracts. enter image description here

This is an image taken from the job that you're using from mainnet.

  1. It looks like this node doesn't have much activity on it. It could also be the case that this oracle isn't accepting jobs at the moment.

My recommendation: Test on a testnet first, and confirm that the node found in the marketplace is accepting jobs. If you can't, DM someone in the node-operator-requests channel of the Chainlink discord, and I'm sure someone will help you.

  • Thanks Patrick. I already saw this warning to get whitelisted for running the job, but I cant found any way to contact with the node owner (ZenAPIs) ...
    – JTCon
    Mar 23, 2021 at 16:05
  • Are you just testing? Why not just test on a testnet? Mar 23, 2021 at 16:15
  • Hi Patrick. I am following your advice and I am testing with Kovan first to understand. Seems that all works, but finally the price is not returned. Do you know if it's because I'm not whitelisted by the node? I am using this AlphaChain Job market.link/jobs/f870737d-7550-4ec9-a009-eb596719dff8/…
    – JTCon
    Mar 24, 2021 at 20:40
  • There is a good chance that node is actually hitting API limits with that API. Can you try a different API call? Mar 24, 2021 at 21:26
  • Of course! I tried with this other API call and the price dont change again. req.add("get", "api.binance.com/api/v1/ticker/price?symbol=ETHUSDT"); req.add("path", "price"); req.addInt("times", 100000000);
    – JTCon
    Mar 24, 2021 at 22:39

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.