✴️HTTP Outcalls

Orally Network integrates the HTTPS outcalls feature of the Internet Computer Protocol (ICP) to establish direct connectivity with the Web 2.0 world, opening up a wide range of applications. This ability allows canister smart contracts within Orally Network to interact with APIs and services on the internet, fetch real-time data from various sources, and even communicate with other blockchains.

The Power of HTTPS Outcalls

The majority of the world's API-accessible data today resides on Web 2.0 services, outside the secure confines of the blockchain. Smart contract software often relies on this off-chain data to implement functional use cases. By enabling HTTPS outcalls, Orally Network is unlocking the full potential of smart contracts and paving the way towards blockchain singularity, where most computations run on the blockchain itself.

Overcoming the Oracle Problem

Traditional blockchains face a limitation known as the "oracle problem" where smart contracts can receive messages, but cannot send them to the outside world. Fetching off-chain data typically requires smart contracts to interact with centralized oracle services, which can be expensive, potentially insecure, and depend on intermediaries.

With the introduction of HTTPS outcalls in the Orally Network, this dependency on oracles is eliminated. Canister smart contracts can make HTTPS outcalls to specified URLs to directly obtain off-chain data or interact with off-chain systems, including Web 2.0 services and enterprise IT infrastructure.

How HTTPS Outcalls Work in Orally Network

HTTPS outcalls allow canister smart contracts hosted on the Orally Network to request a URL. Every node in the subnet hosting the smart contract separately requests the URL. Each node then passes the result they obtained to a special function implemented by the requesting canister smart contract using a query call. The aim here is to preprocess the result to make it consistent with the results other nodes have obtained.

If the preprocessed results obtained by query calls to the canister smart contract are sufficiently consistent across all the nodes, the result is agreed upon by consensus and provided back to the smart contract that requested the URL.

Architecture and Consensus Mechanism

The HTTPS outcalls feature is implemented as an extension of the IC protocol stack, showcasing its flexible architecture. The process involves multiple layers of the IC stack, including the execution, consensus, and networking layers.

The HTTPS outcall request lifecycle involves:

  1. A canister makes an HTTPS outcall request which is stored in the replicated state of the corresponding subnet.

  2. The request is forwarded through the HTTP pool manager in the consensus layer to the networking layer, which interacts with the HTTP adapter.

  3. Each HTTP adapter on each node issues the requested HTTPS request to the remote server and returns a response.

  4. The HTTP adapter invokes an optional transform function on the calling canister, ensuring all responses are exactly the same for consensus.

  5. The Consensus layer distributes shares of the response to all peers, allowing the block maker to see that enough peers received the same response.

  6. The response is included in a block and made available to the execution layer, invoking a callback to return the response to the canister asynchronously.

In the event of discrepancies in the responses, a transformation function can be invoked to normalize the data and ensure consensus can be achieved. This function is provided by the canister developer.

Conclusion

By incorporating HTTPS outcalls, the Orally Network enhances the ability of smart contracts to interact directly with the Web 2.0 world. This feature not only eliminates the need for centralized oracles but also adds a new dimension of functionality to the smart contracts, pushing the boundaries of what can be achieved within a blockchain network.

Last updated