A Developer is you, if you wish to consume off-chain data from APIs. You do so using Airnodes. An Airnode is a first-party oracle that will push off-chain API data to your on-chain contract. In the diagram below your contract is called a requester. It will make a request to the on-chain RRP protocol contract (AirnodeRrp.sol) that will add the request to the event logs. The off-chain Airnode will access the event logs, get the API data and perform a callback to the requester.
In summary you only need to do two things.
makeTemplateRequest()on the AirnodeRrp.sol contract which returns a
- Add a
myFulfill()function (call it what you like) to your requester (your contract) where the off-chain Airnode can send the requested data when ready. The data includes the same
requestIdreturned when the request was made.
The requester (myContract.sol) makes a request to the RRP protocol contract (AirnodeRrp.sol) by calling `makeFullRequest()` which adds the request to the event logs and returns a requestId to the requester.
Airnode retrieves the on-chain request from the event logs.
Airnode gathers response data from the API specified in the request.
Airnode performs a callback to a named function `myFulfill()` in myContract.sol via the AirnodeRrp.sol function `fulfill()` with the requested data and the requestId.
For a more detailed diagram see the first image in the Calling an Airnode doc.