Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TIP-101: Succinct canonical token names #87

Open
nullchinchilla opened this issue Mar 6, 2022 · 0 comments
Open

TIP-101: Succinct canonical token names #87

nullchinchilla opened this issue Mar 6, 2022 · 0 comments
Labels
TIP Themelio Improvement Proposal

Comments

@nullchinchilla
Copy link
Member

nullchinchilla commented Mar 6, 2022

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 height and index be 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, then height = 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 of unique_number.

For example, a token made by the 3rd transaction of 100000 would have name X-ZOCDAKKOSBAB

Deployment

TBD

@nullchinchilla nullchinchilla added the TIP Themelio Improvement Proposal label Mar 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TIP Themelio Improvement Proposal
Projects
None yet
Development

No branches or pull requests

1 participant