Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CIP-0067 | Asset Name Label Registry #298

Merged
merged 13 commits into from
Oct 25, 2022
53 changes: 53 additions & 0 deletions CIP-0067/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
CIP:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
CIP:
CIP: 67

Title: Asset Name Label Registry
Authors: Alessandro Konrad <alessandro.konrad@live.de>, Thomas Vellekoop <thomas.vellekoop@iohk.io>
Comments-URI:
Status: Draft
rphair marked this conversation as resolved.
Show resolved Hide resolved
Type: Informational
Created: 2022-07-13
Post-History:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Post-History:

License: CC-BY-4.0
---

## Abstract

This proposal defines a standard to classify Cardano native assets by the asset name.

## Motivation

As more assets are minted and different standards emerge to query data for these assets, it's getting harder for 3rd parties to determine the asset type and how to proceed with it. This standard is similar to [CIP-0010](https://github.com/cardano-foundation/CIPs/tree/master/CIP-0010), but focuses on the asset name of an asset.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
As more assets are minted and different standards emerge to query data for these assets, it's getting harder for 3rd parties to determine the asset type and how to proceed with it. This standard is similar to [CIP-0010](https://github.com/cardano-foundation/CIPs/tree/master/CIP-0010), but focuses on the asset name of an asset.
As more assets are minted and different standards emerge to query data for these assets, it's getting harder for 3rd parties to determine the asset type and how to proceed with it. This standard is similar to [CIP-0010](../CIP-0010), but focuses on the asset name of an asset.



## Specification

To classify assets the `asset_name` needs to be prefixed with an opening and closing parentheses and the label in between: `({Label})`.
Copy link
Contributor Author

@alessandrokonrad alessandrokonrad Aug 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatives to parentheses to make it more obscure:

  • Single colon, e.g. :222: (5 bytes)
  • Double colon, e.g. ::222:: (7 bytes)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or, what about prefixing every thing with CIP67:{label}: ? A bit longer, but it leaves 24-20 bytes for the asset name. One can also find a more compact binary encoding which would take less bytes but loose the "readability" aspect of it.

For example, consider the prefix to be 0xC067, that's only 2 bytes and reads well once hex-encoded.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, additional suggestion: whatever the choice of format it, perhaps give an ABNF syntax to describe it so that symbols aren't misinterpreted (one person reading ({label}) might think for its label 42, the prefix would be: ({42}).

asset-name = asset-name-label asset-name-body

asset-name-label = "(" 1-5DIGIT ")"

asset-name-body = *OCTET ; exact length depends on the asset-name-label's length

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*I am only seeing / reading this comment now: #298 (comment)


KtorZ marked this conversation as resolved.
Show resolved Hide resolved
For example:

UTF-8 encoded: `(123)TestToken`\
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, (333) ends up taking 5 bytes of ascii which is more than coming up with a binary specification for this. I guess the advantage is that this is human readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's true, I think the compromise is worth it. With 5-6 bytes you still have 25-26 bytes free in the asset name.
I also thought about encoding it in binary, but you won't be able to ever utf-8 encode the asset name again. The only solution I have in mind here is to split the asset name in two parts if a label was detected in the asset name. Decode the label separately and the remaining asset name to make both parts human readable if applicable.

HEX encoded: `283132332954657374546F6B656E`


These are the reserved `asset_name_label` values

`asset_name_label` | description
---------------------------- | -----------------------
0 - 15 | reserved\*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the asterisk points to?

65536 - 131071 | reserved - private use

For the registry itself, please see [registry.json](./registry.json) in the machine-readable format. Please open your pull request against
this file.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One problem we had / have with CIP-0010 is that there's no particular "rule" that defines what can go in the registry. As editors we try to do some basic sanity check and ask people to pitch / justify a bit their project; but it would be nice / preferable if these rules were specified in the specification itself. For example:


Adding an entry to the registry

To propose an addition to the registry edit the registry.json with your details, open a pull request against the CIPs repository and give a brief description of your project and how you intend to use metadata associated with the label entry.


## Rationale

Asset name labels make it easy to classify assets. It's important to understand that a registered label standard itself doesn't provide any security off-chain nor on-chain as they can be spoofed. Only in combination with the Policy ID security can be derived from the minting policy.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Answers I'd like to see in the Rationale section:

  • What are the 0-15 labels reserved for and how is this different from the 65536 - 131071 range?
  • How big is the risk of collision for a given choice of prefix? (i.e. how likely is it that a "randomly generated" -- or a hash digest -- asset name may be misinterpreted as a CIP-0067's label. (though the current rationale hints in that direction by recommending to always consider the asset label in conjunction with the policy id)
  • Is there any consideration regarding the size of the prefix? It seems to me that keeping the size of the prefix / asset name label under 4 bytes is preferable, because it allows to still embed 28-byte hash digests in the asset name.



## References

- CIP-0010: https://github.com/cardano-foundation/CIPs/blob/master/CIP-0010

## Copyright

This CIP is licensed under [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/legalcode).
1 change: 1 addition & 0 deletions CIP-0067/registry.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
62 changes: 62 additions & 0 deletions CIP-0067/registry.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "https://github.com/cardano-foundation/CIPs/blob/master/CIP-?",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"type": "array",
"title": "Asset Name Label Registry",
"description": "JSON schema for asset name label registry",
"default": [],
"examples": [
[
{
"asset_name_label": 721,
"class": "NFT",
"description": "CIP-0025 - NFT Metadata Standard"
}
]
],
"additionalItems": false,
"items": {
"$id": "#/items",
"anyOf": [
{
"$id": "#/items/anyOf/0",
"type": "object",
"title": "The first anyOf schema",
"description": "An entry in the asset name label registry",
"default": {},
"examples": [
{
"asset_name_label": 721,
"class": "NFT",
"description": "CIP-0025 - NFT Metadata Standard"
}
],
"required": ["asset_name_label", "class", "description"],
"properties": {
"asset_name_label": {
"$id": "#/items/anyOf/0/properties/asset_name_label",
"type": "integer",
"title": "The asset_name_label number",
"default": 0,
"examples": [1967]
},
"class": {
"$id": "#/items/anyOf/0/properties/class",
"type": "string",
"title": "The asset class",
KtorZ marked this conversation as resolved.
Show resolved Hide resolved
"default": "",
"examples": ["NFT", "FT"]
},
"description": {
"$id": "#/items/anyOf/0/properties/description",
"type": "string",
"title": "The asset name label description",
"default": "",
"examples": ["CIP-0025 - NFT Metadata Standard"]
}
},
"additionalProperties": true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why allow additional properties?

}
]
}
}