Every CoinSpark asset must be backed by a web page in order to be valid.
The web page provides information about the asset, including its name, issuer, description, issue and expiry dates, and a link to the full contract underlying the asset.
The URL of the web page is calculated from the
CoinSparkGenesis structure/object embedded as genesis metadata in the transaction which created the asset, as well as (in some cases) the details of the first bitcoin input to that transaction. Use the
calcAssetURL method of the
CoinSparkGenesis object (or the
CoinSparkGenesisCalcAssetURL() function for C/C++) to calculate the asset web page URL.
Most of the content on a CoinSpark web page is regular HTML and can be displayed in users’ web browsers. However the web page also contains a UTF-8 encoded JSON structure containing machine-readable metadata about the asset. Following the Asset Issuance Standard shared with MasterCoin and other related protocols, this JSON is embedded in the web page by
\uXXXX-escaping the characters
> in the JSON and inserting the results inside the following code:
<script> if (typeof _bitcoin_asset_specification_ === "function") _bitcoin_asset_specification_(JSON_HERE); </script>
Some fields of the JSON may be freely modified to affect how the asset is displayed in wallets. Other fields may not be modified, since they underly the legal relationship between the asset issuer and holder and are used for calculating asset hashes. If the asset hash calculated from these JSON fields does not match the
assetHash field of the genesis metadata, then the asset is considered invalid and displayed as such in CoinSpark wallets.
This following fields of the Asset Issuance Standard are relevant for CoinSpark:
|JSON field||Description||Max size of field||Max size of linked entity||Required?||Fixed?|
||full name of the asset for display||64 chars||-||Yes||Yes|
||short name of the asset for display||16 chars||-||Yes||No|
||name of the asset issuer or backer||-||-||Yes||Yes|
||underlying value of the asset||512 chars||-||Yes||Yes|
||number by which to multiply the raw asset quantity for display||-||-||Yes||Yes|
||value per display unit||-||-||Yes||Yes|
||absolute URL of the contract underlying the asset||-||16 MB||Yes||No*|
||absolute URL of the asset’s tracking server, or an array of URLs||-||-||Yes||No|
||date/time when the asset was issued, formatted as ISO 8601||-||-||No||Yes|
||date/time when the asset will no longer be valid, formatted as ISO 8601||-||-||No||Yes|
||annual interest rate percentage, negative for demurrage||-||-||No||Yes|
||how to display asset quantities (
||how to display the asset quantity if the display value is exactly 1||20 chars||No||No|
||absolute URL for square icon to show for the asset (PNG only), minimum 32×32 pixels||-||1 MB||No||No|
||absolute URL for square icon to show for the asset (PNG only), minimum 128×128 pixels||-||1 MB||No||No|
||absolute URL of an RSS 2.0 feed for the asset||-||1 MB||No||No|
||absolute URL of the web page where the asset can be redeemed||-||-||No||No|
* Even though the contract URL is not fixed, the content of the contract must not be changed, since it is used for calculating asset hashes.