I want to use a uint128_t as a primary key in a multi_index table. Is this possible? If so, how should the ABI file be written to accomodate it?
According to the official documentation you can find here:
They are multi index tables because they support using multiple indexes on the data, the primary index type must be uint64_t and must be unique, but the other, secondary, indexes can have duplicates. You can have up to 16 additional indexes and the field types can be uint64_t, uint128_t, uint256_t, double or long double
So it seems that only uint64_t
are allowed for primary key.
Only uint64_t
can be used as a primary key.
However, you can try to do what you want in a slightly different way: using uint128_t
it as a secondary index.
struct [[eosio::table]] youtable
{
name key;
uint128_t your_value;
uint64_t primary_key() const { return key.value; }
uint128_t get_your_value() const { return your_value; }
};