XSC-0005: Non-Fungible Token
XSC-0005 defines the ownership, approval, metadata, and event surface used by Xian NFT wallets, explorers, marketplaces, and indexers.
Required Storage
owners = Hash(default_value="")
balances = Hash(default_value=0)
approvals = Hash(default_value="")
operator_approvals = Hash(default_value=False)
metadata = Hash()
token_data = Hash(default_value="")The on-chain checker validates these names and the required function signatures with importlib.enforce_interface.
Required Functions
change_metadata(key: str, value: Any)
balance_of(owner: str) -> int
owner_of(token_id: str) -> str
exists(token_id: str) -> bool
transfer(token_id: str, to: str)
approve(token_id: str, to: str)
revoke(token_id: str)
get_approved(token_id: str) -> str
set_approval_for_all(operator: str, approved: bool)
is_approved_for_all(owner: str, operator: str) -> bool
transfer_from(token_id: str, to: str, main_account: str)
token_metadata(token_id: str) -> dict
contract_metadata() -> dictArgument names are part of interface compatibility.
Semantics
- a live token has exactly one owner
balance_ofcounts the owner's live tokens- direct transfer requires ownership by
ctx.caller - token approval authorizes one spender for one token
- operator approval authorizes an operator for every token owned by the caller
transfer_fromaccepts the owner, token-approved spender, or approved operator- transfer clears the token-specific approval
token_metadataincludes ownership and render/verification metadata
Metadata
Collection metadata must contain:
standard = "XSC-0005"collection_namecollection_symbolcollection_description
Common token fields include name, description, creator, creation time, MIME type, encoding, content or URI, content hash, and optional royalty receiver and basis points.
Large content may use chunking, but chunk management is an extension. The reference collection prevents transfer until chunked content is complete and locked.
Events
Conforming collections should emit:
TransferApprovalApprovalForAllMetadataUpdate
Index owner/spender/token fields needed by applications. Events are a behavioral requirement; the interface checker validates callable/storage shape, not emitted history.
Optional Extensions
The reference collection adds:
- mint and burn
- chunked content and content locking
- likes and ownership proofs
- marketplace listing, cancellation, purchase, and royalty helpers
- PixelGrid palettes and compact animation frames
These extensions are not required for XSC-0005 compliance. Integrations should feature-detect them instead of assuming every collection implements them.
PixelGrid uses the xian.pixelgrid.v1 render schema and palette-index-64 encoding. Palettes should be locked before minting, and the content hash should bind the schema, palette, dimensions, frames, delay, and pixel data.
Compatibility Rules
- keep required function and argument names stable
- keep the required storage hashes available
- treat token-data keys as extensible
- bound content and return payloads
- guard every mutating companion/extension function
- do not make marketplace or render extensions prerequisites for basic NFT ownership and transfer
The maintained reference implementation and checker live in the xian-nft product repository. See Xian NFT.