A Call for Off-Chain Computation on Algorand
Tips & Tricks

A Call for Off-Chain Computation on Algorand

As modern dApps grow in complexity on Algorand, so too must the infrastructure, specifically oracles, to support far greater and richer feature sets. Algoracle's thoughts on off-chain computation int he Algorand ecosystem.

Algorand Consensus Enabling the Future of Oracle Off-Chain Computation

As smart contracts alone cannot access outside data, all Web3 technology sits on the fundament of the most critical of blockchain middleware, oracles. The current generation of decentralized oracle networks works to bridge real-world, off-chain data onto blockchains, providing dApps everything from price feeds to Super Bowl results. However, as modern dApps grow in complexity, so too must oracles mature and evolve to support far greater and richer feature sets.

The next great frontier in oracle development lies in advancing off-chain computation, in which oracles enable the processing of far more sophisticated programming logic and data aggregation requests on behalf of smart contracts in a permissionless manner, all before reporting the data on-chain. Improving and streamlining the functionality of oracle off-chain computation not only vastly upgrades smart contract execution, cost efficiency and scalability, but also enables and brings dApps excellent quality of life features we take for granted in Web2, such as push notifications and transaction automation all without have to depend on multiple services with different levels of centralization.

In this article we examine the importance of off-chain computation in greater detail, its current state among oracles today, and how Algoracle, an Algorand-based oracle service, is building a unified interface using Algorand’s Pure Proof of Stake (PPoS) consensus to add specific advantages in decentralized oracle network design.

The Increasing Necessity of Off-Chain Computation

As teams develop more sophisticated dApps, it is easy to imagine that the types of data sourcing, manipulation, and computation begin to grow ever more complex. Generally an application will need to pull data from multiple sources, while applying specific parameters and filtering logic. Aggregating data from multiple APIs, selected statistical methods, and differing data types such as numerical and boolean means that these operations become complicated very quickly. As such, more efficient ways to perform off-chain computation and apply logic to different scenarios and use cases are of tantamount importance.

Today, most EVM oracles provide basic methods to request specific APIs that enable customers to indicate what path or JSON from which to deliver data, but do not natively support data aggregation logic. Often, aggregated data feeds must be set up or facilitated on a case-by-case basis, leading to centralization of data and inflexibility when it comes to logic application.

From a developer’s standpoint, a far better oracle architecture would open up off-chain data aggregation for general computation. In other words, oracles should run in a similar fashion to layer 2 smart contracts, where any high level programming language could be used to run trustless logic. Builders should have access to a unified interface with this objective baked in from the start.

Unfortunately, these critical quality-of-life upgrades and enhancements are very difficult to implement in existing V1.0 oracles due to legacy code and the need to manage backwards compatibility for existing clients. Attempting to roll out features that would better enable off-chain computation in current state oracles would be akin to adding new pieces to an airplane already in flight. As a result, despite best intentions, V2.0 updates rolling out for most oracles still leave developers managing many different interfaces, both for data feeds and layer 2 tasks.

The team behind Algoracle is focused on designing such a unified interface with off-chain computation specifically in mind, enabled by the clever application of Algorand consensus.

Algorand Consensus & VRFs

The beauty of Algorand’s Pure Proof of Stake (PPoS) consensus is that its benefits can easily be replicated sensibly for oracle data. Built on Byzantine consensus, the PPoS approach evades typical Proof-of-Stake (PoS) security problems by buttressing the network with a focus on an honest majority without prejudice based on each validator’s total stake. In other words, in lieu of forced token lockups and the danger of large stakeholders exerting monopolistic control over the network in PoS, PPoS introduces an egalitarian method that randomly selects validators among the entire validator body, removing barriers to entry and the requirement for minimum stake. This random selection process, or Verifiable Random Function (VRF) cryptographic sortition, enables Algorand to achieve tremendous performance, scale, and 100% uptime since inception. Algorand’s founder, Silvio Micali, was one of the key architects behind the notion of VRFs, and today they are one of the most integral building blocks behind cybersecurity and cryptographic applications.

