> For the complete documentation index, see [llms.txt](https://sixnetwork.gitbook.io/nft-gen-2-tech-doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sixnetwork.gitbook.io/nft-gen-2-tech-doc/overview/modules/core-module.md).

# Core Module

## Metadata Schema

In order to work with metadata dynamically , we need to define basic information of the NFT from origin chain ( Ethereum, Klaytn  or EVM chain ), attributes which will be maintained on NFT Data chain and also actions that process those attributes.

<table><thead><tr><th width="283">Name</th><th width="141">Data Type</th><th>Description</th></tr></thead><tbody><tr><td>code</td><td>string</td><td>unique code to identify your NFT.</td></tr><tr><td>name</td><td>string</td><td>Name of the NFT</td></tr><tr><td>owner</td><td>string</td><td>Cosmos-based address who create the this schema</td></tr><tr><td>system_actioners</td><td>array</td><td>Array of addresses that has permission to perform actions</td></tr><tr><td>origin_data</td><td>object</td><td>Information from origin chain</td></tr><tr><td><ul><li>origin_base_uri</li></ul></td><td>string</td><td>Base URI representing metadata on origin chain</td></tr><tr><td><ul><li>uri_retrieval_method</li></ul></td><td>string</td><td>Retrieval method of the origin metadata ("base", "token").<br></td></tr><tr><td><ul><li>origin_chain</li></ul></td><td>string</td><td>Origin chain which NFT Smart Contract is deployed ( "ethereum" , "klaytn" )</td></tr><tr><td><ul><li>origin_contract_address</li></ul></td><td>string</td><td>Smart Contract address</td></tr><tr><td><ul><li>attribute_overriding</li></ul></td><td>string</td><td>When there is an attribute designed to manage on data chain with the same attribute on the origin chain, this indicator will determine which value will be presented from the data chain's metadatabase URI.</td></tr><tr><td><ul><li>metadata_format</li></ul></td><td>string</td><td>To indicate the format when metadata was presented.</td></tr><tr><td><ul><li>origin_attributes</li></ul></td><td>list of attribute definition</td><td>list of origin attributes</td></tr><tr><td>      - name</td><td>string</td><td>Attribute name</td></tr><tr><td>      - data_type</td><td>string</td><td>Data type of attributes. One of number, string, boolean and float </td></tr><tr><td>      - display_<em>value</em>_field</td><td>string</td><td>The field name represents the attribute's value when displayed in a marketplace format. For example, "opensea." See the whole example below.</td></tr><tr><td>      - display_option</td><td>object</td><td><p>Attribute format represent attribute data in marketplace format. For example ,<br>{ </p><p>     "opensea": </p><p>     { </p><p>        "trait_type": "Background L" </p><p>     } </p><p>}</p></td></tr><tr><td>onchain_data</td><td>object</td><td>Dynamic part of metadata</td></tr><tr><td><ul><li>nft_attributes</li></ul></td><td>list of attribute definition</td><td>A list of attributes in which every token metadata has the same value can only be changed by the NFT creator, not the token holder. Same structure as attributes in origin part</td></tr><tr><td><ul><li>token_attributes</li></ul></td><td>list of attribute definition</td><td>A list of metadata attributes is stored on the chain for each token of the NFT. Attribute Definition is the same structure as attributes in the original part</td></tr><tr><td><ul><li>actions</li></ul></td><td>list of Action</td><td>A list of actions (a logic to update attribute value) pre-designed for users to perform </td></tr><tr><td>      - name</td><td>string</td><td>Action name which is used to referred for invoking</td></tr><tr><td>      - desc</td><td>string</td><td>A description of the action</td></tr><tr><td>      - when</td><td>string</td><td>Conditions to validate to be valid before invoking Action</td></tr><tr><td>      - then</td><td>list of sub-actions</td><td>A list of line s of action to make changes on the attribute. For example, if we need to decrease one attribute by 1, the code will be like this -> <br>"<mark style="color:blue;">meta.SetNumber('percent_discount_10',meta.GetNumber('percent_discount_10') - 1)</mark>"</td></tr><tr><td>      - params </td><td>list of object params</td><td>A list of parameters of actions. Some action required the parameter to make it able to perform.</td></tr></tbody></table>

To explain easily how we can create the schema, we can use the command line built from CosmosSDK

```shell
sixnftd tx nftmngr create-nft-schema --from alice \
    <BASE64 schema>
```

\<BASE64 schema> is the NFT Schema from the above table in JSON encoded by base64.

## NFT Data

There are 2 important parts to the NFT Data. One is data from the origin chain and those attributes maintained in Data Chain. See the table below:

&#x20;

<table><thead><tr><th width="199">Name</th><th width="128">Data Type</th><th>Description</th></tr></thead><tbody><tr><td>nft_schema_code</td><td>string</td><td>Code reference to a unique schema</td></tr><tr><td>token_id</td><td>string</td><td>NFT Token iD</td></tr><tr><td>token_owner</td><td>string</td><td>A Cosmos-based account that owns the token.</td></tr><tr><td>origin_image</td><td>string</td><td>an image URL originally defined</td></tr><tr><td>onchain_image</td><td>string</td><td>As an option, a new image URL in case there is a business case to change an image after some actions</td></tr><tr><td>token_uri</td><td>string</td><td>URI By token, used if present. If not schema's <em>origin_base_uri</em> is used.</td></tr><tr><td>origin_attributes</td><td>list of attribute value</td><td>List of attributes which has the same value as in original metadata. It's read-only and should never be changed after minting is started</td></tr><tr><td>onchain_attributes</td><td>list of attribute value</td><td>List of attributes with a mutable value that can be modified by calling actions. </td></tr></tbody></table>

## Available function

<table><thead><tr><th width="308">Function</th><th>Desc</th></tr></thead><tbody><tr><td>meta.GetImage()</td><td>It will find and return onchain_image from nft_metadata, when onchain_image is empty it will return origin_image form nft_metadata instead</td></tr><tr><td>meta.SetImage(string)</td><td>To set new onchain_image of nft_metadata</td></tr><tr><td>meta.GetNumber(attribute_name)</td><td>It will return value of attribute type number</td></tr><tr><td>meta.GetFloat(attribute_name)</td><td>It will return value of attribute type float</td></tr><tr><td>meta.GetString(attribute_name)</td><td>It will return value of attribute type string</td></tr><tr><td>meta.GetBoolean(attribute_name)</td><td>It will return value of attribute type boolean</td></tr><tr><td>meta.SetString(attribute_name,new_value)</td><td>To set new value of attribute type string</td></tr><tr><td>meta.SetNumber(attribute_name,new_value)</td><td>To set new value of attribute type number</td></tr><tr><td>meta.SetFloat(attribute_name,new_value)</td><td>To set new value of attribute type float</td></tr><tr><td>meta.SetBoolean(attribute_name,new_value)</td><td>To set new value of attribute type boolean</td></tr><tr><td>meta.ReplaceAllString(string,to_replace,replace_with)</td><td>To place string according to regex that we find</td></tr><tr><td>meta.SetDisplayArribute(attribute_name,new_value)</td><td>To hide/show attribute from marketplace (new_value should be true/false)</td></tr><tr><td>meta.TransferNumber(attribute_name,target_id,value)</td><td>Transfer attribute type number to target token. Ex: transfer points</td></tr></tbody></table>

### meta.{Utils}

<table><thead><tr><th width="310">Function</th><th>Desc</th></tr></thead><tbody><tr><td>meta.GetBlockHeight()</td><td>It will return current blocktime of chain</td></tr><tr><td>meta.GetUTCBlockTimestamp(format)</td><td>It will return current UTC blocktime of chain in which format that we input.<br>>> <a href="https://www.geeksforgeeks.org/time-formatting-in-golang/">Go Time Format Layout</a> &#x3C;&#x3C;</td></tr><tr><td>meta.GetBlockTimestampByZone(zone,format)</td><td>It will return current blocktime according to input zone and format.<br>>> <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones">TimeZone</a> (List TZ database name)&#x3C;&#x3C;</td></tr><tr><td>meta.BlockTimeUTCBefore(target_time,format)</td><td>Validate current time is before time of input and its format (return true/false)</td></tr><tr><td>meta.BlockTimeUTCAfter(target_time,format)</td><td>Validate current time is after time of input and its format (return true/false)</td></tr><tr><td>meta.BlockTimeBeforeByZone(target_time,zone,format)</td><td>Validate current time is before time of input time, zone and its format (return true/false)</td></tr><tr><td>meta.BlockTimeAfterByZone(target_time,zone,format)</td><td>Validate current time is after time of input time, zone and its format (return true/false)</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://sixnetwork.gitbook.io/nft-gen-2-tech-doc/overview/modules/core-module.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
