2

I will try to ask a question based on the use case.

Assume I only use 1 oracle (ignoring the fact decentralization of chainlink oracles) to execute GET call to an API which returns bool information (GET > bool) for 0.01 LINK.

This is happening with the following line of code. See the documentation for more information.

 function checkProof(string memory JobLocation, int customerId) public {
        Chainlink.Request memory req = buildChainlinkRequest(stringToBytes32(JOBID), address(this), this.fulfill.selector);
    
        req.add("get",JobLocation);
    
        req.add("path", "proof");
    
        bytes32 requestId = sendChainlinkRequestTo(ORACLE_ADDRESS, req, ORACLE_PAYMENT);
        
        requestMapping[requestId] = customers[customerId].id;

}
    

Which calls the following function once the API GET result is ready.

    function fulfill(bytes32 _requestId, bool _isProofCorrect) public recordChainlinkFulfillment(_requestId){
         int value = requestMapping[_requestId];
         customers[value]._proof = _isProofCorrect;  
     }

When as an EOA I trigger this function checkProof, this triggers chainlink oracle (Please stop if I am wrong).

Since calling the checkProof function is state changing function (non-pure), it will need to be mined to include in the next block. Each miner executed the transaction (which is calling the API).

Does every miner pay the LINK for the oracle service? or only the miner node (winner miner) pays the LINK to the oracle?

Once the block mined, all the transactions of the block need to be executed.

Does each validator need to pay LINK to trigger the API GET call again to match the result?

3
  • Could you clarify what "EOA" is? Also, I added a suggested title to this question because I think it is what you're trying to ask. If you could please clarify, that would be very helpful. – Patrick Collins Dec 4 '20 at 15:06
  • Thank you so much. EOA (Externally owned account) is just an account, I use metamask, so it would be a metamask account. – blockByblock Dec 4 '20 at 15:07
  • Answered below, looking forward to clarifications so others can understand these important points – Patrick Collins Dec 4 '20 at 15:17
2

Having miners and validators make these API calls is not something that blockchain can do itself, this is actually why Chainlink is so important in the first place. If they did, they would never be able to reach a consensus since there is a very high chance that the API would be different by the time another validator / miner got around to answering.

It's important to know this:

Chainlink nodes subscribe to event logs on-chain. When specific events are emitted, as defined by the ChainlinkClient / Chainlinked contract, the Chainlink node not the miners make the API call. Once the Chainlink nodes get the response from the API call, they then make a transaction, by calling the fulfill function, and place the data in this transaction.

You can learn more about the request & receive Chainlink model in their architecture overview.

By doing it this way, miners and validators can reach a consensus the same way they reach consensus on every other transaction, by validating the transaction and not the data itself.

When working with Price Feeds, the Chainlink system validates the data even their, and not the blockchain itself.

So who pays the link?

The smart contract that makes the request pays the node operator the link. Not the miners or validators.

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.