LogoLogo
WebsitePredictoorData ChallengesData FarmingOcean.pyOcean.js
  • 👋Ocean docs
  • 🌊Discover Ocean
    • Why Ocean?
    • What is Ocean?
    • What can you do with Ocean?
    • OCEAN: The Ocean token
    • Networks
    • Network Bridges
    • FAQ
    • Glossary
  • 📚User Guides
    • Basic concepts
    • Using Wallets
      • Set Up MetaMask
    • Host Assets
      • Uploader
      • Arweave
      • AWS
      • Azure Cloud
      • Google Storage
      • Github
    • Liquidity Pools [deprecated]
  • 💻Developers
    • Architecture Overview
    • Ocean Nodes
      • Node Architecture
    • Contracts
      • Data NFTs
      • Datatokens
      • Data NFTs and Datatokens
      • Datatoken Templates
      • Roles
      • Pricing Schemas
      • Fees
    • Publish Flow Overview
    • Revenue
    • Fractional Ownership
    • Community Monetization
    • Metadata
    • Identifiers (DIDs)
    • New DDO Specification
    • Obsolete DDO Specification
    • Storage Specifications
    • Fine-Grained Permissions
    • Retrieve datatoken/data NFT addresses & Chain ID
    • Get API Keys for Blockchain Access
    • Barge
      • Local Setup
    • Ocean.js
      • Configuration
      • Creating a data NFT
      • Publish
      • Mint Datatokens
      • Update Metadata
      • Asset Visibility
      • Consume Asset
      • Run C2D Jobs
    • Ocean CLI
      • Install
      • Publish
      • Edit
      • Consume
      • Run C2D Jobs
    • DDO.js
      • Instantiate a DDO
      • DDO Fields interactions
      • Validate
      • Edit DDO Fields
    • Compute to data
    • Compute to data
    • Uploader
      • Uploader.js
      • Uploader UI
      • Uploader UI to Market
    • VSCode Extension
    • Old Infrastructure
      • Aquarius
        • Asset Requests
        • Chain Requests
        • Other Requests
      • Provider
        • General Endpoints
        • Encryption / Decryption
        • Compute Endpoints
        • Authentication Endpoints
      • Subgraph
        • Get data NFTs
        • Get data NFT information
        • Get datatokens
        • Get datatoken information
        • Get datatoken buyers
        • Get fixed-rate exchanges
        • Get veOCEAN stats
    • Developer FAQ
  • 📊Data Scientists
    • Ocean.py
      • Install
      • Local Setup
      • Remote Setup
      • Publish Flow
      • Consume Flow
      • Compute Flow
      • Ocean Instance Tech Details
      • Ocean Assets Tech Details
      • Ocean Compute Tech Details
      • Datatoken Interface Tech Details
    • Join a Data Challenge
    • Sponsor a Data Challenge
    • Data Value-Creation Loop
    • What data is valuable?
  • 👀Predictoor
  • 💰Data Farming
    • Predictoor DF
      • Guide to Predictoor DF
    • FAQ
  • 🔨Infrastructure
    • Set Up a Server
    • Deploy Aquarius
    • Deploy Provider
    • Deploy Ocean Subgraph
    • Deploy C2D
    • For C2D, Set Up Private Docker Registry
  • 🤝Contribute
    • Collaborators
    • Contributor Code of Conduct
    • Legal Requirements
Powered by GitBook
LogoLogo

Ocean Protocol

  • Website
  • Blog
  • Data Challenges

Community

  • Twitter
  • Discord
  • Telegram
  • Instagram

Resources

  • Whitepaper
  • GitHub
  • Docs

Copyright 2024 Ocean Protocol Foundation Ltd.

On this page

Was this helpful?

Edit on GitHub
Export as PDF
  1. Developers

Metadata

How can you enhance data discovery?

Last updated 9 months ago

Was this helpful?

Metadata plays a crucial role in asset discovery, providing essential information such as asset type, name, creation date, and licensing details. Each data asset can have a that resolves to a DID document () containing associated metadata. The DDO is essentially a collection of fields in a object. To understand working with OCEAN DIDs, you can refer to the . For a more comprehensive understanding of metadata structure, the documentation provides in-depth information.

In general, any dApp within the Ocean ecosystem is required to store metadata for every listed dataset. The metadata is useful to determine which datasets are the most relevant.

