Jan 21, 2020
Benjamin Scholtz

Molecule dives into Ocean

We decided to create an integration between the Ocean Protocol and Molecule Catalyst, to enable DAO like management of research data produced from the projects funded via Molecule Catalyst, as well as monetize the research data to improve the value of the Molecule Catalyst markets for contributors.

Inspiration

We released an application, Molecule Catalyst, to the Ethereum mainnet the day after the Ocean submission deadline! Naturally, this filled our minds, and became our inspiration for the Ocean Data Economy Challenge.

Molecule Cataly

st provides a platform for researchers working on novel therapeutics to raise funding from the public. Our mission is to democratise research funding and allow the public to engage with researchers while new discoveries are happening. — Titian Steiger, https://link.medium.com/ZXbyNRYFo3

Visit the live application at https://discover.molecule.to/ and see more details at https://discover.molecule.to/

See DevPost submission at https://devpost.com/software/molecule-data-market

We decided to create an integration between the Ocean Protocol and Molecule Catalyst, to enable DAO like management of research data produced from the projects funded via Molecule Catalyst, as well as monetize the research data to improve the value of the Molecule Catalyst markets for contributors.

As a real world example, for our first project on Catalyst, the University of Toronto Psychedelic Studies Research Program is running a large scale human study on micro-dosing psilocybin. During the study the lab will administer pharmaceutical-grade psilocybin in a lab environment. This study will produce preliminary insights and a dataset containing the actual results from patient experiments. These datasets could then inform further academic study. All data and materials will be made available to the public — and this is a real world use case today, that would benefit from Ocean’s system.

molecule-data-swap

With Molecule Dataswap:

  1. Researchers create campaigns to receive funding for their research milestones.
  2. Contributors are rewarded for their support through a token distribution.
  3. At each research phase, researchers are required to publish updates and data to prove their accomplishments and secure funding for that phase.
  4. These datasets could then be published on the Ocean system, where interested parties can pay for access to them to help further fund the research.
  5. All rewards from dataset consumption are sent to the bonded market and are fairly distributed to the original funding campaign contributors.

We realize that in these markets, there is a lot of value in the research data being produced, and to incentivize further funding of the project the contributors need to be directly invested in the production of good research data. With Molecule Dataswap, built on the Ocean Protocol, we can achieve that.

Currently, the Ocean Protocol has a static pricing system, and if data is the new oil, this needs to change. We believe we can greatly improve and build upon the Ocean Protocol feature set by introducing dynamic pricing and distributed ownership of datasets produced by Molecule Catalyst research projects.

We are already in discussions with a few research projects wanting to democratize ownership and access to their research data, while still fairly monetizing the data.

What is does


Molecule Dataswap is a set of smart contracts and an oracle that allows data producers to fund the publication of a dataset, and offer access to the dataset at a dynamic price according to the state of the dataset’s bonded market. The dataset is essentially entered into and managed by a DAO, that fairly distributes Ocean token rewards to contributors in the form of dividends, and increases existing token holders’ token value.

How we built it

Dynamic Pricing

Currently, the Ocean Protocol has static dataset pricing. There are API endpoints for updating the asset metadata price via the Aquarius API. When introducing dynamic pricing, in our use case, the asset should be priced according to:

  1. The funding status of the project generating the data
  2. The popularity of the dataset

This is achieved by collecting the Ocean token rewards in a bonding curve collateral pool. A bonding curve is a function that defines the relationship between the token supply, underlying collateral (Ocean tokens), and the token price.

We used the token price to set the price of Ocean datasets. This means, the more contributors a research project has, the higher the value of the token. The more popular the Ocean dataset is, and the more it is consumed, the more the initial contributors benefit by being token holders.

The dynamic pricing scheme implemented in the hack is rather simple, but without further modelling (time for cadCAD!), does what it needs to in this context.

Smart Contracts

We forked the OpenRaise “Bonding Curves For DAOs” project as a good base for the bonding curve interface. We specifically needed to use an invariant preserving bonding curve implementation so that the token price function directly depends on the collateral deposited.

The contracts were refactored to allow depositing Ocean ERC20 tokens without directly calling the bonded market functions like “buy” and “sell”. This allowed us to set the bonded market as the Ocean Protocol beneficiary for dataset consumption.

Every time a dataset is consumed, the Ocean reward is sent to the bonded market, which increases the underlying collateral — this dynamically adjusts the bonded token price.

Oracle

When the bonded token price changes, the oracle updates the Ocean token price of the relevant dataset via the Aquarias API and the dataset DDO metadata.

UI/UX

We designed our UI in Figma first, knowing that this was predominantly a contract and backend hack. You’ll see we implemented certain parts of the frontend and left others.

The consumer needs to be aware of the price they are paying for a particular dataset, as well as the price history. The price history gives the consumer an indication of the popularity of the dataset, and ideally quality too. The higher quality datasets should receive more funding and consumption, both of which contribute to the dataset price.

When a publisher creates a dataset for consumption, they are given the option of which bonded market address they’d like to set as the beneficiary. The beneficiary is set and the DID ownership is transferred.


Challenges we ran into

We ended up choosing a hack that delved quite deep into the Ocean stack, tested the limits of our understanding of the Ocean stack, as well as the capabilities of the Ocean stack.

During the course of the Ocean challenge we opened 3 merge requests, and I think that’s part of the value of a hackathon, learning and contributing back to the supporting project.

  1. https://github.com/oceanprotocol/react-tutorial/issues/2
  2. https://github.com/oceanprotocol/aquarius/pull/226
  3. https://github.com/oceanprotocol/squid-py/issues/421

There were also challenges related to dataset ownership and permissions being transferred. In order to set the beneficiary, the ownership and associated permissions are also transferred. This made admin tasks like granting service agreement access difficult, and was a blocker for us wiring everything up. We realize there is probably a way to address this at a lower level, and will be discussing this with the Ocean team soon!

Accomplishments that we’re proud of

We touched on almost all parts of the Ocean stack, made our first contributions to the various Ocean Protocol repos, and became familiar with what will most likely be an important feature in the Molecule Protocol. This hack has a real world use case today, and once ready could easily be integrated into the Molecule stack.

What we learned

  • The low level functionality of the Ocean Protocol
  • The intricacies of the Bancor & OpenRaise bonding curve implementation
  • What an integration between Ocean and Molecule could look like

What’s next for Molecule Dataswap

In future, we’d love to update the contracts to be multi-collateral — this would mean Ocean rewards could contribute value for research dataset consumption, and perhaps other protocols could slot in elsewhere.

With further help from the Ocean team, the different parts of our hack will surely find their way into the Molecule stack, and provide a useful feature of dynamic pricing for the Ocean Protocol.

Resources

Molecule Dataswap Devpost

LIniumlabs Gitlab Repo

Open Raise

Notes

  1. Keeping on the track of the value of data, for the Diffusion hackathon last year we submitted the tool KawAPI https://github.com/BenSchZA/kawapi-cli .
A secure reverse proxy creating a marketplace between data producers and data consumers.


2. We specifically changed the Ocean Protocol term “asset” to “dataset” for consistency for this hack, where we refer to research “datasets”.