Skip to content

Standard metadata format

Joonmo Yang edited this page Apr 5, 2019 · 6 revisions

Standard metadata format

Asset schemes of CodeChain can record various informational data about itself in the metadata field. If possible, explorer will try to parse and visualize them as much as possible. For explorer to understand additional information, metadata should follow the standard format specified below.

Version 1

Common Fields

field format description
version 1 Version of this format
type "asset" | "vote" The type of this asset
approver.url (optional) URL string HTTP URL for the approver
gateway.url (optional) URL string HTTP URL for the gateway

Fields for type="asset"

field format description
type "asset"
name max 64 bytes The name of this asset
description max 400 bytes The detailed description of this asset
icon (optional) URL string HTTP URL for icon
attachments (optional) max 3 items Array of attachments
attachments[n].name string Name of the attachment
attachments[n].url URL string HTTP URL of the attachment
compliance(optional) string An identifier of the compliance applied to this asset

Fields for type="vote"

field format description
type "vote"
title max 64 bytes The title of this vote
description max 400 bytes The detailed description of this vote
asset 40 hexadecimal characters assetType of the asset that this vote is for
open timestamp timestamp when this vote will be opened
close timestamp timestamp when this vote will be closed
snapshot timestamp timestamp when the snapshot for token distribution was taken
support number in range [0, 100] Minimum ratio of the agreement required for this vote to be passed

Sample

// Version 1
// Asset
{
    "version": 1,
    "type": "asset",
    "name:": "Sample Asset",
    "description": "This is a sample asset for the test.",
    "icon": "https://sample.com/sample/icon.png",
    "attachments": [
        { "name": "sample.pdf", "url": "https://sample.com/files/sample.pdf" },
        { "name": "sample.jpg", "url": "https://sample.com/images/sample.jpg" }
    ],
    "compliance": "Sample Compliance",
    "approver": {
        "url": "https://approver.codechain.io/api/transaction"
    },
    "gateway": {
        "url": "https://gateway.codechain.io/api/transaction"
    }
}

// Vote
{
    "version": 1,
    "type": "vote",
    "name:": "Sample Vote",
    "description": "This is a sample vote for the test.",
    "asset": "0123456789abcdef0123456789abcdef01234567",
    "open": 1234567890,
    "close": 1234611090,
    "snapshot": 1234566450,
    "support": 66.67
}

Version 0

field format description
version (optional) 0 Version of this format
name max 30 bytes The name of this asset
description max 200 bytes Detailed description of this asset
type "asset" | "vote" Type of this asset
icon_url (optional) URL string HTTP URL for icon
gateway.url (optional) URL string HTTP API URL for sending a transaction
  • The icon referenced by icon_url must be of size below 180px × 180px.
  • The icon referenced by icon_url must be one of png, jpg, svg file.

Sample

// Version 0
{
    "name:": "Sample Asset",
    "description": "This is a sample asset for the test.",
    "icon_url": "https://sample.com/sample/icon.png",
    "gateway": {
        "url": "https://gateway.codechain.io/api/transaction"
    }
}