-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Change Account Name & Message Types #56
Comments
I would stress that, in my view, these names should be for developers only. We simply cannot expose to end users a naming system that allows them to use lower-case letters, positive single digit integers less than 6, and periods (but with special restrictions on the use of periods). We could let them pick their own arbitrary, unrestricted (non-unique) name, and mangle it down to one of these as their "account ID," but that's a wallet/UI question. Developers, otoh, can work with these names just fine, and with good tooling, they'll probably make a lot of dev/debugging work a lot easier. Personally, I vote we ditch the period namespace thing, too. I'm not convinced that's a good idea even with long, full alphanumeric names. I don't think it makes sense with these names. |
The namespace gives people a way to build / apply trust to domain extensions and/or organizations, but I agree by the time you use a few characters for domain the user name is very short. |
It also means people must think of these names as strings, and not integers. If someone chooses one as an integer, and the corresponding string happens to have a dot in it, it will fail. |
This implements the Name type which interprets a 60 bit integer has base32 with the characters '.abcdefghijklmnopqrstuvwxyz012345' and will trim trailing '.' when converting to a string. This allows names up to 12 characters long. Internal '.' is allowed.
I agree, I use '.' to represent the null bits and then trim it. The only requirement on the integer is that it must be 60 bits and the high bits must be 0. Otherwise there would be a reduced range on the final string character and we would have to special case. I think reserving a few bits may also give us potential to expand in the future. |
I'm sure you know my opinion already, since I have stated it with the Steem design as well, but I will state it here anyway. I think developer convenience should just be provided with the appropriate helpful libraries and tooling, and I think that 64-bit IDs (incrementing, not arbitrarily chosen by users/clients) should be used by the blockchain to uniquely identify accounts and message types. Whether it makes sense performance-wise to use variable-length integer encodings, to save bandwidth and blockchain space, or fixed 8-byte integers, to save parsing computation time (only in the very parallel stage 1 mind you), within the actual signed transactions is another matter that is less important to me. The EOS blockchain could launch with a contract (native or not) that provides a very simple naming system that allows existing accounts to throw away their existing name if they have one and adopt a new one (perhaps with a tiny EOS fee that is burned?) not currently used by anyone else if they do not already have one. These names can have similar character restrictions as Steem but have a max length of say 32 characters. This would be the initial default naming system for the community to adopt, then later when something better and more sophisticated is developed it can supplement this existing namespace (or maybe even replace it if the new one wins in the free market due to say better economic and/or governance models). Some time later after launch, other smart contract(s) could be launched with a more sophisticated naming system (Maybe a restricted subset of Unicode is allowed? Proper subdomain support with delegation of responsibility?), more sophisticated governance model (Trademark disputes? Adjusting fees?), and more sophisticated economic model (Auctions to own name? Leasing with annual fee based on market valuation, e.g. highest bidder in auction, of the name?). Either way it would be the clients that tie in these names (in whichever namespace smart contract is used) in a very seamless way to the unique 64-bit account IDs which is what the blockchain really only cares about. |
@arhag accounts already have an ID that increments in the DB, but this is fraught with issues we experienced with BitShares. Namely, the ID is not known until after it is included in the blockchain. Also debugging BitShares transactions was significantly more difficult because every print statement required access to blockchain state to convert a number into something readable. The adopted solution allows almost any number to be selected by the user and is effectively the same cost computationally as the incrementing count. Everything has been implemented and integrated and all unit tests pass. |
@bytemaster Well, then I have an alternative suggested tweak to the above proposal. First, I would accept as a valid name an ASCII string that is exactly 12 characters long and satisfies the regex expression As can be seen from the regex expression above, there would be 38 allowed characters in the name (could actually be 40 if we wanted). A number between 0 and 37, inclusive, would represent each character. The mapping between each character and its associated number is as follows:
The 64-bit number would be segmented into a sequence of 4 16-bit numbers. Each 16-bit number would encode a sub-sequence of 3 of the allowed characters. Thus it would still be possible to represent 12 characters overall in the name. (Actually, it would be possible to get 2 additional characters for free while still making it possible to represent 12 characters in 64 bits). My suggested encoding of the sub-sequence of 3 allowed characters ( With the restrictions on names described in the regex expression above, we can guarantee that the 64-bit number encoding a name according to the scheme above will always be greater than Furthermore, because of the name restrictions we know that a valid account name cannot start with a digit. This means that if a user enters a number as an account name in a UI, the client can unambiguously know that it is referring to the ID number of the account and not its account name (and thus construct the transaction appropriately). The biggest advantage of this approach over the original proposed design is that it allows all 10 digits to be included in the name rather than just 1 through 5. The biggest disadvantage is that it is slightly more computational intensive to extract the name string from the 64-bit number for the purposes of name validation since 38 (the base used for 16-bit sub-sequences) is not a power of 2 like 32 is (it requires doing two |
Why not just use |
@coolspeed Then you could only handle 10 characters. Also, if you were going to do that you might as well have base 64 since that also gives a 10 character limit but also allows you to have uppercase and lowercase letters, 10 digits, and the dot and hyphen. But there is no need for uppercase letters (and in fact going by the hostname standard, they are are case insensitive). |
@arhag I appreciate your suggestion, but I think we have already agreed that this string representation is mostly used for developer purposes and that the protocol officially recognizes them as ints. In addition to account names we are also using this to represent permission levels and message types (actions). By reserving the upper 4 bits it should be possible to extend the format in the future, but even with your changes 12 characters is still too restrictive for end users. |
To re-cap, 4 bits is not enough for the character set, 5 bits are needed.
test_types::string_to_name()
WASM_ASSERT( eos::string_to_name("mlkjihgfedcba55") == N(mlkjihgfedcba14) , "eos::string_to_name(mlkjihgfedcba14)" ); |
Is account name squatting going to be an issue with people registering 100's of names? Yes, it will still be possible to create unique names but it is going to be hard to have a sensible name. I also assume people can create infinite number of account names? |
# This is the 1st commit message: various improvements # This is the commit message #2: new hash # This is the commit message #3: fix for script path # This is the commit message #4: fixes # This is the commit message #5: fixes # This is the commit message #6: fixes # This is the commit message #7: fixes # This is the commit message #8: fixes # This is the commit message #9: fixes # This is the commit message #10: fixes # This is the commit message #11: fixes # This is the commit message #12: fixes # This is the commit message #13: fixes # This is the commit message #14: fixes # This is the commit message #15: fixes # This is the commit message #16: fixes # This is the commit message #17: fixes # This is the commit message #18: fixes # This is the commit message #19: fixes # This is the commit message #20: fixes # This is the commit message #21: fixes # This is the commit message #22: fixes # This is the commit message #23: fixes # This is the commit message #24: fixes # This is the commit message #25: fixes # This is the commit message #26: testing # This is the commit message #27: testing # This is the commit message #28: testing # This is the commit message #29: testing # This is the commit message #30: testing # This is the commit message #31: testing # This is the commit message #32: testing # This is the commit message #33: testing # This is the commit message #34: testing # This is the commit message #35: testing # This is the commit message #36: testing # This is the commit message #37: testing # This is the commit message #38: testing # This is the commit message #39: testing # This is the commit message #40: testing # This is the commit message #41: testing # This is the commit message #42: testing # This is the commit message #43: testing # This is the commit message #44: fixes # This is the commit message #45: fixes # This is the commit message #46: fixes # This is the commit message #47: fixes # This is the commit message #48: fixes # This is the commit message #49: fixes # This is the commit message #50: fixes # This is the commit message #51: fixes # This is the commit message #52: fixes # This is the commit message #53: fixes # This is the commit message #54: fixes # This is the commit message #55: fixes # This is the commit message #56: fixes # This is the commit message #57: fixes # This is the commit message #58: fixes # This is the commit message #59: fixes # This is the commit message #60: fixes # This is the commit message #61: fixes # This is the commit message #62: fixes # This is the commit message #63: fixes # This is the commit message #64: fixes # This is the commit message #65: fixes # This is the commit message #66: fixes # This is the commit message #67: fixes # This is the commit message #68: fixes # This is the commit message #69: fixes # This is the commit message #70: fixes # This is the commit message #71: fixes # This is the commit message #72: fixes # This is the commit message #73: fixes # This is the commit message #74: fixes # This is the commit message #75: fixes # This is the commit message #76: fixes # This is the commit message #77: fixes # This is the commit message #78: fixes # This is the commit message #79: more testing # This is the commit message #80: testing # This is the commit message #81: fixes # This is the commit message #82: fixes # This is the commit message #83: fixes # This is the commit message #84: fixes # This is the commit message #85: fixes # This is the commit message #86: fixes # This is the commit message #87: fixes # This is the commit message #88: fixes # This is the commit message #89: fixes # This is the commit message #90: fixes # This is the commit message #91: fixes # This is the commit message #92: fixes # This is the commit message #93: propagate-environment for buildkite-agent # This is the commit message #94: propagate-environment for buildkite-agent # This is the commit message #95: propagate-environment for buildkite-agent # This is the commit message #96: propagate-environment for buildkite-agent # This is the commit message #97: fixes # This is the commit message #98: fixes # This is the commit message #99: fixes # This is the commit message #100: fixes # This is the commit message #101: fixes # This is the commit message #102: fixes # This is the commit message #103: fixes # This is the commit message #104: fixes # This is the commit message #105: fixes # This is the commit message #106: fixes # This is the commit message #107: fixes # This is the commit message #108: fixes # This is the commit message #109: fixes # This is the commit message #110: fixes # This is the commit message #111: fixes # This is the commit message #112: fixes # This is the commit message #113: fixes # This is the commit message #114: fixes # This is the commit message #115: fixes # This is the commit message #116: fixes # This is the commit message #117: fixes # This is the commit message #118: fixes # This is the commit message #119: fixes # This is the commit message #120: fixes # This is the commit message #121: fixes # This is the commit message #122: fixes # This is the commit message #123: fixes # This is the commit message #124: fixes # This is the commit message #125: fixes # This is the commit message #126: fixes # This is the commit message #127: fixes # This is the commit message #128: fixes # This is the commit message #129: fixes # This is the commit message #130: fixes # This is the commit message #131: fixes # This is the commit message #132: fixes # This is the commit message #133: fixes # This is the commit message #134: fixes # This is the commit message #135: fixes # This is the commit message #136: fixes # This is the commit message #137: fixes # This is the commit message #138: fixes # This is the commit message #139: fixes # This is the commit message #140: fixes # This is the commit message #141: fixes # This is the commit message #142: fixes # This is the commit message #143: fixes # This is the commit message #144: fixes # This is the commit message #145: fixes # This is the commit message #146: fixes # This is the commit message #147: fixes # This is the commit message #148: fixes # This is the commit message #149: fixes # This is the commit message #150: fixes # This is the commit message #151: fixes # This is the commit message #152: fixes # This is the commit message #153: testing # This is the commit message #154: fixes # This is the commit message #155: fixes # This is the commit message #156: fixes # This is the commit message #157: fixes # This is the commit message #158: fixes # This is the commit message #159: fixes # This is the commit message #160: fixes # This is the commit message #161: fixes # This is the commit message #162: fixes # This is the commit message #163: fixes # This is the commit message #164: fixes # This is the commit message #165: fixes # This is the commit message #166: fixes # This is the commit message #167: fixes # This is the commit message #168: fixes # This is the commit message #169: fixes # This is the commit message #170: fixes # This is the commit message #171: fixes # This is the commit message #172: fixes # This is the commit message #173: fixes # This is the commit message #174: fixes # This is the commit message #175: fixes # This is the commit message #176: fixes # This is the commit message #177: fixes # This is the commit message #178: fixes # This is the commit message #179: fixes # This is the commit message #180: fixes # This is the commit message #181: fixes # This is the commit message #182: fixes # This is the commit message #183: fixes # This is the commit message #184: fixes # This is the commit message #185: fixes # This is the commit message #186: fixes
I came here trying to understand the behavior of the Is it not concerning that the representations I'll note that you use a convention that differs from normal number representation in which trailing zeros are significant whereas leading zeros are not - that is, On a related note, should the constructor of Is it possible that contracts that construct names from strings could be tricked into treating |
Account Name Design
All accounts require a globally unique identifier, for ease of development and use it is best if these account names are human readable. For performance it is best if these account names are 64 bit integers.
By using base32 encoding we can support account names up to 12 characters long consisting of the characters:
[a-z12345.]
We will consider the
.
to be a namespace separator and all trailing (unused) characters shall also be '.'.Converting Strings
An account name can be converted to or from strings as follows:
Is 12 characters enough?
The average username length for twitter accounts created in 2012 is 11 characters. The most popular length for domain names traded on the market place was 8 characters.
UI Benefits of Short Names
User interfaces must be designed to handle the full range of name lengths, if they can assume that a name will be at most 12 characters long it will enable more interface uses.
Longer Names
If users would like to register a longer name, potentially using UTF8 characters, then a separate naming contract can be used and user interfaces can opt to lookup / display the longer name.
Rationalle
A simple currency transfer message consists of 5 account names: sender, receiver, notifier, to, and from. If serialized as 32 byte integers this would require 160 bytes, if serialized as length-encoded strings this would take 5*(1+average account length) bytes, if we assume "average account length" is greater than 10 characters then this will take over 55 bytes.
The current design encodes account names as length-encoded strings which means that smart contracts need to parse these strings (often resulting in copying to properly padded memory) and that the database indices need to maintain 32 bytes (fixed length). This results in both CPU and MEMORY being waisted packing and unpacking types while complicating the code in order to provide the benefit of 32 character human readable account names.
The compromise approach retains human readable names for the underlying identifier while allowing users to map to unique long-form names. It also allows account names long enough to support the average twitter username.
Message Types
We can use the same rationale for message types, namely that for performance reasons a 64 bit integer is ideal but for developer purposes a human readable string is preferred. This will allow developers to assign message types with names up to 12 characters long.
The text was updated successfully, but these errors were encountered: