Questions tagged [multi-index]

Questions related to Multi-Indexes for Smart Contracts Tables

Filter by
Sorted by
Tagged with
2
votes
1answer
95 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
122 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 ? ...
1
vote
2answers
486 views

Multi_index query with new CDT

Because name is no longer a uint64_t type I created my struct like this: struct [[eosio::table]] game { uint64_t id; //auto increment name host; name guest= name("none"); name ...
2
votes
1answer
252 views

Samples with eosio.cdt v1.3.0? multi_index with secondary indexes and get_index

Has anyone been successful getting a contract which uses secondary indexes to compile against the latest versions of the CDT (1.3.2)? I'm having trouble and don't see any updated samples which use ...
0
votes
1answer
52 views

Maximum number of multi index tables an account can hold

Is there a limit on the number of multi index tables an account can hold? Is it limited by the RAM?
2
votes
1answer
125 views

Multi-index storing complex types

Is it possible to make a multi-instance table of a struct Base with a couple of virtual methods, and then store entries of derived classes and have it be able to differentiate? So ie: struct animal { ...
1
vote
1answer
339 views

Trying to pass a sha256 hash to my contract and store it

I'm new to the EOS platform. For my use case I'm trying to pass a sha256 hash to a function in my contract and store it in a table which is indexed by that hash. I've realized you can't have the ...
1
vote
3answers
125 views

I want to have permissioned data access over eos

Is it possible to have permissioned data access? Suppose I am having a multi_index table and whoever adds data to that table only can access the data because I am having a table storage and one ...
1
vote
1answer
60 views

Same name table of different contracts got merged

I wrote a contract, suppose C defining the multi-index table T. Table struct has two parameter suppose x and y. x was the primary key. I made some entries in T and when i tried to access it back, I ...
2
votes
1answer
146 views

How to erase data with secondary index?

auto index = table.get_index<N(exp)>(); auto upper = index.upper_bound(100); for(auto itr = index.begin(); itr != upper; ) { itr = index.erase(itr); } above is not work, who can give me an ...
0
votes
2answers
88 views

A contract without struct and multi index table

Actually, I am looking to create a contract in which a variable can be set and later on can be retrieved. All the contracts available there involves struct and multi index table. In EOS, is it ...
5
votes
2answers
207 views

Where should tables be created? In the contract or in each action?

In the simple blog dapp (https://github.com/EOSIO/eosio-project-demux-example) the table (for posts) was defined in the contract but is not instantiated as a field. What are the advantages/...
4
votes
1answer
65 views

Is it possible to see the state of a multi index table for a given block number?

Does the ability currently exist in EOS to see how the state of a persistent memory table was at some point in the past?
2
votes
1answer
192 views

Multi-index table logic

I'm new to smart contracts and I'm having difficulty understanding the logic behind instantiating multi-index tables and how they persist. For example in the addressbook example, it seems a new ...
1
vote
1answer
142 views

The relationship between the Multi-Index DB and block chain?

From the document, I should save data in the Multi-Index DB, I want to know: Does it mean the data is saved into the block chain if I save the data in the DB? If yes, how the data is saved into block ...
2
votes
2answers
407 views

How can I know if I pay ram for a row in a table?

I am creating a non-fungible token. While I own the token, I pay ram for it. After transfer of the token the new owner should pay for it. My token contract updates the payer as soon as the new owner ...
2
votes
0answers
208 views

What are the main differences betwen EOSIO multi_index and Boost multi_index?

Inspired by this comment, I was wondering what are the main differences between eosio::multi_index and boost:multi_index and why do they exist? The documentation notes that there are important ...
2
votes
1answer
168 views

Error 3160003: Invalid table iterator

Getting the Error 3160003: Invalid table iterator error while trying to execute: cleos push action voting.debug debug '[ 0 ]' -p user@active I have a simple voting contract (full code) where I'm ...
3
votes
2answers
512 views

Purpose of multi_index scope

I am trying to understand what the purpose of the scope in multi_index is. Does it have performance/cost implications to put all the rows in the same scope and then just query using the keys? A ...
1
vote
1answer
209 views

How to set the “ —key-type” parameter and “--index” parameter of v1/chain/get_table_rows function?

how to set as the --key-type and --index parameters when i use the http api "v1/chain/get_table_rows" as cleos commend "cleos get table eosio eosio namebids --key-type i64 --index 2". the "--key-type"...
2
votes
1answer
110 views

Multi index can access data in contract but (RPC) cleos get table is empty

Here is the code I deployed it with the following command: cleos set contract . demo.wast demo.abi -p demo and query it with: cleos get table demo demo demos
0
votes
1answer
229 views

How should I get the data of the multi_index database?(about contract)

The return value of the action function can only be void type. I can't get data by return value. Now I have saved multiple objects in the multi_index database. I want to get them at once, what should ...
1
vote
1answer
570 views

How to access multi-index from other contract?

Contract A created a multi-index table pets like pets(_self, _self); ... pets.emplace(user1,...); Now in contract B, I would like to update a row like pets(N(A), N(A)); ... pets.modify(pet, user1, ....
2
votes
1answer
459 views

multi_index query [WHERE]

How do we query tables in EOS? Specifically like the WHERE clause in SQL Database? I see examples that uses iterator to find if the record exists, however I don't see it as the right approach ...
2
votes
2answers
1k views

HOWTO: auto increment primary key?

How do we do this in EOSIO multi_index table? Want to define a table with an auto increment primary key id.
0
votes
1answer
224 views

Is all Multi-index data stored in memory [duplicate]

I wanna know is all index data stored in memory?Is so, what if the BP suffer from ddos attack? and how to store data on disk?
1
vote
0answers
101 views

How do I see how many objects are in the multi_index table? [duplicate]

Is there a simple way to get how large the table is? like: table.size()
1
vote
1answer
196 views

How to understand RAM and log storage from the view of Smart Contract?

The knowledge on RAM and smart contract is obscure to me. In white paper, RAM is defined and I know now there're only 64GBs in total. However in developer manual https://developers.eos.io/ it never ...
2
votes
1answer
195 views

how to make public_key to be table index?

The contract in eos only support idx64, idx128, idx256 type for the secondary index, and key only support idx64, how can I set the public_key as the index? The public_key in is char[34], it's length ...
1
vote
1answer
740 views

Multiple parameters for search

I understand how to use primary and secondary keys for index. I want to search the primary key for all payments by a specific user. Then from that result set I want to search by a secondary key to see ...
9
votes
1answer
2k views

Delete all multi_index records without iterator?

I am running a multi_index in my contract and want to include an abi action that will clear it. Is there a clever way to delete all records? At the moment I am using something like this: //@abi ...
7
votes
1answer
121 views

Table key smaller than 64bit

Here is my some code. To reduce the data size, 'id', 'knight', and 'sale_id' are not uint64_t, even though they are keys. Because 'primary_key()', 'by_knight()' and 'by_saleid()' functions convert ...
1
vote
0answers
306 views

How do I add second and third indices to the multi_index object?

I have thoroughly read the documentation and isolated my problem down to a small set of sample code. I'm not sure where my problem is. I am trying to add multiple indices to a multi_index object so ...
9
votes
2answers
999 views

Is there a function to return the size of a multi_index table?

Is there a function to return the size of a multi_index table? If not is there a better way then looping through them? uint64_t count; for (auto itr = table.begin(); itr != table.end(); ++itr) { ...
0
votes
1answer
127 views

Can an arbitrary account add to a table (eosio::multi_index) belonging to a particular account?

I'm imagining elements in a queue that correspond to a particular class/struc format being added to a master list by an arbitrary account. Any easy way to create such a list via a contract? I'm also ...
3
votes
1answer
233 views

Can an action in a smart contract concurrently executed?

In a smart contract if an action is executed simultaneously and if it tries to modify the same record in a table(using multi index API), How to add mutual exclusion to the shared resources? For eg. ...
2
votes
1answer
552 views

How to allow duplicates in an eosio::multi_index object?

How do I create a struct and multi_index table that allow for duplicate records? For example, I have the below struct and multi_index table that is populated via an emplace call that selects a ...
4
votes
1answer
594 views

How to set “deep structures” for Smart Contracts Tables?

I have a table that I'm playing with that I want to have a map that links the id with a specific structure. I tried to use map and the code compiles fine, but when generating the abi file it takes ...
8
votes
1answer
773 views

How to use two secondary keys as a filter? (WHERE f1 AND f2)

In the contract multi index tables we can filter by the primary key or we can just create an indexed_by as an additional index. Then we have basically two options: filter by the primary key or ...
11
votes
1answer
729 views

What are naming rules for actions, tables and contracts?

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 ...
14
votes
3answers
730 views

Are Tables/DBs stored in RAM and held by multiple block producers?

We do have the Persistence API to store data for a smart contract in the EOSIO database. I was wondering where this database is located. I understood that it is patterned after Boost Multi-Index. 1) ...

1
2