11

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?
1
  • 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. Commented May 8, 2018 at 20:37

1 Answer 1

9

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).

3
  • So contract names are exempt from these rules?
    – Matei Radu
    Commented Apr 27, 2019 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. Commented Jul 10, 2019 at 6:01
  • @PhillipHamnett-EOS42 Thanks for clarifying
    – Matei Radu
    Commented Jul 10, 2019 at 7:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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