1

I've been following instructions on running a local Chainlink node on Kovan. My environment is configured to Kovan through websockets via Infura and the node is both running and successfully accepts ETH and LINK transfers over Kovan: Chainlink node with ETH and LINK transfers over Kovan

The sample Oracle.sol contract was deployed on Kovan 0xa36085F69e2889c224210F603D836748e7dC0088 and the address of the node set with true value under setFulfillmentPermission: Oracle.sol deployment on Kovan

I created a sample job with toml that creates successfully and generates a public job id: job with public id

The job id above is "5bdce20f-e3ef-4aa9-b5e2-89e1b523ca7d" and I set this in my contract as "5bdce20fe3ef4aa9b5e289e1b523ca7d". No matter the implementation, I have not been able to identify any runs on my console and they fail each time. This includes two variations of sample contracts I have been unsuccessful to transmit the run: sample contract fail

Besides reverting to an earlier version to deploy a node that transacts jobs under v1, I don't know how to go about debugging and getting the local node to acknowledge a run. Looking for help. Please let me know if there's any specific info I can provide to help.


  1. Oracle.sol smart contract deployed at address 0x2559c36Aee1dC9231d679D9b456265a46049dBfD
  2. node wallet at address 0x58320a1e8377b6143614944b5418E71FEE35D7a8
  3. job id 5bdce20f-e3ef-4aa9-b5e2-89e1b523ca7d

sample contracts:

ATestnetConsumer method RequestEthereumChange called with "0x2559c36Aee1dC9231d679D9b456265a46049dBfD", "5bdce20fe3ef4aa9b5e289e1b523ca7d" results in error:

status  false Transaction mined but execution failed
transaction hash    0xa5df1f36059f45b7b8f400166d0a2cd12654a4987e7129a0551e9fcb64b5fb9e
from    0x4de15D18F9dF69B52E249D5033458ecf4acc547d
to  ATestnetConsumer.requestEthereumChange(address,string) 0xE4492b62b2a1D27Fb694eD6AcAC05C4e5ee6E63A
gas 3000000 gas
transaction cost    2954345 gas 
hash    0xa5df1f36059f45b7b8f400166d0a2cd12654a4987e7129a0551e9fcb64b5fb9e
input   0x619...13764
decoded input   {
    "address _oracle": "0x2559c36Aee1dC9231d679D9b456265a46049dBfD",
    "string _jobId": "5bdce20fe3ef4aa9b5e289e1b523ca7d"
}
decoded output   - 
logs    []
val 0 wei

APIConsumer method requestVolumeData results in error with following implementation:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

import "@chainlink/contracts/src/v0.8/ChainlinkClient.sol";

/**
 * THIS IS AN EXAMPLE CONTRACT WHICH USES HARDCODED VALUES FOR CLARITY.
 * PLEASE DO NOT USE THIS CODE IN PRODUCTION.
 */
contract APIConsumer is ChainlinkClient {
    using Chainlink for Chainlink.Request;
  
    uint256 public volume;
    
    address private oracle;
    bytes32 private jobId;
    uint256 private fee;
    
    /**
     * Network: Kovan
     * Oracle: 0xc57B33452b4F7BB189bB5AfaE9cc4aBa1f7a4FD8 (Chainlink Devrel   
     * Node)
     * Job ID: d5270d1c311941d0b08bead21fea7747
     * Fee: 0.1 LINK
     */
    constructor() {
        setPublicChainlinkToken();
        oracle = 0x2559c36Aee1dC9231d679D9b456265a46049dBfD;
        jobId = "5bdce20fe3ef4aa9b5e289e1b523ca7d";
        fee = 0.1 * 10 ** 18; // (Varies by network and job)
    }
    
    /**
     * Create a Chainlink request to retrieve API response, find the target
     * data, then multiply by 1000000000000000000 (to remove decimal places from data).
     */
    function requestVolumeData() public returns (bytes32 requestId) 
    {
        Chainlink.Request memory request = buildChainlinkRequest(jobId, address(this), this.fulfill.selector);
        
        // Set the URL to perform the GET request on
        request.add("get", "https://min-api.cryptocompare.com/data/pricemultifull?fsyms=ETH&tsyms=USD");
        
        // Set the path to find the desired data in the API response, where the response format is:
        // {"RAW":
        //   {"ETH":
        //    {"USD":
        //     {
        //      "VOLUME24HOUR": xxx.xxx,
        //     }
        //    }
        //   }
        //  }
        request.add("path", "RAW.ETH.USD.VOLUME24HOUR");
        
        // Multiply the result by 1000000000000000000 to remove decimals
        int timesAmount = 10**18;
        request.addInt("times", timesAmount);
        
        // Sends the request
        return sendChainlinkRequestTo(oracle, request, fee);
    }
    
    /**
     * Receive the response in the form of uint256
     */ 
    function fulfill(bytes32 _requestId, uint256 _volume) public recordChainlinkFulfillment(_requestId)
    {
        volume = _volume;
    }

    // function withdrawLink() external {} - Implement a withdraw function to avoid locking your LINK in the contract
}
7
  • hi @aug2uag, at what point does it fail. Does the job request not even reach the node and it fails in your function call on-chain? If so, can you please update your post with the function code that you are calling, and specify the passed in parameters? If it's reaching the node but failing at the node, please post the full json output of the job that fails Oct 24, 2021 at 23:21
  • @HarryPapacharissiou thanks for your response. That's correct, the job does not reach the node and fails on-chain. The list of runs is empty and says No jobs have been run yet. Included implementation details as edit above.
    – aug2uag
    Oct 25, 2021 at 0:14
  • what's the error that's given? your consumer contract above is different from the remix screenshot further up that shows an error (requestEthereumChange function). I threw the APIConsumer above into remix and it worked ok. If you're using the contract further up (the requestEthereumChange function), then suggest try changing the jobId param input to a string, and then converting it to bytes32 with a function like this example here, remix can be a bit funny with passing in byte32 as params. github.com/smartcontractkit/hardhat-starter-kit/blob/main/… Oct 25, 2021 at 13:10
  • @HarryPapacharissiou "I threw the APIConsumer above into remix and it worked ok", I'm certain the APIConsumer would work, yet with a local jobs v2 node deployment on Kovan is not working for me. The node is functional and job is created, however a run is never created. Have you tried deploying to Kovan from the latest codebase and deploying v2 job as above? I pasted the error for requestEthereumChange, it is the same result for requestVolumeData. I can't keep dashes in the jobId, it doesn't fit to bytes32 constraint.
    – aug2uag
    Oct 25, 2021 at 18:27
  • @HarryPapacharissiou the .env file for my node was configured from online resource and includes LINK_CONTRACT_ADDRESS=0xa36085F69e2889c224210F603D836748e7dC0088, it's not clear what this contract should be pointing to, the deployed Oracle.sol or leave the default val?
    – aug2uag
    Oct 26, 2021 at 4:26

1 Answer 1

1

what I did wrong, in case it helps others:

  1. jobs are highly specific pipelines, in tutorials make sure your job correlates to the smart contract
  2. the contract may require to be funded with LINK, make sure the contract is funded if it's required

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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