Metadata

Metadata

Metadata stores extra information of a object. At the moment domains, non-fungible tokens(NFTs), fungible tokens(FTs) symbol and groups support adding metadata.

Metadata has a key-value structure. The key and value are both text. We recommend to use dataurl to store binary data. For example, some wallets might use dataurl to store the icon of a fungible symbol.

The creator of each key in the metadata is a authorizer_ref struct which means the creator can be either one account(aka. public key) or one group. And it must be attached to domain, token, group or fungible. Not everyone can append metadata to a object. For a domain, it could be added by domain creator and members in the authorization tree of management. To be specific, For a NFT, it could be added by the owner of the NFT and members in the authorization tree of issuance, management and transfer, For a group, it could be added by the creator of the group. for a FT, it could be added by the creator and members in the authorization tree of management.

Add Metadata

Add metadata via evtc command line

Add a key-value pair in the metadata of the FT associated with the id 3:

evtc meta fungible 3 key 123456 EVT7JoY9nbkfWCx2opvUhS9pPmWbLjRuhNCmDTG971PVkhxvAzWWr --payer EVT7JoY9nbkfWCx2opvUhS9pPmWbLjRuhNCmDTG971PVkhxvAzWWr

Output:

executed transaction: 0a830c5acb91a2bfbfd06cfb958134aa32a2436bec59f5ac126cc85cb4a742b2
total elapsed: 379 us
total charge: 0.00000 S#1
(1 of 1)
   action : addmeta
   domain : .fungible
      key : 3
  elapsed : 180 us
  details : 
|->key : key
|->value : 123456
|->creator : [A] EVT7JoY9nbkfWCx2opvUhS9pPmWbLjRuhNCmDTG971PVkhxvAzWWr

Then check the result with command:

evtc get fungible 3

and here is meta information:

|->name : ABC
|->sym_name : abc
|->sym : 5, S#3
|->creator : EVT7JoY9nbkfWCx2opvUhS9pPmWbLjRuhNCmDTG971PVkhxvAzWWr
|->create_time : 2018-09-07T05:53:19
|->issue : 
    |->name : issue
    |->threshold : 1
    |->authorizers : 
        |->ref : [A] EVT7JoY9nbkfWCx2opvUhS9pPmWbLjRuhNCmDTG971PVkhxvAzWWr
        |->weight : 1
|->manage : 
    |->name : manage
    |->threshold : 1
    |->authorizers : 
        |->ref : [A] EVT7JoY9nbkfWCx2opvUhS9pPmWbLjRuhNCmDTG971PVkhxvAzWWr
        |->weight : 1
|->total_supply : 100.00000 S#3
|->metas : 
    |->key : key
    |->value : 123456
    |->creator : [A] EVT7JoY9nbkfWCx2opvUhS9pPmWbLjRuhNCmDTG971PVkhxvAzWWr
|->current_supply : 0.00000 S#3
|->address : EVT0000000EcYi9dzBWzaV3127XWTP2KM4KFY2e5v6Qf66ZkfrfZ1