According to the types.h all string-related data-types (or at least those where i would presume that they receive strings) like account_name
, token_name
and so on are declared as uint64_t
and i am curious why it is so?
I stumbled upon this code from EOS-repo:
struct contract {
contract( account_name n ):_self(n){}
account_name _self;
};
and looked up the type account_name
which is defined in types.h:
typedef uint64_t account_name;
typedef uint64_t permission_name;
typedef uint64_t token_name;
....
At a first glance i thought that strings maybe stored only once per lifetime in the blockchain database to reduce its size and that they will receive something like an ID as uint64 to reuse in further contracts. But then i found from a future related perspective that the range of an uint64 may not fit all needs over upcoming decades. Also the lookup could take some time from up to a specific size.
At a second glance i think it could simply be a hash of this string. If so, will the appropriate string stored as a full string elsewhere?
Any clarification is very appreciated.
Also, if my assumption is right, i'd like to ask how to convert a string into such an uint64
-based number within code internally (or which hash-function will be used).
Thanks in advance!