[Proposal] Ocean Surfer 🏄 - Duck dive #1: Enabling real-time streaming payments for consuming C2D services

[Proposal] Ocean Surfer :surfing_man::ocean: - Duck dive #1: Enabling real-time streaming payments for consuming C2D services

:ocean: Duck dive: A technique by which you submerge your board under the Ocean so as to dive underneath an approaching wave (Image Source)

Key Project Data

Project Name

Ocean Surfer :surfing_man::ocean: Duck Dive #1: an Ocean+Superfluid integration

Proposal Wallet Address

0x821A4dF7E0e6F47038E8D263DcAB539992Df1c21

Summary

The present proposal aims to combine Ocean V3 and Superfluid Protocol to enable a new data token primitive that leverages money streaming agreements to allow the payment/consumption of on-demand Compute-to-Data (C2D) services.

Project Categories

  • :white_check_mark: Build/improve applications or integrations to Ocean
  • Outreach/community (grants don’t need to be technical in nature)
  • Unleash data
  • :white_check_mark: Build/improve core Ocean software

Project Overview

Description of the project

The Ocean Surfer #1 :surfing_man: Duck Dive series :ocean: aims to immerse into the Ocean Protocol architecture and contribute with technical implementation and integrations with existing tools/protocols that can help to increase the number of use cases within the Ocean community to unlock a new data economy.

The objective of this proposal is to integrate money streaming as a new payment mechanism for consuming Compute-to-Data services providing an alternative to upfront payments. This new primitive will allow data owners to set up service agreements with time-based (i.e. hourly, daily) rates while consumers will be able to stream their payments based on the demand for a compute jobs to execute.

For completing this quest, I’ll receive direct mentorship from the core dev team of Superfluid.finance, a brand new protocol for creating programmable cashflows on the Ethereum blockchain (layer one).

This is the first proposal of a Duck Dive series I’m looking to contribute throughout 2021. I’ve been involved in the Ocean Protocol community since December 2017 surfing its waves, and duck diving into the code. You can find some contributions and hacks I’ve already done using Ocean and Superfluid in my bio below.

What problem is your project solving?

Since the launch of Ocean V2 in May 2020, data owners can offer C2D services on top of their dataset, allowing 3rd parties to run specific compute jobs to get useful analytics or for building an AI model, while the actual data never leaves the premises.

Right now, these C2D services can be created through fixed-price time-bounded agreements, that is, a consumer is required to pay a fixed amount upfront in order to run a compute job for a specific amount of time, even if the consumer sends a signal to stop the execution earlier than the pre-defined time. The introduction of money streaming primitives will provide new means for revenue streams that will be more attractive to data service consumers as they will be paying only for the actual time needed.

Imagine an organization looking to train a complex deep learning model by consuming one, or multiple C2D services. It would only be required to trigger a new stream agreement that lasts until a round of hyperparameter tuning is performed, and/or for as long as the model reaches convergence. All this performed in real-time and without requiring to pay huge amounts upfront, thus increasing the accountability for the C2D providers and making the system even more trustless.

What is the final product?

At a first stage, we will deliver a Proof-of-Concept (PoC) leveraging Ocean V3, Ocean C2D and Superfluid. This Proof-of-Concept will provide a complete walkthrough for developers and users on how to add money streaming capabilities for selling & consuming data assets through Ocean. The PoC will cover two different use cases: a) from a data science (experienced developers) perspective how to make use of C2D services paid in Superfluid streams by using Jupyter notebooks and b) for an average-user how to do so by using a fork of Ocean Market dApp with adjusted UI to accommodate the new functionalities.

This PoC will allow C2D providers to set dynamic pricing strategies (i.e. flat hourly rates, or based on current market demands) to the service agreement published through a data market, while consumers will be able to seamlessly start/stop streaming payments (either in $OCEAN or stablecoins like $DAI) at flexible rates, with no capital lockups, and for as long as they want the compute job to run.

Once the PoC is delivered successfully, we will coordinate with the Ocean Core devs in order to add the newly developed features into the existing Ocean libraries (both Javascript & Python). All the required changes in the Ocean Core libraries & components will be sent as pull requests and following the contribution guidelines and best practices.

