I am using the example from chainlink to call an API; however, I am not sure it does.

function checkProof(string memory JobLocation, int job_id) public {
   Chainlink.Request memory req = buildChainlinkRequest(stringToBytes32(JOBID), address(this), this.fulfill.selector);


   req.add("path", "proof");

   sendChainlinkRequestTo(ORACLE_ADDRESS, req, ORACLE_PAYMENT);

I know it calls the following function

 function fulfill(bytes32 _requestId, bool _isProofCorrect, unit val) public recordChainlinkFulfillment(_requestId){
        customers[1].proof = _isProofCorrect;

But, what does selector do in the above code (this.fulfill.selecor)?

1 Answer 1


what does selector do in the above code (this.fulfill.selecor) ?

In your buildChainlinkRequest function, it takes 3 arguments:

  • bytes32 _specId
  • address _callbackAddress
  • bytes4 _callbackFunctionSignature

The bytes4 _callbackFunctionSignature tells the Chainlink node what method to call when it returns the data. It is known as a function selector, and it allows the node to specify exactly what it needs to call back, in your case the fulfill function.

Also, how can I pass an argument to the fulfill function? I am trying to update the proof variable of my customers map by using what chainlink calls.


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.