Questions tagged [multi-index]

Questions related to Multi-Indexes for Smart Contracts Tables

Filter by
Sorted by
Tagged with
0
votes
1answer
25 views

How do I lookup multiple entries by same secondary indices with more than limit entries?

I have a table with a lot of entries. I want to iterate through all the rows by the same secondary index on multiple pages. TABLE post { uint64_t id; name author; string text;...
0
votes
1answer
19 views

Is it possible to add a secondary index to a table that already exists and contains entries?

If a table already exists in a smart contract on-chain and the table is full of entries, is it possible to make a secondary index for that table? Or would you have to create a new table and migrate ...
0
votes
1answer
31 views

Is there way to retrieve auto incremented primary key after submission of transaction?

I'm working on sample dApp application to understand the working of multi_index table in EOS smart contract. I have defined two multi_index table. The primary key of table1 is auto incremented using "...
0
votes
2answers
45 views

Use UUID as primary key in multi_index

How can I use a uuid as the primary. struct [[eosio::table]] blackboxdata { name user; std::string uuid; std::string hash; std::string sqlrequest; uint64_t ...
0
votes
1answer
28 views

Is it possible to see the RAM delta of a multi_index table operation, or see who is currently paying for a row in a table

My question is in the context of smart contract development, so I'm looking for solutions that work within smart contracts: 1st: Is is possible to see the RAM delta of either an individual ...
0
votes
1answer
23 views

Of what type is the return value of get_index?

Every single example out there that shows how to use a secondary index in the EOSIO platform, including the scant documentation on the function found here: https://eosio.github.io/eosio.cdt/latest/...
0
votes
0answers
15 views

Intersect multi index with vector

So i have a vector with eosio::names and my table has a primary key of the same type. I want the result of the intersection in my table as end result. Existing table data (other row fields) need to be ...
0
votes
1answer
36 views

How to retrieve filtered multi-index table data?

I have a smart contract that has a multi-index table called reservations - account, time, date, entity. From the code I am trying to use get_table_rows to get all reservations related to a given ...
0
votes
0answers
40 views

Code abstraction

I need a little guidance. I've been structuring my code like this: #include <eosio/eosio.hpp> class [[eosio::contract("table")]] Square { private: struct [[eosio::table]] square { ...
0
votes
1answer
165 views

call to implicitly-deleted copy constructor

I'm unable to compile a small test contract and am hoping for guidance. I have a class called Account, in the following 2 files: // --- account.hpp #pragma once #include <string> #include &...
0
votes
1answer
21 views

Why I didn't initialize database?

I want to add the my multi_index in controller db. And Finally Adding all class is set up. But When eos program initialize the database, it didn't work. my error log : /eos/libraries/chainbase/...
0
votes
1answer
121 views

How can we retrieve table data with secondary Index in EOS table

this is my table struct [[eosio::table]] payment_made { uint64_t pay_id; uint64_t loan_id; uint64_t pay_amunt; time_point_sec pay_date_req; time_point_sec pay_date_approve; ...
0
votes
1answer
17 views

Multi index table asks an unusual permission to emplace new row

Problem I'm trying to emplace a new row in a multi-index table, but it tells me that I don't have the authotity of the row key name to do it. Code Multi-index table definition struct [[eosio::...
0
votes
1answer
113 views

How to upgrade a multi_index table in a smart contract

I have initially the following multi_index table: struct [[eosio::table]] plastict { uint64_t id; uint64_t type; uint64_t primary_key() const { return id; } }; typedef eosio::multi_index&...
0
votes
2answers
129 views

How to loop a multi_index table in a smart contract

I have very simple table items with the following structure: struct [[eosio::table]] item { uint64_t id; uint64_t state; string description; uint64_t primary_key() ...
0
votes
1answer
60 views

How do I access (sha256) / sort (i128) a secondary/tertiary indices with cleos / curl?

I'm trying to access either of our additional indices of the accountext table. I'm able to access the 3rd index but I'm not sure how to sort it, the second index returns an empty table: // this I ...
1
vote
1answer
40 views

Unable to make use of secondary index in multi-index table

I am trying to add secondary index to my table so I can use it to query for elements based on it. My struct looks like this: struct [[eosio::table]] user { name userAccount; // user ...
0
votes
2answers
81 views

How do I return an iterator?

I have a multi-index defined such that I can do: <type?> test() { myTable t(_self, _self.value); auto r = t.find(...); return r; } but how do I return the iterator? what is the ...
0
votes
0answers
67 views

Search in a multi_index table by multiple fields (compound search)

Here is defined a sample table with four fields, two of them (account and type) I am going to use in my compound search: struct [[eosio::table]] total { uint64_t id; uint64_t account; ...
0
votes
0answers
31 views

Fetching Rows from Table using Secondary Index with Duplicate Values

If I have a table in a smart contract with a secondary (non-unique) index, and I am retrieving the rows in this table via the RPC get_table_rows endpoint, how can I retrieve all the rows in the table ...
1
vote
0answers
26 views

Fetching More Table Rows via RPC

I have a contract with a table in it. I'm querying the contents of the table using the RPC interface, but I'm having trouble getting all the rows. To limit the memory usage of my application, I'm ...
2
votes
1answer
83 views

What is the meaning of “scope” in a Smart Contract?

Since I have read the tutorial. I don't understanding the following: Note that scopes are used to logically separate tables within a multi-index (see the eosio.token contract multi-index for an ...
1
vote
1answer
193 views

How to create composite primary key?

I have a table of prices where I want to store 2 prices per cross defined like this: struct [[eosio::table]] _prices { symbol base; symbol quote; float value = 0.0; uint128_t ...
0
votes
0answers
35 views

How to return a record found?

suppose I have: struct [[eosio::table]] _test { asset supply; uint64_t primary_key() const { return supply.symbol.code().raw(); } }; typedef eosio::multi_index<name("test"), _test> ...
0
votes
0answers
75 views

how can I get sorted table rows by using getTableRows()?

my contract: user.hpp: struct [[eosio::table]] user{//[[eosio::table]] // uint64_t id; // string username; // uint64_t id; //rank ...
0
votes
1answer
99 views

How do you define uuid indexes in contract tables?

I would get table entries by uuid. how can I convert string format 16cadf15-dda7-4be2-8026-c3c7875322d0 to an indexable eosio type ( uint64_t, uint128_t, uint256_t, double or long double). Or even ...
4
votes
1answer
329 views

Get Table Rows with Pagination

How do we get records from a table by pages? My requirement: I have a table with 100 records and want to display all these records in my front-end-application with 10 records per page and if the user ...
1
vote
1answer
122 views

Retrieve data from multi index table

I found that it is possible to define up to 16 secondary indices for a multi index table. Is it possible to return data from the table using these secondary key? I have a table like, result is set as ...
0
votes
1answer
36 views

How is memory aligned in the EOSIO smart contract consensus memory?

Are there any memory savings if I declare a table record that has, say, a 64-bit integer (occupies 8 bytes) and a 16-bit integer (occupies 2 bytes)? Or is it aligned at 64 bits and said record would ...
0
votes
1answer
35 views

why i get “uniqueness constraint was violated” on error on empty table?

i defined a table but i made a mistake putting the fields in wrong order within EOSLIB_SERIALIZE EOSLIB_SERIALIZE( tablename,(field1)(field4)(field3)(field2)); i did some insertions with emplace ...
0
votes
1answer
42 views

Contract won't keep index count inside index table

Attempting to keep track of an index for future use as an index in another container. uint64_t namehash = ::eosio::string_to_uint64_t(my_name.c_str()); auto name_iter = ...
6
votes
2answers
683 views

How to use checksum256 secondary index to get table rows

Does anyone know the correct way to get table rows using checksum256 (fixed_bytes<32>) secondary index through the get_table_rows RPC API? I found a way using key256, but key256 is deprecated ...
1
vote
1answer
123 views

Search multi_index by nonprimary key

#include <eosiolib/eosio.hpp> using namespace eosio; class [[eosio::contract("addressbook")]] addressbook : public eosio::contract { public: using contract::contract; addressbook(name ...
0
votes
2answers
133 views

Multi_index issues

I'm getting a lot of errors related to multi_index after updating to the newest eosio.cdt. Here is part of my code related to hash. struct st_hash { capi_checksum256 hash; uint64_t expiration; ...
0
votes
0answers
25 views

why it prints only one “record/row”?

I created a table with 5 rows/records. I tried to print the whole table content with the following code: require_auth(_self); accounts_table accounts(_self, _self.value); for(auto itr = accounts....
1
vote
2answers
150 views

Is there a way to query table with the value of a particular data field

Is there a way to query table with the value of a particular data field (for example, a token value) when using 'get_table rpc'? Only users whose token value is greater than 30 are output.
1
vote
0answers
28 views

cannot get latest state of table after modifying table in inline action

As shown with code below, I modify table in an inline action, and then want to get the latest data. But the data I get is not the latest. Why? void mycontract::myfunc() { action ( ...
2
votes
1answer
260 views

Iterating through secondary indices

I have a table with some secondary indices. I want to iterate through the rows whose values are act >= 1 and discard the rest. So: table holders(_self, _self.value); auto index_by_act = holders....
0
votes
1answer
134 views

EOSIO: name.value secondary index returns end iterator, even though searched value exists in table

I've got a multi-index table going with two secondary indices: TABLE entry { uint64_t id = 0; eosio::name player; std::vector<uint16_t> allocation; ...
2
votes
1answer
242 views

Using name as secondary index

I want to save name in table, and to search by it. It doesn't seems that it is possible to have secondary index with type name for some reason. I would like also to pass name in function and to have ...
3
votes
1answer
343 views

How do I create a Multi-Index DB secondary index from a String?

I'm developing a Smart Contract for EOSIO. I have a Multi-Index table with a uint64_t primary key. I'd like to add a secondary index to the table. Ideally the data I'd be indexing on would be a std::...
1
vote
1answer
242 views

Multi Index table local instance

I am creating a local instance of multi index table (following the example given in this tutorial: https://developers.eos.io/eosio-cpp/docs/using-multi-index-tables) but when I try to compile I get ...
4
votes
1answer
94 views

BUG when two accounts send action at the same time to modify multiindex table

It took me several days to find the bug. I got a table like this TABLE t {uint64_t key, name player1, name player2, uint64_t status}; When the contract received the specific action, it will go ...
2
votes
1answer
125 views

Performance: Would it be a problem to store 100,000 or 1,000,000 rows in a multi_index table?

So, let's say we had the necessary ram, cpu, and net to store a lot of records in a multi_index table. (100,000 to 1,000,000). Considering that a transaction in EOS has a max execution time (150 ms), ...
1
vote
1answer
196 views

How does “tablename”_n differ to N(tablename) when defining a multi_index?

I've seen two examples of how to define the table name of multi_index: N(tablename) "tablename"_n (source) Initially I tried using the former, but resulted in the below compilation error. I have ...
3
votes
2answers
303 views

Is it possible to use a type other than uint64_t for a table primary key?

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?
1
vote
1answer
40 views

Why don't need ram_payer for erase method in mulit_index class?

mulit_index class has three methods (emplace, modify, erase) to update a table. emplace and modify methods need to select ram_payer. But erase method doesn't need to select it. I think these methods ...
2
votes
2answers
226 views

Using Demux to store data offchain in EOS blockchain

Does anyone have any idea dea how to use Demux with EOS Blockchain. There is this repo where they give example how to use Demux. I want to ask if there is any example for how to "use Demux without ...
2
votes
1answer
88 views

Stored vector of strings in table implicitly converting to vector of unsigned char, why?

I'm trying to store an object in a multi-index table with one of the members a vector of std::string. When retrieving the data however it comes back as a vector of unsigned char, and I can't do ...
2
votes
1answer
111 views

About Updation of contract

I have 2 questions about updation of contract and multi-indexed tables? 1)Can i update contract as if i want to change ram payer for multi indexed tables can i change it after deploying contract ? ...