CIP: 4
Title: Subassets
Author: Jeremy Johnson (J-Dog)
Status: Draft
Type: Standards
Created: 2016-01-29
Establishes a protocol for issuing subassets
(ex. PIZZA
, PIZZA.DOMINOS
, PIZZA.DOMINOS.COUPON
, PIZZA.Dominos.Coupon!
)
To enable named asset owners the ability and flexibility to issue new easily identified and related named assets.
asset
A named asset which acts as PARENT to a subasset
subasset
A numeric asset which is a CHILD of a named asset
longname
A alphabetical string which indicates the full subasset name (_ex._ PIZZA.DOMINOS, PIZZA.dominos, PIZZA.DoMiNoS.Coupon )
-
Subasset names must meet following requirements :
- 1 to 250 characters in length (ie. PIZZA.X or PIZZA.REALLY-long-VALID-Subasset-NAME)
- Contain only characters : a-zA-Z0-9.-_@!
- Cannot start or end with a period (.)
- Cannot contain multiple consecutive periods (..)
-
Subasset can only be issued from same address that owns the parent asset at the time of the issuance.
-
Subasset can be transferred to a new owner address after initial issuance (if necessary)
-
Subasset has issuance cost of 0.25 XCP (anti-spam)
- Add asset_longname TEXT UNIQUE field to Assets table
Given the example of asset PIZZA and subasset PIZZA.DOMINOS counterparty-lib
would require the following changes:
-
When validating a subasset issuance attempt
(issuance.validate)
:- Verify that issuing address is owner of PIZZA asset.
- Verify that PIZZA.DOMINOS does not already exist by checking asset_longname for PIZZA.DOMINOS
-
When issuing a valid subasset
(issuance.compose)
:- Issue random numeric asset and set description to EXISTING DESCRIPTION + 3b3b6C50495a5a412e444f4d494e4f53
(hex) 3b3b6C50495a5a412e444f4d494e4f53 (text) ;;lPIZZA.DOMINOS ;; = marks start of key/value pairs l = longname PIZZA.DOMINOS = long asset name
-
When parsing/reparsing issuance transactions
(issuance.parse)
:- After block X, description.rsplit('3b3b',1) to get any name/value pairs.
- Create issuance record
- If name/value pairs are present
- Decode name/value pairs from hex to text
- Parse in longname
- If longname is present
- Verify that asset is numeric and this is first issuance.
- Verify that issuing address is owner of PIZZA asset.
- Verify that PIZZA.DOMINOS does not already exist by checking asset_longname for PIZZA.DOMINOS
- If longname is valid
- Update Assets table to set asset_longname to longname value
- When making requests to get asset information
(get_issuances & get_asset_info)
:- return new asset_longname value (if any)
Issue the named asset PIZZA.
payload = {
"method": "create_issuance",
"params": {
"source": "1Mqn41zrgRKXRjwkT8MZ3ENhyrKy5nWJVW",
"asset": "PIZZA",
"quantity": 0,
"divisible": true,
"description": "Pizza is good",
},
"jsonrpc": "2.0",
"id": 0,
}
Issue a random numeric asset with the asset_longname field set to PIZZA.DOMINOS
payload = {
"method": "create_issuance",
"params": {
"source": "1Mqn41zrgRKXRjwkT8MZ3ENhyrKy5nWJVW",
"asset": "PIZZA.DOMINOS",
"quantity": 0,
"divisible": true,
"description": "Dominos pizza is really good"
},
"jsonrpc": "2.0",
"id": 0,
}
Issue a random numeric asset with the asset_longname field set to PIZZA.DOMINOS.Coupon.Christmas.2016!
payload = {
"method": "create_issuance",
"params": {
"source": "1Mqn41zrgRKXRjwkT8MZ3ENhyrKy5nWJVW",
"asset": "PIZZA.DOMINOS.Coupon.Christmas.2016!",
"quantity": 0,
"divisible": true,
"description": "Dominos pizza customer loyalty coupon"
},
"jsonrpc": "2.0",
"id": 0,
}
Is this the leading proposal?