Input Specification File for ERC-721
The Blockchain App Builder initialization command reads the input specification file and generates the scaffolded project with several tools to assist in the chaincode development process.
- You cannot define token assets based on more than one standard in the same specification file.
- You cannot define multiple non-fungible token assets in a single specification file.
Custom attribute values for non-fungible token assets can be updated by the token owner.
For information on including standard assets in the specification file, see Input Specification File.
NFTArtCollectionMarketPlace with ERC-721-Typescript.yml
In addition to the standard properties and sections, non-fungible token
assets support the behavior
, anatomy
and
metadata
sections in the specification file. Non-fungible token
assets also support the standard
and symbol
properties. The following example shows the structure of a specification file for an
ERC-721 token asset:
assets:
- name: ArtCollection #Asset name
type: token #Asset type
symbol: ART # Token symbol
standard: erc721+ # Token standard
anatomy:
type: nonfungible # Token type
unit: whole #Token unit
behavior:
- indivisible
- singleton
- mintable:
max_mint_quantity: 20000
- transferable
- burnable
- lockable
- roles:
minter_role_name: minter
properties: # Custom asset attributes for non-fungible tokens
- name: price # Custom asset attribute to set the price of a non-fungible token in the marketplace
type: number
- name: on_sale_flag # Custom asset attribute maintains non-fungible token selling status in the marketplace
type: boolean
metadata: # Use this section to maintain the metadata on the blockchain. Only the user creating the non-fungible token can assign metadata attribute values, which cannot be updated later.
- name: painting_name
type: string
- name: description
type: string
- name: image
type: string
- name: painter_name
type: string
Table 7-6 Parameter Descriptions and Examples for an ERC-721 Token Specification File
Entry | Description | Examples |
---|---|---|
type: |
You must specify |
|
symbol: |
The symbol property represents the
symbol that identifies the token contract, for example
ART . Typically the symbol is 3 to 4 characters
long.
|
|
standard: |
The standard property is mandatory for
non-fungible tokens. It represents the token standard to follow during
chaincode generation. In Blockchain App Builder, non-fungible tokens
follow a partial version of the ERC-721 standard. For more information,
see Limitations.
|
|
anatomy: |
The
anatomy section has two mandatory
parameters for non-fungible tokens:
|
|
behavior: |
This section describes the capabilities and restrictions
of the token. The mintable ,
transferable , singleton , and
indivisible behaviors are mandatory for
non-fungible tokens.
|
|
metadata: |
The In the example, |
|
Limitations
Blockchain App Builder provides partial support for the ERC-721 standard. Currently, the following ERC-721 events and methods are not supported.
event Transfer
event Approval
event ApprovalForAll
approve
getApproved
setApprovalForAll
isApprovedForAll