-
Notifications
You must be signed in to change notification settings - Fork 6
Description
| TIP | 101 |
| Category | Notational standards (1xx) |
| Author | Eric Tung eric@themelio.org |
Summary
Right now, other than the built-in tokens SYM, MEL, and ERG, all other tokens don't have canonical "ticker symbols". This TIP strives to provide a notation for succinctly referring to custom tokens in an unambiguous, verifiable way.
Motivation
There is no way right now to unambiguously refer to a custom token, except by a long and unwieldy 256-bit hash. This may not seem such a big problem --- Ethereum AFAIK has the same issue, and in practice people will assign "conventional" names to popular custom tokens.
The problem here is really security: given two tokens, both with big hash blobs as their token names, which one is the "real", say, WETH? A solution to this is human-readable canonical token names that are unique to each token, looking something like X-ROSVAGKUBBIG instead of 9f6579e66c18b661fb51b08e1011d30ad1f8d7324a82b59525597e094ec9d9f9
Proposed changes
We define a new pronounceable encoding of any nonnegative integer. We define a set of syllables, consisting of all syllables of the form CV or CVC, where
- C is one of the following consonants: "p", "t", "k", "b", "d", "g", "f", "s", "h", "v", "z", "r", "l", "w", "y", "c", "q",
- V is one of the following vowels: "a", "e", "i", "o", "u"
We then assign a number to each of these syllables by their index when sorted alphabetically. Then, the pronounceable encoding of an integer is just a little-endian encoding where the "digits" are syllables from this list.
To produce the succinct encoding of a custom token, we follow these steps:
- Let
heightandindexbe the location where the transaction that created the custom token was confirmed. For example, if the token-creating transaction is the 3rd transaction (i.e., the transaction with the third-smallest nosig hash) at block 100000, thenheight = 100000, index = 3. - Compute
unique_number = pi(height, index)using the (Cantor pairing function)[https://en.m.wikipedia.org/wiki/Pairing_function], which gives a unique integer that encodes a pair of integers. - Then, the custom token name is
X-appended to the pronounceable encoding ofunique_number.
For example, a token made by the 3rd transaction of 100000 would have name X-ZOCDAKKOSBAB
Deployment
TBD