Metadata

Metadata

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

Metadata has a key-value structure. The key and value are both texts. We recommend using 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 an authorizer_ref struct which means that the creator can be either one account (aka public key) or one group. It must be attached to a domain, NFT, group, or FT. Not everyone can append the metadata of an object. For a domain, it could be added by the domain creator or members within the authorization management tree. For an NFT, metadata could be added by the owner of the NFT or members within the authorization management tree. For a group, it could be added by the creator of the group. For an FT, it could be added by the creator or members within the authorization management tree.

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:

Click to see full code example
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:

Click to see full code example
|->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