API

Ancon Protocol - Universal Metadata

Author

Rogelio Morrell Caballero

Category

VC, DID, PKI, Cryptography, NFT

Created

2021-08-23

Simple Summary

Enables an IPLD protocol level Metadata and Files smart contract for use with data economy use cases.

Abstract

Ancon delivers an immutable CID reference to a IPLD Node stored as a block in a Cosmos IAVL merkle tree. Similar to Flow Cadence resource oriented language, Ancon Metadata is unique and must be implemented as a store prefix, where any account owns its resources. In our implementation, we defined accounts as a DID method that uses a ethr-did-registry inspired implementation in Cosmos.

API

POST /ancon.v1.metadata.add

ancon.metadata.add(value, [options])

Adds an universal metadata.

Parameters

Metadata

NameTypeDescription

name

string

Identifies the asset to which this metadata represents

description

string

Describes the asset to which this token represents

image

string

A URI pointing to a resource with mime type image/* representing the asset to which this token represents

sources

array of string

Current intellectual property

owner

string

The owner is a DID identifier

parent

string

Transaction block

verifiedCredentialRef

string

Is the verified credential for the metadata

links

array of string

References

Returns

TypeDescription

Promise<Response>

An object that contains the CID

example of the returned object:

{
  hash: "QmHash.."
}

Metadata JSON Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ancon.dao.pa/v1/protocol/metadata",
  "title": "metadata",
  "description": "Ancon Protocol metadata schema",
  "type": "object",
  "properties": {
      "name": {
          "type": "string",
          "description": "Identifies the asset to which this token represents",
      },
      "description": {
          "type": "string",
          "description": "Describes the asset to which this token represents",
      },
      "image": {
          "type": "string",
          "description": "A URI pointing to a resource with mime type image/* representing the asset to which this token represents.",
      },
      "sources": {
          "type": "array",
          "description": "Current intellectual property",
      },
      "owner": {
          "type": "string",
          "description": "The owner is a DID identifier",
      },
      "parent": {
          "type": "string",
          "description": "Direct ascendant of the current intellectual property",
      },
      "verifiedCredentialRef": {
          "type": "string",
          "description": "Is the verified credential for the metadata",
      },
      "links": {
          "type": "array",
          "description": "Sample of references included in the current intellectual property",
      }
  },
  "required": [ "name", "description", "image", "sources" ]
}

Example

A new NFT token can use Ancon Protocol to store IPLD CID in Metadata to keep it verifiable.

Upload content and stores CID for each content, content needs to be CID or multihash to be verifiable.

Link your content to metadata accordingly and store it in Ancon using AnconJS

const payload = {
  "name": "XDV metadata sample",
  "description": "testing sample",
  "image": "https://explore.ipld.io/#/explore/QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D",
  "services": ["https://explore.ipld.io/#/explore/",
  "https://explore.ipld.io/#/explore/",
  "https://explore.ipld.io/#/explore/"],
  "links": [
    "QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D",
    "z8mWaJHXieAVxxLagBpdaNWFEBKVWmMiE",
    "QmdmQXB2mzChmMeKY47C43LxUdg1NDJ5MWcKMKxDu7RgQm",
  ],
};


const res = await ancon.metadata.add(payload)
console.log(`https://gateway.dao.pa/ancon/${res.cid}`)

Mint or anchor your Ancon metadata after its vetted by chain consensus protocol. The metadata is just a link to a gateway and always public.

GET /ancon/{cid}{path}

ancon.metadata.get(hash, [options])

Gets a metadata.

Parameters

File

NameTypeDescription

path

string

Describes the path

cid

multihash

IPLD multihash

Returns

TypeDescription

Promise<Response>

An object that contains the data

example of the returned object:

{
  data: "Mksadsoks=="
}

Last updated