So, for example, imagine you're searching for data on Spanish almond production in an Ocean-powered dApp. You might find a large number of datasets, making it difficult to identify the most relevant one. What can we do about it? This is where metadata is useful! The metadata provides valuable information that helps you identify the most relevant dataset. This information can include:

  • name, e.g. “Largueta Almond Production: 1995 to 2005”

  • dateCreated, e.g. “2007–01–20”

  • datePublished, e.g. “2022–11–10T12:32:15Z”

  • author, e.g. “Spanish Almond Board”

  • license, e.g. “SAB Data License”

  • technical information about the files, such as the content type.

Other metadata might also be available. For example:

  • categories, e.g. [“agriculture”, “economics”]

  • tags, e.g. [“Europe”, “Italy”, “nuts”, “almonds”]

  • description, e.g. “2002 Italian almond production statistics for 14 varieties and 20 regions.”

  • additionalInformation can be used to store any other facts about the asset.

Overview

Decentralized identifiers (DIDs) are a type of identifier that enable verifiable, decentralized digital identity. Each DID is associated with a unique entity, and DIDs may represent humans, objects, and more.

Rules for DID & DDO

An asset in Ocean represents a downloadable file, compute service, or similar. Each asset is a resource under the control of a publisher. The Ocean network itself does not store the actual resource (e.g. files).

Publishing & Retrieving DDOs

Here is the flow:

  • _metaDataDecryptorUrl - You create the DDO and then the Provider encrypts it with its private key. Only that Provider can decrypt it.

  • _metaDataDecryptorAddress - The decryptor address.

  • flags - Additional information to represent the state of the data. One of two values: 0 - plain text, 1 - compressed, 2 - encrypted. Used by Aquarius.

  • _metaDataHash - Hash of the clear data generated before the encryption. It is used by Provider to check the validity of the data after decryption.

  • _metadataProofs - Array with signatures of entities who validated data (before the encryption). Pass an empty array if you don't have any.

function setMetadata(uint8 _metaDataState, string calldata _metaDataDecryptorUrl
  , string calldata _metaDataDecryptorAddress, bytes calldata flags, 
  bytes calldata data,bytes32 _metaDataHash, metaDataProof[] memory _metadataProofs) external {
  require(
      permissions[msg.sender].updateMetadata,
      "ERC721Template: NOT METADATA_ROLE"
  );
  _setMetaData(_metaDataState, _metaDataDecryptorUrl, _metaDataDecryptorAddress,flags, 
  data,_metaDataHash, _metadataProofs);
}

While we utilize a specific DDO structure, you have the flexibility to customize it according to your unique requirements. However, to enable seamless processing, it is essential to have your own Aquarius instance that can handle your modified DDO.

DIDs and DDOs follow the .

(DIDs) are a type of identifier that enable verifiable, decentralized digital identity. Each DID is associated with a unique entity, and DIDs may represent humans, objects, and more. A DID Document (DDO) is a JSON blob that holds information about the DID. Given a DID, a resolver will return the DDO of that DID.

An asset has a DID and DDO. The DDO should include metadata about the asset, and define access in at least one . Only owners or delegated users can modify the DDO.

All DDOs are stored on-chain in encrypted form to be fully GDPR-compatible. A metadata cache like can help in reading, decrypting, and searching through encrypted DDO data from the chain. Because the file URLs are encrypted on top of the full DDO encryption, returning unencrypted DDOs e.g. via an API is safe to do as the file URLs will still stay encrypted.

The DDO is stored on-chain as part of the NFT contract and stored in encrypted form using the private key of the . To resolve it, a metadata cache like must query the to decrypt the DDO.

To set up the metadata for an asset, you'll need to call the function at the contract level.

- Each asset has a state, which is held by the NFT contract. One of the following: active (0), end-of-life (1), deprecated (2), revoked (3), ordering temporarily disabled (4), and asset unlisted (5).

data - The of the asset. You create the DDO as a JSON, send it to the that encrypts it, and then you set it up at the contract level.

As developers, we understand that you eat, breathe, and live code. That's why we invite you to explore the and pages, where you'll find practical examples of how to set up and update metadata for an asset

You'll have more information about the DIDs, on the page.

💻
specification defined by the World Wide Web Consortium (W3C)
Decentralized identifiers
Aquarius
Provider
Aquarius
Provider
setMetaData
DDO
Provider
Identifiers
🤔
decentralized identifier (DID)
DDO
JSON
DID documentation
DDO Specification
💻
ocean.js
ocean.py
Data discovery
DDO Flow
service
_metaDataState