This post discusses resource standards similar to EIPs in Ethereum land. The standardization topic came up recently in the forum thread about connecting nullifiers and consumed resources.
Context
Resources contain the labelRef
and valueRef
fields that point to the respective Label
and Value
BLOBs. Label
and Value
can be used to store resource-related data.
In the Label
of a resource (which affects fungibility), app devs will store kind
-related information. For example, in the current Kudos implementation, we have
type TokenLabel :=
mkTokenLabel@{
name : String;
symbol : String;
decimals : Nat;
originator : ExternalIdentity
supply : Supply;
transferability : Transferability;
};
A token resource standard (similar to ERC-20 in Ethereum) could require name
, symbol
, decimals
, and originator
to be present.
In addition, there could be standard extensions that build upon or add more information to existing standards. In the example above, this would be the supply
or transferability
information of the token (see the similar ERC-20-capped and soulbound token extensions in Ethereum).
Likewise, the Value
of a resource can contain multiple entries that can also be standardized.
A token resource might contain the owner
in the Value
field (and other token-related data, e.g., an expiration date).
A counter resource might contain information about its current owner
and the current count
in the Value
field.
Proposal
Standards (tentatively named Anoma Resource Standards (ARSs) for now) could help to store and retrieve resource data in a more generic way, which helps with indexing / data discovery. For example, you could ask an indexer the following:
“Give me a list of all token resources (according to ARS-1) that are transferable (according to ARS-2) that I own (according to ARS-3).”
Projection or transaction functions could then handle standardized resources in a generic way.
To support storage of multiple standardized and non-standardized data inside Label
and Value
BLOBs, a key-value map as the underlying data structure would be required to enable the selective lookup by applications.
The keys of the mapping could then indicate which standards a resource supports (similar to ERC-165 in Ethereum).
An ownership standard, for example, would expect the owner ExternalIdentity
information to be present under a standardized lookup key (e.g., the SHA-256 hash of the string "ARS_Ownership_v1.0.0"
).
Open Questions
- Should
Label
andValue
be required to be a map by the specs (similar to how appData is defined)? - Similar to Ethereum, app devs could mislead about which standards a resource supports. Is formal verification required to solve this issue?
- Should the
Logic
function (or its branches) be standardized too? - What’s the connection between Anoma’s resource model and the RDF / semantic web?
- It feels to me that there is a connection. RDF triplets have the form
(subject, predicate, object)
. Thesubject
seems to be the resource itself, thepredicate
the logic function (or branches therein), andobject
could be other resources (and properties thereof) that must be part of the same action. Constructing a knowledge graph of visible resources could help with indexing and solving.
- It feels to me that there is a connection. RDF triplets have the form