paint-brush
Using Decentralized APIs to Build Meaningful DAppsby@api3
754 reads
754 reads

Using Decentralized APIs to Build Meaningful DApps

by API3March 7th, 2023
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

API3 is simplifying how Web3 builders access real-world data. Their first-party oracle enables data providers to be an API gateway for blockchains. For developers, access to secure, transparent, and decentralized data feeds will be available on Fantom alongside API3’s oracle tooling.
featured image - Using Decentralized APIs to Build Meaningful DApps
API3 HackerNoon profile picture

API3 is simplifying how Web3 builders access real-world data by solving the API connectivity problem. Their first-party oracle enables data providers to be an API gateway for blockchains, eliminating the need for third-party middlemen. For developers, access to secure, transparent, and decentralized data feeds through Airnode-enabled APIs will be available on Fantom alongside API3’s oracle tooling.

Overview

The demand for developer tooling and infrastructure services has exponentially increased alongside the increasing number of engineers building decentralized applications (dApps). Ultimately, tools such as oracles provide the ability to realize the potential of decentralized protocols by building meaningful on-chain applications.

The ability to utilize real-world data provided by traditional API Providers in a smart contract has been a problem only recently solved by the introduction of API3’s Airnode. However, solving the API connectivity problem is only half the battle.

What is a dAPI?

By simplifying how real-world data is accessed by smart contracts, API3 has designed a simple interface for developers to access and manage data feeds: dAPIs.


A dApp is an application that is implemented as a smart contract that runs on a decentralized blockchain. By the same token, a dAPI is an API-like service that is delivered to smart contracts. In simpler terms, just as applications use APIs, dApps will use dAPIs.


Burak Benligiray - Core Technical Lead API3 DAO


Through a dAPI the consumption of data feeds becomes simple. The dAPI interface provides access to continuously updated streams of off-chain data, such as the latest cryptocurrency, stock, and commodity prices.

Understanding the dAPI Interface

A key part of the API3 toolkit is dAPIs. These managed API services are specifically engineered for smart contracts to mimic traditional Web APIs. dAPIs possess a range of distinct attributes:


  • dAPIs have a standardized, user-friendly interface that intends to abstract away the technical implementation.
  • A dApp uses the dAPI interface to access data feed services. These services exist in a fully permissionless or authorized format.
  • dAPIs exist entirely on-chain as smart contracts and use first-party oracles served in a variety of data feed services such as self-funded or managed dAPIs (more on this later).
  • Through a dAPI smart contract, developers can access additional services such as Service Coverage or Oracle Extractable Value.

dAPI Services: Self-Funded & Managed Data Feeds

A dAPI enables smart contracts to access continuously updated streams of data. However, these streams of data can be accessed in a range of different data feed services to suit the requirements of an application.


Through a dAPI, developers will be able to request two types of data feed services:

  1. Self-funded dAPIs provide developers with the tools to use single-source data feed services with minimal associated costs and no upfront commitment, served in a fully permissionless fashion through the API3 Market. Once gas funds have been provided in the oracle sponsor wallet a dAPI will begin automatically post data on-chain when price deviation thresholds are met.

  1. Managed dAPIs are sourced from multiple first-party oracles and aggregated using a median function. Compared to self-funded dAPIs, managed dAPIs require user authorization through the API3 Market. Accessing dAPIs means builders can utilize secure and accurate data in their DeFi protocols and dApps, with managed data feeds providing additional benefits to security and decentralization as well as the API3 DAO overseeing oracle management.

The oracles serving dAPIs will be operated by reputable data providers, with source transparency being realized through the first-party oracle architecture.

Accessing a dAPI is Simple: API3 Market

For users to access dAPIs, they can head to the API3 Market and explore all the dAPIs available on a range of EVM-compatible chains as well as their testnets.


To use the novel self-funded dAPI mechanism the user will be required to fund the sponsor wallet of the respective data feed with gas to activate it. The amount of gas supplied will determine how long your dAPI will be available for use. If the dAPI runs out of gas, it can be funded again to keep it available for use.


After funding the dAPI, the final step for the user will be to deploy a proxy contract to access the dAPI. Now the developer can easily set the proxy contract address in his contract and start reading from the dAPIs.

dAPI proxies allow dAPIs to be used like libraries. The smart contract just needs to import the interface for calling the proxy contract. To read a different dAPI, the contract does not need to change the code itself, rather it only needs to use a different proxy address when calling the read() function on the proxy contract.

Summary

dAPIs will provide the DeFi ecosystem with access to first-party oracle services across dozens of EVM chains. By leveraging API3's decentralized infrastructure, developers can build increasingly complex and useful dApps that are resistant to downtime, censorship, and data tampering.


By facilitating the economy between Web3 developers and API Providers, API3 is expanding the capability of the blockchain to solve real-world problems, while protecting the core principle of decentralization.