Celer, an off-chain protocol for scaling blockchains, announced today the formation of a strategic partnership with Chainlink in order to bring real-world information to its layer-2 scaling platform. Chainlink is a decentralized oracle network that enables smart contracts to securely access off-chain data feeds, web APIs, and traditional bank payments.

Over the course of last year, the Celer team says it has witnessed numerous developers naturally chose to use Chainlink with Celer Network in their application building, making excellent achievements. Today, in addition to the announcement, Celer also informed the community of an invaluable design pattern it has identified from such various attempts, a pattern they propose as a combination of off-chain conditional state transition with an on-chain oracle dependency. Or put it simply, “introducing the capability to combine real-world information and layer-2 scalability.”

The Design Pattern

To understand the design pattern of combining Celer and Chainlink in use cases, start with the simple case of an off-chain conditional payment with an on-chain oracle dependency. Celer Network’s cChannel construct supports generalized state channel for not only accelerate simple payments but also smart contracts, in terms of which, the off-chain conditional payment is the most straightforward example. Take the simplest example of a boolean condition, Alice can pay Bob off-chain through a network of Off-chain Service Providers of Celer Network. That payment is conditionally dependent on some future condition being true or not.

The pattern has been applied in Celer’s generalized state channel gaming, where “Alice” and “Bob” will both conditionally pay each other at the beginning of the game, depending on who finally win a chess game. Users can try it out today on CelerX. In this particular case, the conditional payment is depending on the off-chain state of the game.

Chainlink comes in the picture when the dependency of the conditional payment is not off-chain states, but real-world events. Figure 1 shows this design pattern where Celer users send each other conditional payments while relying on the Chainlink nodes’ oracle input.

Compared with writing a smart contract to realize the same logic, the main advantages of using this design pattern include:

Significantly reduced cost . If performing the same simple two-party bi-directional betting with an oracle logic on-chain, at least four on-chain transactions are needed: two deposits, one check to the oracle and then one payments distribution. With Celer’s layer-2 conditional payment capability, it reduces those FOUR on-chain transactions to ONE oracle related transaction.

. If performing the same simple two-party bi-directional betting with an oracle logic on-chain, at least four on-chain transactions are needed: two deposits, one check to the oracle and then one payments distribution. With Celer’s layer-2 conditional payment capability, it reduces those FOUR on-chain transactions to ONE oracle related transaction. Drastically improved UX . The latency of user interaction is significantly reduced by tens of thousands of times. For traditional on-chain approaches, a full cycle of the conditional payment may take minutes if not tens of minutes to complete. With the support of Celer Network, things can complete in milliseconds. Such low latency renders a new kind of real-time and interactive users experience that was never possible before for this conditional payment semantic.

. The latency of user interaction is significantly reduced by tens of thousands of times. For traditional on-chain approaches, a full cycle of the conditional payment may take minutes if not tens of minutes to complete. With the support of Celer Network, things can complete in milliseconds. Such low latency renders a new kind of real-time and interactive users experience that was never possible before for this conditional payment semantic. Strongly enhanced privacy. Since most of the transactions and condition resolutions in cooperative cases will happen off-chain, there will be little to zero permanent on-chain traces to track the amount, senders and recipients of these conditional payments. Therefore, this provides another layer of privacy for deploying conditional payment uses cases.

The aforementioned technical advantages are anticipated to smooth and fuel the use-case expansion for both Chainlink and Celer.

The lower cost makes micro-conditional-payment possible. Normally, to execute a fraction of conditional payment upon a $1 small order could cost the developer a painful 20% — 80% of the total amount depending on the gas price. Now, if applying the new design pattern, that cost can be easily reduced by 100X with Celer’s percentage-based fee-charging model.

The improved UX makes real-time interaction use cases indee functionable. For example, Chainlink-powered decentralized prediction/derivative trading market, which looks to achieve the same level of real-time user experience of centralized exchanges on blockchain, has been suffered from the liquidity shortage due to low interaction rates. Yet, things are going to change. With the support of Celer, market participants are now allowed to submit and cancel orders instantly. It also represents a possibility of performing real-time payment in pay-per-use services with SLAs verified by Chainlink.

Lastly, the enhanced privacy meets the confidentiality requirement in situations of private prediction/derivative market trading, insurance and countless other use cases relying on oracles. This privacy enhancement makes manipulation of the real-world events data less likely. As long as involved parties can cooperate in the off-chain resolution protocol, there will be no trace on-chain to track past trading activities.

As Celer Network supports generalized state channels with conditional dependency graph between states, this design pattern can be extended to more flexible version of off-chain conditional state transition with on-chain oracle dependency, where not just simple payment, but any kind of off-chain smart contract execution in Celer can also be conditionally depending on real-world events from Chainlink’s decentralized oracle network. This design pattern combines the power of Chainlink and Celer to bridge real-world information with layer-2 scaling platforms for the first time, enables endless possibilities and uses cases.

Projects using this Design Pattern

Developers are building their works using the above-mentioned pattern. At ETHSF 2018, Celer Network team observed several teams applying the combined pattern of Celer Network and Chainlink, for example, AirPrediction and Micro-Subscription.

AirPrediction is aimed to address the UX challenge of blockchain prediction market via the pattern. With the launch of Augur, everyone had his/her eyes set on the renaissance of the prediction market. However, the user experience of Augur today is far from ideal: order books are on-chain and every order takes a painfully long time to confirm. Unless the UX issue is solved, AirPrediction won’t see mass adoption. In addition, this slowness makes market making close to impossible and results in a large market spread, shallow market depth with low market efficiency. Without an efficient market, AirPredict cannot possibly hope to achieve the collective intelligence vision promised by the prediction market. Celer Network naturally helps on the prediction market case with the clear abstraction of conditional off-chain payment, where the “condition” in this case is an on-chain Chainlink oracle.

Micro-Subscription uses this design pattern to build a micro cloud hosting service with SLA guarantee. With this service, users can subscribe to cloud service in minute increments with micropayment and still have guaranteed SLA because while users are paying for the service provider, the service provider is also conditionally paying the user with SLA guarantees. If Chainlink oracles declare the service is down, the conditional payment instantly evaluates to be true and users will be compensated immediately for the loss as an insurance mechanism. This expands the horizon of hosting to not only “trust-brand” but incentive aligned decentralized hosting with instant insurance and SLA.

Those interested can further check out Celer Network’s SDK and Chainlink’s SDK.