Web APIs & Web3 – Devops

The popularity of blockchain-based applications is growing and underscores the decentralized movement of Web3. At the same time, Web APIs help provide reusable data and functionality for all types of applications and stimulate microservice development practices. So how do you reconcile these two paradigms?
In many cases, a blockchain-based smart contract can request data updates that only a web API request can satisfy. For example, perhaps a smart contract needs to access the latest price of a particular stock. Or maybe the actions in the chain depend on the weather at a particular time.

The ubiquity of APIs means there are thousands of useful functions available to accomplish the task at hand. However, integrating them into Web3 applications is difficult. Interestingly, the API3 Alliance is making big strides in implementing an industry standard solution for embedding APIs in Web3 applications. API3 provides a vendor-neutral standard gateway to apply to existing APIs to help them attract decentralized applications.
The Vendor Independent Alliance API already consists of many APIs for different verticals and seems to be gaining traction. I recently met with API3 co-founder Heikki Vanttinen to learn more about the challenges of integrating traditional web APIs into blockchain development. While previous solutions relied on third-party middleware or “oracle”, Vanttinen said, the best way to embed an API request and response system into smart contracts is through a node managed by the API provider itself.

Such a system could help blockchain applications leverage a variety of software-as-a-service solutions that effectively connect the two worlds. The number of APIs is growing exponentially. As businesses re-embrace digital transformation, APIs are becoming the glue between the applications we use on a daily basis. When it comes to APIs, there are more and more potential use cases for blockchain: the technology isn’t just about cryptocurrency; rather, it can work in a variety of scenarios that require smart registers. Since APIs govern most of the functionality in modern software development, it makes sense that they can be useful when developing decentralized applications.
For example, a blockchain-based decentralized finance (DeFi) application that manages loans and borrowings may want to call an API to collect raw data for a settlement price, Vanttinen says. Or, a smart contract may want to purchase the value of an asset as a condition for making a purchase.

Connecting to public APIs to check local weather or flight arrival information may affect the way the smart contract responds. There are many options for using APIs in a distributed ledger system. However, “blockchain applications cannot directly call APIs,” explains Vanttinen.

According to Vanttinen, the incompatibility stems from the nature of blockchain technology, as multiple parties need to agree to maintain smart contracts. For this reason, blockchain applications require middleware to connect a blockchain node to an API that translates responses to data from outside the chain. As Vanttinen described, previous attempts to connect APIs to Web3 architectures have involved a third party middleware host.
However, this outsourcing of integration responsibility creates a centralized point of failure that completely negates the goal of a decentralized environment. Rather than relying on such a dependency, Vanttinen advocates an “Oracle’s own approach,” in which API providers are one level ahead of their APIs.

This enables a request-response mechanism for smart contracts, allowing blockchain applications to initiate API requests from the chain and embed responses into contracts. This method maintains the immutability and lack of trust inherent in a distributed ledger.

One solution that provides this architecture is Airnode, which is a Web3 middleware that can directly connect any Web API to any blockchain application. Companies that embrace Airnode are forming the API3 Alliance, which is “a collection of API vendors who have signed up to authorize the first part of their API for Web3 applications,” Vanttinen said. “The adoption of Airnode is the commitment of API companies to make their APIs compatible with the blockchain.” The API3 alliance is an important move to empower smart contracts and blockchain applications.
This can allow such environments to call APIs to send text messages or emails or record sports scores, collect map data, etc. Currently, the APIs participating in the API3 alliance come from industries such as agriculture, biotechnology, communications, and open banking. , Insurance, supply chain management, etc. The program also accepts applications from API vendors who wish to enter the market.

So what are the benefits of using standard middleware to connect web APIs to the blockchain? Well, according to Vanttinen, this is the best way to enable sophisticated computing off the web. Implementing complex on-chain processing is resource intensive, resulting in high transaction fees. By extending highly complex computing outside of the system, blockchain applications can reduce transaction costs.

“The industry is long overdue for the connection between the real world and the blockchain,” Vanttinen said. Having a standard implementation can also reduce the burden on the API developer to support thin technologies. While other solutions will require someone to manage the blockchain nodes, Airnode is more of a plug-and-play API gateway that can be deployed on AWS as a Lambda function, Vanttinen said. This usability allows API-based services to easily engage Web3 applications, thereby quickly opening up a new segment of potential growth. Of course, Vanttinen acknowledged, the concept of synchronization with off-chain processes is still in its early stages.
There are competing worldviews on how to deal with this in the marketplace, and some fundamental questions have yet to be resolved. For example, most of the effort has focused on read operations to capture raw data. The next step is to incorporate offline write capabilities into the oracle middleware.

In addition, more PubSub-like formats will be essential to include event listeners that can provide high quality response. The Web3 trend is leading to more decentralized blockchain-based applications. But such applications cannot work in a closed world.

To experience the full range of digital possibilities, they will likely need to understand how to enable off-grid computing and integrate it with alternative communications software libraries. Of course, this will require integration with web APIs, which have become an important cloud-based way of communicating. “The API3 Alliance is here to offer a solution to the Web3 API connectivity problem,” Vanttinen said. The importance of this becomes clearer when it comes to connecting standalone services and microservices using smart contracts. ” Airnode and the surrounding API3 Alliance is an initiative that encourages API and smart contract connectivity.
But this is only one method in an evolving field. What do you think about combining the two paradigms? Comment on your experience below!