Since strings internally are converted to uint64 for space efficiency on the eos.io blockchain what are the restrictions that need to be followed for:

  • actions
  • tables
  • index identifiers (within multi_index's)
  • contract names
  • anything else I've forgotten?
  • that's a good question. I'm new to c++. I'm basically following the default naming conventions from eos contract examples, that's usually lower_separated_by_underscores. There are some contracts outside eos that I see people doing CamelCase - I like it because we can understand which of them comes from eos and everything else is custom. May 8 '18 at 20:37

Action names, table names, index names, account names, and everything else you use N(foo), "foo"_n, or eosio::name("foo") for, have these rules. A contract belongs to an account.

  • 12 characters max
  • May contain: a-z, 1-5, or .
  • May not end with .

Names are encoded in base-32:

  • . = 0
  • 1-5 = 1 - 5
  • a-z = 6 - 31

The 5 MSBs of the uint64 contain the first character. Unused characters are replaced with . (0).

  • So contract names are exempt from these rules?
    – Matei Radu
    Apr 27 '19 at 9:12
  • 1
    @MateiRadu Within your C++ code, you can call your contract whatever you like, but the account name that the contract is uploaded to must follow these rules. Jul 10 '19 at 6:01
  • @PhillipHamnett-EOS42 Thanks for clarifying
    – Matei Radu
    Jul 10 '19 at 7:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.