Questions tagged [multi-index]

Questions related to Multi-Indexes for Smart Contracts Tables

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

eoslime test not saving data in table

This is my first experience with eoslime as I want to do unit testing for smart contracts. Not much experienced with nodejs .I am following eoslime documentation: https://docs.eoslime.limechain.tech/...
0
votes
2answers
26 views

how to define a vector with fixed size?

I want to define a vector of strings with a fixed size 3 in the multi-index table of smart contract. I search and tried different ways which I found for CPP vector like: std::vector<string> abc(...
0
votes
0answers
21 views

How to set vector type field as a secondary index in smart contract?

I want to set a group vector as a secondary index in the user smart contract. group is the list of groups. Following is the changes I am doing: struct [[eosio::table]] usertable { ...
0
votes
1answer
53 views

Multiple smart contracts with single account

I have three smart contracts (A, B, C) and one account (X). As the requirement is I just need only one authority (administrator) who is going to manage all these smart contracts data. So I deployed ...
0
votes
0answers
12 views

How to give and check relationship between two smart contracts?

I am working on two smart contracts Users and Groups. The relation is one user can have many groups. Can I have such a relation in these smart contracts? After smart contract deployment and data ...
0
votes
0answers
9 views

How to use/access the stored values in multi_index_table?

Hi I have a question about the multi Index table. So in my table I have the user name (primary key) and a uint64 choice. I have gone through the documentation on how to emplace, modify and delete ...
0
votes
1answer
45 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
26 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
51 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
70 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
33 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
29 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
19 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
48 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
41 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
519 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
22 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
172 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
25 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
170 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
196 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
69 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
48 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 ...
1
vote
2answers
102 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 ...
1
vote
0answers
31 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
129 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
276 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
1answer
125 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
403 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
136 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
37 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
36 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
815 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 ...
2
votes
1answer
142 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
145 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
187 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
30 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
281 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
147 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
272 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
389 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
254 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
141 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
209 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
338 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
236 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 ...