Put simply, a VRF can be thought of as a tamper-proof random number generator; such a resource is incredibly valuable for smart contracts dealing with lotteries, auctions, assignment or selection or roles, or any tasks that require trustlessly verifiable randomness. VRFs have enjoyed an explosion of popularity in blockchain applications, and many oracles such as Chainlink, Oraichain, and more have developed VRF services for its clients.

Piggybacking off Algorand’s PPoS consensus and through the bottom-up construction of a unified interface, Algoracle can offer a superior VRF-as-a-service product while also uniquely applying VRFs at the node network consensus level to achieve peak oracle efficiency. The way that many current state EVM oracles achieve “efficiency” is by simply managing a limited pool of nodes for each oracle data feed being written; for example, the ETH-BTC pair for Chainlink only has 15 nodes. This is largely due to the unfavorable costs and inefficiency of running nodes on Ethereum.

However, Algoracle is able to provide greater efficiency and security by implementing VRFs at an even lower level. Algorand’s implementation of VRF in PPoS consensus ensuring guaranteed random sampling of validators enables Algoracle to not only provide next generation off-chain compute, but also enables many critical features taken for granted in the Web2 world that currently elude the offerings of oracle providers today.

When imagining what the future of dApps would look like when used by the general public, it is obvious that the capabilities needed far exceed those afforded simply by smart contracts, which have many inherent limitations. Blockchain games’ need for randomness is one such use case. Another much needed feature is push notifications; all next gen apps will need data and event notifications, and with the enablement of better off-chain computation, push notifications can become a native piece of an oracle service. In contrast, today push notification services such as Ethereum Push Notification Service (EPNS) exist as standalone products outside of other oracle ecosystems, adding more bloat and technical debt for developers.

Algoracle’s unified interface with off-chain compute in mind provides significant value for both VRFs as a service offering and overall oracle efficiency for both use cases.

Case Study: Blockchain Games & Randomness

Blockchain games often incorporate randomness, which is not ideal for on-chain computation. Any game dependent on Random Number Generators (RNG) will want to request a VRF to generate its random numbers. This can easily be achieved by making the oracle network task-agnostic, so that injecting randomness on-chain is done through the same interface as any other data.

Randomness aside, game logic can often be arbitrarily complex. This is not ideal for on-chain smart contracts because running code in layer-1 has strict computational limitations and can be harder to implement for complex use cases than traditional high level programming languages. This often leads to game logic being run in centralized layer-2 environments, which in some ways defeats the purpose of running on the blockchain to begin with! Just like a decentralized oracle network can trustlessly provide data or random numbers, using a task-agnostic architecture could also provide the results of complex, off-chain logic back on-chain in a similarly trustless fashion.

Case Study: dApp Communication

The current generation of oracle networks is focused on the trustless flow of data in a single direction: into the blockchain. What if we want to get events and push notifications from on-chain activity to the outside world? This would be doable with a centralized service, however centralized communication between decentralized systems doesn’t make sense for most applications. It would instead be ideal if we could use the same decentralized network that facilitates communication from the outside world to the blockchain to also enable communication from the blockchain to the outside world, providing a complete platform with a uniform interface for bidirectional data flow.

Some use cases that immediately come to mind: sending the user a notification when their NFT is sold on a marketplace, notifying a DeFi participant about fluctuations in their investment valuation, allowing cross-dApp communication and integration, invoking an action on another blockchain in response to an event on Algorand (bridges anyone?). All of this could be done trustlessly, using a common interface and powered by a single token, built natively, while also allowing developers to use their preferred programming languages.

Next Gen Dapps Need Next-Gen Off-Chain Computation

Modern dApps need more than just smart contracts to support rich feature sets. As web3 evolves and matures, it becomes clear that better off-chain oracle computation will be vital for a number of standard dApp use cases. The current generation of decentralized oracle networks only support limited off-chain compute functions, which is writing data on-chain from an external API. By extending the functionality of these networks and consolidating these to run through an interface, dApps can access the features they need without having to keep a balance of multiple tokens, integrate with several different protocols or depend on multiple services with different levels of centralization. The Algoracle team is pleased to build for the next generation of dApp needs for advanced off-chain compute, enabled by the benefits of Algorand consensus and VRFs for node network consensus.

Written by Joseph Jones CTO of Algoracle and Kyle Wang Co-founder of Valhalla Capital

Related Posts