Resources as atomic units of state and can be used to model all kinds of objects such as fruits 🍏, currencies 💵, messages 💌 or anything else you might think of. The underlying resource object contains standardized data fields, which are defined in the Anoma specs. While all fields are needed for the Anoma Resource Machine the label, quantity, and value field are particularly relevant for application developers.
10 💵 {owner: Alice} | 2 🍏 {fruitiness: 8/10} | 1 💌 {text: "I ❤️ u"} |
10 USD resource | 2 Apple resource | 1 Message Resource |
The label can contain arbitrary data describing the resource and determining its kind. Examples for label data are the name and symbol of a currency, the species of an apple, or a message associated with a specific channel in a messaging application.
The value field can contain arbitrary data associated with this specific resource. Examples for value data are information about the owner, the fruitiness of a fruit, or the text in a message. The difference to the label field is that this data is not influencing the resource kind.
The quantity indicates the number of units that the resource represents. In practice, resources are often split and joined. For example, Alice owning a 10 USD resource might want to give 4 USD to pay someone and keep the remaining 6 for herself. In some cases, only one resource instance should ever exist (e.g., for a message or an NFT).