As such, if our PoC implementation is accepted and validated by Ocean Core devs, the Final Product would be a fully functional integration that can be deployed through exiting Ocean Core libraries and components.

How does this project drive value to the Ocean ecosystem?

The proposal ROI can be expressed with the following formula:

Where:

EVI is the Ecosystem Value Increase (in both the short and long term) due to the enablement of recurring transfer of value via streaming by leveraging Superfluid Protocol technology within Ocean. This allows the transfer of tokens over time based on pre-defined rules and could unlock new use cases, features, higher liquidity and revenue streams.

Such recurring value transfers could take place within the Ocean marketplace as well as from external sources to the Ocean marketplace (incoming value) or from the Ocean marketplace to external systems (outgoing value), creating several value flows that could enlarge and enrich Ocean Protocol broader network, ecosystem and community.

Beside the streaming element of Superfluid’s Constant Flow Agreement (CFA) functionality that enables liquid streaming, Superfluid’s Instant Distribution Agreement (IDA) functionality could enable rewards distributions at scale at minimal cost, unlocking new economic models and rewards/incentives structures.

The actual value of EVI (expressed in USD) is hard to measure in the short term because it leverages network effects and its effects can only be seen once the system is actively working and these new logic elements are in motion.

DSRF are the Data Streaming Revenue Fees, a percentage fee on future Compute-to-Data sales paid via Superfluid streams for temporary computing access to a dataset that can be redistributed to the Ocean ecosystem directly or by buy&burn of $OCEAN tokens. Such fees could also be directly streamed to the Ocean DAO to fund more of these grants and keep the ecosystem healthy. While the majority of revenues could always go to the dataset provider, a minor marketplace fee to enable the data-computing rental seems reasonable and contributes to the ecosystem sustainability loop. DSRF can be expressed in dollar (USD) equivalent of the revenues fees captured either in $OCEAN, $ETH or $DAI or other stablecoins.

PG is the Proposal Grant spent for this proposal for the development of what we propose above, expressed in relative dollar (USD) value of the $OCEAN tokens spent.

SP is the Success Probability of this project, expressed in %.

While measuring the value of ExpectedROI in actual figures would be hard, assuming the project is successful (SP=100%) and assuming minimal revenue fees on compute-to-data streaming, we believe the ExpectedROI value would be much greater than 1 in both the medium and long term.

Beyond the ExpectedROI calculation, we believe that adding Superfluid Protocol technology and features to the Ocean ecosystem could unlock new means of value generation, capture and transfer that could improve the status quo and pave the way for deeper and broader innovation in the Ocean ecosystem.

Deliverables

  • A PoC in Jupyter Notebooks leveraging Ocean V3, Ocean C2D, and Superfluid;
  • A fork of the Ocean market showcasing how to create/consume C2D services through real-time money streaming;
  • PoC and dApp will be open-source with a permissive license at
  • A blogpost + 5 mins Video Demo;
  • A PR will be made to these Ocean components: market, ocean.js, ocean.py, & c2d modules following best practices for quality etc;
  • I commit to working with Ocean core developers to merging the PR.

