1# Building an NFT Application23## Architecture45Both centralized and serverless architectures are supported and application creator can decide which one to use6depending on how much logic and data they intend to manage off-chain and off-line.78### Server-based architecture910In server-based architecture the application creator manually creates NFT collections and authorizes server to perform11operations on each collection. See NFT palette methods that have admin permission level to understand better what server12(or administrators) can do.13141516### Serverless architecture1718In serverless architecture the application creator does all initialization and token distribution manually.19Alternatively, smart contracts may be used in order to implement some distribution mechanics such as token sales or20claiming. The dApp has access to all properties of an NFT token, but it does not have any elevated permissions, since it21resides on user site. All operations happen on user's behalf signed by user's private key.22232425## Custom Types for JS API2627See in root README2829## NFT Palette Methods3031### Collection Management3233#### CreateCollection3435##### Description3637This method creates a Collection of NFTs. Each Token may have multiple properties encoded as an array of bytes of38certain length. The initial owner and admin of the collection are set to the address that signed the transaction. Both39addresses can be changed later.4041##### Permissions4243- Anyone4445##### Parameters4647- customDataSz: Size of NFT properties data.4849##### Events5051- CollectionCreated52 - CollectionID: Globally unique identifier of newly created collection.53 - Mode: Collection mode54 - Owner: Collection owner5556#### ChangeCollectionOwner5758##### Description5960Change the owner of the collection6162##### Permissions6364- Collection Owner6566##### Parameters6768- CollectionId6970#### DestroyCollection7172##### Description7374DANGEROUS: Destroys collection and all NFTs within this collection. Users irrecoverably lose their assets and may lose75real money.7677##### Permissions7879- Collection Owner8081##### Parameters8283- CollectionId8485#### CreateItem8687##### Description8889This method creates a concrete instance of NFT Collection created with CreateCollection method.9091##### Permissions9293- Collection Owner94- Collection Admin9596##### Parameters9798- CollectionID: ID of the collection99- Properties: Array of bytes that contains NFT properties. Since NFT Module is agnostic of properties’ meaning, it is100 treated purely as an array of bytes101- Owner: Address, initial owner of the NFT102103##### Events104105- ItemCreated106 - ItemId: Identifier of newly created NFT, which is unique within the Collection, so the NFT is uniquely107 identified with a pair of values: CollectionId and ItemId.108109#### BurnItem110111##### Description112113This method destroys a concrete instance of NFT.114115##### Permissions116117- Collection Owner118- Collection Admin119- Current NFT Owner120121##### Parameters122123- CollectionID: ID of the collection124- ItemID: ID of NFT to burn125126##### Events127128- ItemDestroyed129 - CollectionID130 - ItemId: Identifier of burned NFT131132#### AddCollectionAdmin133134##### Description135136NFT Collection can be controlled by multiple admin addresses (some which can also be servers, for example). Admins can137issue and burn NFTs, as well as add and remove other admins, but cannot change NFT or Collection ownership.138139This method adds an admin of the Collection.140141##### Permissions142143- Collection Owner144- Collection Admin145146##### Parameters147148- CollectionID: ID of the Collection to add admin for149- Admin: Address of new admin to add150151#### RemoveCollectionAdmin152153##### Description154155Remove admin address of the Collection. An admin address can remove itself. List of admins may become empty, in which156case only Collection Owner will be able to add an Admin.157158##### Permissions159160- Collection Owner161- Collection Admin162163##### Parameters164165- CollectionID: ID of the Collection to remove admin for166- Admin: Address of admin to remove167168### Item Ownership and Transfers169170This group of methods allows managing NFT ownership.171172#### GetOwner173174##### Description175176Return the address of the NFT owner.177178##### Permissions179180- Anyone181182##### Parameters183184- CollectionId185- ItemId: ID of the NFT186187##### Returns188189Owner address190191#### BalanceOf192193##### Description194195This method is included for compatibility with ERC-721. Return the total count of NFTs of a given Collection that belong196to a given address.197198##### Permissions199200- Anyone201202##### Parameters203204- CollectionId205- Address to count NFTs for206207##### Returns208209Total count of NFTs for Address210211#### Transfer212213##### Description214215Change ownership of the NFT.216217##### Permissions218219- Collection Owner220- Collection Admin221- Current NFT owner222223##### Parameters224225- Recipient: Address of token recipient226- ClassId: ID of item class227- ItemId: ID of the item228229#### TransferFrom230231##### Description232233Change ownership of a NFT on behalf of the owner. See Approve method for additional information. After this method234executes, the approval is removed so that the approved address will not be able to transfer this NFT again from this235owner.236237##### Permissions238239- Collection Owner240- Collection Admin241- Current NFT owner242- Address approved by current NFT owner243244##### Parameters245246- Recipient: Address of token recipient247- ClassId: ID of item class248- ItemId: ID of the item249250#### Approve251252##### Description253254Set, change, or remove approved address to transfer the ownership of the NFT.255256##### Permissions257258- Collection Owner259- Collection Admin260- Current NFT owner261262##### Parameters263264- Approved: Address that is approved to transfer this NFT or zero (if needed to remove approval)265- ClassId: ID of item class266- ItemId: ID of the item267268#### GetApproved269270##### Description271272Get the approved address for a single NFT.273274##### Permissions275276- Anyone277278##### Parameters279280- ClassId: ID of item class281- ItemId: ID of the item282283##### Returns284285Approved address