Unlocking the Web using HTTPS Outcalls on ICP
How HTTPS Outcalls on the Internet Computer Bridged the Gap between Blockchain and the Real-World Web
The world of blockchain and smart contracts has long been hampered by the limitations of operating in a closed, self-contained environment. Traditional blockchain networks have struggled to connect their on-chain applications and logic to the wealth of data and services available on the open web. This disconnect has been a significant barrier to the wider adoption and utility of smart contract-powered decentralized applications (dApps).
The emergence of the "oracle problem" has been a central challenge in bridging the gap between the blockchain and the broader digital landscape. Developers have relied on centralized Oracle services to fetch off-chain data and integrate it into their smart contracts, but this approach has introduced new trust assumptions, vulnerabilities, and operational complexities.
The Oracle Problem
This problem arises from the fundamental nature of blockchain technology. Smart contracts, by design, can receive messages and update their internal state, but they cannot directly send messages or interact with external systems that are not native to them. This means that it’s easy for a solidity contract to communicate with another solidity contract, but much more harder and complicated to make an api call to a rest API.
This one-way communication model means that smart contracts are largely isolated from the wealth of data and services available on the open web, which is predominantly hosted on traditional, centralized Web2 platforms. What a limitation right?
Oracles → a solution or a new problem?
To overcome this limitation, developers have turned to Oracle services – centralized entities that act as intermediaries, fetching data from external sources and relaying it to smart contracts. While oracles have enabled some level of integration between blockchains and the broader digital ecosystem, they come with their own set of drawbacks.
Trust Assumptions
Oracles introduce additional trust assumptions, as users must trust the Oracle provider to faithfully retrieve and deliver the requested data. But this goes against the foundational structure of blockchains. Blockchains must aim to be fully trustless.
SPOF
They also create potential single points of failure, as the Oracle service itself can become a vulnerability if compromised or disrupted.
HTTPS Outcalls
The Internet Computer, a revolutionary blockchain platform developed by DFINITY, has introduced a game-changing solution to the oracle problem – HTTPS outcalls. This feature allows smart contracts, known as "canisters" on the Internet Computer, to directly make HTTPS requests to external data sources and services, effectively bridging the gap between the blockchain and the broader Web2 world.
Under the hood, HTTPS outcalls work by placing the HTTP request in the subnet's replicated state. Each replica of the Internet Computer then independently makes the same request and reaches a consensus on the response, which is then delivered back to the originating canister. This approach ensures that the integrity of the data is maintained, as the decentralized network of replicas verifies the response, eliminating the need for a centralized Oracle service.
This approach solves two major problems created by oracles, which are:
Trust Assumptions: Now developers no longer need to trust a centralized service to be honest and not manipulate data responses.
SPOF: HTTP requests are executed by decentralized replicas on the Internet Computer and need to reach a consensus state before the response is returned. If a replica is down or unreachable, the canister will still work.
Use Cases for HTTPS Outcalls
The ability to make direct HTTPS outcalls from smart contracts opens up a vast array of new use cases for blockchain-powered applications. Some key examples include:
Retrieving real-time market data: Canisters can directly fetch cryptocurrency exchange rates, stock prices, and other financial data from Web2 APIs, enabling the development of decentralized finance (DeFi) applications that can accurately track and respond to market fluctuations. An example live on ICP is the Exchange Rate canister - https://internetcomputer.org/docs/current/developer-docs/defi/exchange-rate-canister.
Integrating with other blockchains and Web2 services: HTTPS outcalls allow for seamless integration between the Internet Computer and other blockchain networks, as well as traditional Web2 services, enabling cross-chain communication and the development of interoperable dApps.
Sending notifications and communications: Canisters can use HTTPS outcalls to trigger external actions, such as sending emails, SMS messages, or push notifications, enhancing the user experience and enabling new use cases for decentralized applications.
Accessing IoT data, weather forecasts, sports scores, and more: The possibilities for HTTPS outcalls extend far beyond financial data, as canisters can directly retrieve a wide range of information from various Web2 sources, unlocking new opportunities for innovative dApps.
Success Stories
A. Exchange Rate Canister (XRC)
To demonstrate the power of HTTPS outcalls, the DFINITY team has developed the Exchange Rate Canister (XRC) – a smart contract that fetches real-time cryptocurrency exchange rates directly from major exchanges, without the need for any centralized oracle services.
The XRC canister leverages HTTPS outcalls to query public APIs offered by leading cryptocurrency exchanges, such as Coinbase and Binance, to retrieve the latest prices for a variety of digital assets. It can then provide this data to other canisters, enabling the development of decentralized exchange (DEX) applications and other DeFi tools that require accurate and up-to-date market information.
By eliminating the reliance on oracles, the XRC demonstrates how HTTPS outcalls can simplify the integration of blockchain-based applications with the broader digital ecosystem, paving the way for greater innovation and adoption in the Web3 space.
PatriotAI extensively used HTTPS outcalls to send prompts to OpenAI Assistant API and query run status periodically on a canister. It was able to offer personalized experiences to users of the learning platform by utilizing a generative AI provider, OpenAI, to generate questions to test learners on their progress through course modules.
By eliminating the need for oracles, PatriotAI can provide its users with a trustless and readily available environment to learn and train themselves about corruption.
The Impact of HTTPS Outcalls
The introduction of HTTPS outcalls on the Internet Computer has the potential to revolutionize the way blockchain-based applications interact with the wider digital landscape. By removing the need for centralized oracle services, HTTPS outcalls eliminate the associated trust assumptions, vulnerabilities, and operational complexities, allowing developers to focus on building innovative and reliable decentralized applications.
This paradigm shift unlocks a wealth of new use cases for smart contracts, as they can now directly access a vast array of data and services available on the open web. From DeFi applications that leverage real-time market data to dApps that seamlessly integrate with other blockchains and Web2 services, the possibilities are vast and exciting.
As more developers explore and leverage the power of HTTPS outcalls, we can expect to see a surge of innovation and adoption in the Web3 space. By bridging the gap between blockchain and the broader digital world, HTTPS outcalls have the potential to accelerate the path towards true blockchain singularity, where the majority of computations and interactions occur on decentralized platforms.
Takeaway
The introduction of HTTPS outcalls on the Internet Computer blockchain represents a significant breakthrough in the ongoing quest to integrate blockchain technology with the wider digital ecosystem. By allowing smart contracts to directly fetch data and interact with external services, this feature overcomes the limitations of traditional oracle-based approaches and opens up a world of new possibilities for decentralized applications.
As developers continue to explore and harness the power of HTTPS outcalls, we can expect to see a surge of innovation in the Web3 space, with applications that seamlessly bridge the gap between blockchain and the broader digital landscape. This technology has the potential to catalyze the widespread adoption of decentralized solutions, paving the way for a future where the majority of our digital interactions and computations occur on secure, transparent, and autonomous blockchain networks.