📂 Developers

# Overview

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 pushes off-chain API data to your on-chain contract. In the diagram below, your contract is called a requester. It makes a request to the on-chain RRP protocol contract (AirnodeRrpV0.sol) that adds the request to the event logs. The off-chain Airnode then accesses the event logs, gets the API data and performs a callback to the requester.

In summary, you only need to do two things.

  • Call makeFullRequest() or makeTemplateRequest() on the AirnodeRrpV0.sol contract, which returns a requestId.
  • 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 requestId as the one returned at the time of making the request.
  1. The requester (myContract.sol) makes a request to the RRP protocol contract (AirnodeRrpV0.sol) by calling makeFullRequest() which adds the request to the event logs and returns a requestId to the requester.

  2. Airnode retrieves the on-chain request from the event logs.

  3. Airnode gathers response data from the API specified in the request.

  4. Airnode performs a callback to a named function myFulfill() in myContract.sol via the AirnodeRrpV0.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.

Last Updated: 8/9/2022, 3:28:25 PM