Project Details

  • An overview of the technology stack?

    Superfluid

    Superfluid is a smart contract framework built on Ethereum that allows movement of assets on-chain following a set of predefined rules called agreements. With a single on-chain tx, money can flow from the sender’s balance to the receiver in real-time. TheSuperfluid Protocol is:

    • :money_with_wings: Flexible - different agreement types within the same account;
    • :chart_with_upwards_trend: Scalable - an account can handle infinite streams with fixed gas cost;
    • :building_construction: Modular - smart contracts can integrate and combine agreements;

    Money streaming using Superfluid’s Constant Flow Agreement (CFA) :money_with_wings:

    Superfluid implemented a type of agreement that allows you to create a constant stream of tokens that are moved between wallets automatically every time a new block is minted on the blockchain, which makes it the perfect exchange of time (or services) for money (such as C2D services in Ocean) while eliminating the need for trust or upfront payments. You can read more details about how Superfluid streaming works here.

    Agreements such as CFA allow existing protocols to push the boundaries of programmable money. Smart contracts can manage, integrate, and combine Superfluid agreements. Moreover, by setting up the appropriate callbacks in their dApps/tools, smart contracts registered as SuperApps are able to react every time a stream towards them is opened, updated or closed.

    Superfluid is also a very flexible set of money lego blocks so you can build much more than just streaming!

    Changes to the Ocean stack

    The launch of V3 of Ocean Protocol introduced an ERC20 compliant component called Data Token, which can be used to represent the value of an asset and as a unit of access control to the underlying data asset or service. The current state of Ocean market allows data consumers to access a data asset by acquiring 1.0 Data Token (i.e. through either a FixedRateExchange or via an Automated Market Maker (AMM) exchange). Then, this Data Token should be transferred back to the data provider in exchange for one-time access. Nevertheless, the current flow of tokens may not be sufficient for offering other kinds of data services that require of continuous access such as providing real-time data subscriptions (stream data pipelines) or computing services (C2D).

    We will use the existing smart contract design to derive a new Data Token variant to allow consumers to stream an ERC20 token to the data provider in exchange for time-based access Data Tokens. Data consumers will need to stream Ocean tokens if they access a compute service published in the Ocean Market, but other marketplaces would enable data owners to accept any other ERC-20 token such as DAI, USDC, etc.

    On the other hand, the computing services offered through Ocean C2D components are currently time-bounded only. That is, a publisher specifies a maximum time (timeout) within the Compute Service Agreement that will allow a compute job to run (if the consumer doesn’t send a signal to stop it earlier). Therefore, we will need to add new features to the main Ocean C2D components so operators can subscribe to on-chain events or callbacks being triggered by the created CFA stream (i.e. when it is created/updated/deleted). This includes further discussions with the Ocean Core devs on extending OEP-12.

Roadmap

  • Any prior work completed thus far?

    I’ve been collaborating with the Ocean team on the integration between Ocean C2D and Openmined for allowing the execution of privacy-preserving AI model training using a data-centric federated learning approach. An initial PoC will be publicly released in the coming weeks, so I plan to use this as a baseline for testing the integration with money streaming payments services

    Most recently, I have also explored the power of Superfluid agreements through a hackathon project (and still under active development) that enables people/Orgs to connect with available data-science talent in a peer-to-peer fashion so they can provide online privacy-preserving data analytics services while getting paid in real-time. You can find more info regarding my bounty submission in this post. Our plan includes merging ideas from all previous work exposed above to achieve the following milestones.

Milestones

  • January 2021
    • A PoC in Jupyter Notebooks leveraging Ocean V3, Ocean C2D, and Superfluid
    • Blogpost + Video demo draft
    • Provide regular updates to the (forked) source code repositories
  • February 2021
    • Integration with existing Ocean libraries
    • A fork of Ocean Market showcasing how to create/consume C2D + money streaming services
    • Finalized Medium blogpost + Github Repos + Video demo
  • March 2021
    • PR submission to the Ocean team

Future Plans / Intentions

  • Provide further support for this integration to work as intended;
  • Work on other potential uses cases for integrating Superfluid on Ocean like allowing money streaming for data subscription services, or using CFA/IDA to dogfood OceanDAO;
  • Send more :surfing_man::ocean:Duck Dive series​:surfing_man::ocean: as proposals to future OceanDAO funding rounds if this one is successful.

Team Members

Santiago Gonzalez-Toral

Additional Information

For this proposal I will receive both general support and technical mentorship from the Superfluid team:

Michele D’Aliessi

Francesco Renzi

ZhiCheng Miao

3 Likes

Hi @santteegt, if deemed valuable by the Ocean Community we are going to do our best to support you from our side in the development of this project. Please let us know of any difficulty you encounter along the way in making this work, our dev team will be ready to step in and help as much as we can. Can’t wait to see a Superfluid Ocean in action :ocean:

The Superfluid Team

1 Like