4

I run this code from the chainlink documentation but didn't get the image.

function requestBytes() public returns (bytes32 requestId) {
    address oracle = "0xc57B33452b4F7BB189bB5AfaE9cc4aBa1f7a4FD8";
    bytes32 specId = "7a97ff8493ec406d90621b2531f9251a";
    uint256 payment = 100000000000000000;
    Chainlink.Request memory req = buildChainlinkRequest(specId, address(this), this.fulfillBytes.selector);
    req.add("get","https://ipfs.io/ipfs/QmZgsvrA1o1C8BGCrx6mHTqR1Ui1XqbCrtbMVrRLHtuPVD?filename=big-api-response.json");
    req.add("path", "image");
    return sendChainlinkRequestTo(oracle, req, payment);
}

event RequestFulfilled(
    bytes32 indexed requestId,
    bytes indexed data
);

function fulfillBytes(
    bytes32 requestId,
    bytes memory bytesData
)
    public
    recordChainlinkFulfillment(requestId)
{
    emit RequestFulfilled(requestId, bytesData);
    data = bytesData;
    url = string(data);
}
General Grievance
  • 4,555
  • 31
  • 31
  • 45
yamna iftikhar
  • 103
  • 1
  • 5
  • I just tried running this example from the docs on Kovan, and it worked fine. Can you try again? Steps I took were compile the project in remix, deploy on kovan, fund with some LINK, execute the request_bytes function, wait 30 secs, then execute the data and image_url getter functions to see the results https://remix.ethereum.org/#optimize=false&evmVersion=null&runs=200&version=soljson-v0.8.6+commit.11564f7e.js&url=https://github.com/smartcontractkit/documentation/blob/main/_includes/samples/APIRequests/GenericBigWord.sol – Harry Papacharissiou Aug 23 '21 at 01:06
  • 1
    where do you get kovan testnet ?? – yamna iftikhar Aug 23 '21 at 19:21
  • I deployed the example contract code to the Kovan public testnet using MetaMask. Where were you deploying it to? – Harry Papacharissiou Aug 24 '21 at 07:20
  • 1
    I tried to deploy rinkeby test network as I don't have the Kovan public testnet. – yamna iftikhar Aug 25 '21 at 08:03
  • @yamnaiftikhar Can you share the contract address on the Rinkeby testnet as well as the transaction invoking the `requestBytes()` function? – Petr Hejda Dec 25 '21 at 19:37
  • @PetrHejda here is an example using the same code: https://kovan.etherscan.io/tx/0x1d1fd1385f4eecb9e05ef4bded4282c46f3301716081eb24b3f99349f654102a – Roch Dec 26 '21 at 16:04
  • Thank you @Roch. My reason behind asking OP for their tx details is searching for the issue in the actual transaction - such as incorrect `data`, insufficient LINK balance, possibly using a call instead of a tx (if there's no tx hash), ... – Petr Hejda Dec 26 '21 at 16:16

0 Answers0