Search code examples
blockchainsolidity

Where to get Oracle and JobID?


I am working on making a smart contract using Chainlink oracles, and I’ve run into this issue. I have an API call that I want to make, but I’m not sure which nodes/oracles I should call. They give some sample nodes, but if I understand the technology properly, I should be able to call my own nodes. Where can I find this information? I know it needs to return a bytes32.

Oracle = // TODO
JOB = // TODO  
function requestJoke() public
  {
    Chainlink.Request memory req = buildChainlinkRequest(JOB, address(this), this.fulfill.selector);
    req.add("get", "https://sv443.net/jokeapi/v2/joke/Any");
    req.add("path", "joke");
    sendChainlinkRequestTo(ORACLE, req, ORACLE_PAYMENT);
  }

Solution

  • To make a chainlink oracle request, you can use any oracle that has a job that can return a bytes32.

    You can look for and find Oracle contract address and Job IDs on sites such as market.link. The other important thing to note is that each Ethereum network (mainnet, ropsten, kovan, etc) each have different ID and addresses. You'll also need to differentiate between a GET and a POST request, you can also see the chainlink docs for more information.

    An easy one would be to use the Alpha Chain oracles.

    // A get request for bytes32 on Ropsten
    address ORACLE = 0xB36d3709e22F7c708348E225b20b13eA546E6D9c;
    bytes32 JOBID = "de6ad2f87c6b42679777dc658a93705c";
    
    // This JOBID returns a bytes32 object