Publish a Data Set with Compute features

Tutorial to add a dataset with compute capabilities to a basic React app.


This is a continuation of the React App Setup tutorial, so make sure you have done all the steps described in there.

  1. React App Setup

Open src/Compute.js from your marketplace/ folder.

Define Asset

We will use the same asset as in Publish a Data Set, but we are going to allow only compute features, without the ability to download the asset.

This is achiveable by adding a ‘compute’ service to the DDO:

      const service = await ocean.compute.createComputeServiceAttributes(

Handle Asset Publishing

Note that ocean.assets.create will define an ‘access’ service if the services list is missing. Since we are providing this attribute, our asset will have only a ‘compute’ service and no ‘access’ service.

  async function publish() {
    try {
      const accounts = await ocean.accounts.list()
      console.log('Publishing asset.')

      const service = await ocean.compute.createComputeServiceAttributes(
      const ddoAssetNew = await ocean.assets.create(asset, accounts[0], [
      console.log('Asset successfully submitted.')
      // keep track of this registered asset for consumption later on
      alert('Asset successfully submitted.')
    } catch (error) {

The last thing we need is a button to start our registration inside the render() function:

        <button onClick={publish}>Publish dataset with compute service</button>

Move on to Publish a Algorithm.