Questions tagged [table]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
8 views

How to read external contract tables from my contract

I am searching for documentation, tutorial, classes... anything really that explains : How to read other contracts tables from within my smart contract. From what i have found, I need to declare the ...
0 votes
0 answers
8 views

How to get a table, not specified in SC ABI?

I know structure for one of the tables of smart-contract (including table name, scope, and coloumns). I can access it from my test smart-contract, of course. When trying to fetch via get_table_rows, I ...
  • 109
0 votes
0 answers
14 views

Tables not present on the IBA when using include

I create a simple contract with the following files: |-include |--game.hpp |--tables |---accounts.hpp |-src |--game.cpp And I add a table on the accounts.hpp #pragma once TABLE accounts { name ...
  • 51
0 votes
1 answer
133 views

Can't implement kv_table in smart contract

I'm trying to implement kv_table in my smart contract. Here is my sample code. #include <eosio/eosio.hpp> #include <eosio/system.hpp> #include <eosio/time.hpp> #include <string>...
  • 21
0 votes
1 answer
60 views

Index - Constructor for must explicitly initialize the member which does not have a default constructor

I try to create two tables and mult_index, I received an error on output. header file #include <eosio/eosio.hpp> #include <eosio/asset.hpp> using namespace eosio; CONTRACT game : public ...
1 vote
1 answer
167 views

Is it allowed to look up tables of another contract?

Imagine if I have an account with contract. Is it allowed for me to look up tables of some another contract from my contract action?
0 votes
1 answer
83 views

Traverse multi-index table through non-primary value and delete the record

Below is my smart contract: #include <eosio/eosio.hpp> #include <eosio/print.hpp> #include <eosio/system.hpp> #include <string> using namespace eosio; using std::string; ...
  • 307
0 votes
1 answer
148 views

Tables of a smart contract: public or private?

I was wondering about the ramifications of having tables declared public. Since EOSIO is a transparent blockchain anyone can read tables of any contract. So having them declared public in a smart ...
0 votes
1 answer
362 views

Set lower bound and upper bound to get table rows

I am using eos-sharp to get table rows in ASP.NET. By default in the table, I want to show the latest 10 records of the table. So I get them using: GetTableRowsResponse tabledata = await eos....
  • 307
0 votes
1 answer
76 views

Using a smart contract table. How can I query a row using another field instead of the primary key id?

How can I query a smart contract table to return a row instead of using the primary key id? I have the following: https://jungle.bloks.io/account/mybest111111?loadContract=true&tab=Tables&...
1 vote
1 answer
107 views

How to access data inside multi-index table when using 2D vector / 2D array?

What is going on? :D I write data, but cannot find it after I write it. The following code successfully emplaces the row into the multi-index table: See specifically the vector<vector <...
1 vote
1 answer
168 views

how to get tables rows count in plugin

auto chain_plug = app().find_plugin<chain_plugin>(); eosio::chain_apis::read_only::get_table_by_scope_params param{N("eosio.token"), N("stat"), "EOS", "EOS&...
1 vote
1 answer
39 views

Altering userres and delband tables after set_resource_limit(-1, -1, -1)

For a private network to remove ram net cpu i set the resource limit to unlimited for each newaccount created. By chaging set_resource_limits to set_resource_limits( newact, -1, -1, -1 ); //unlimited ...
0 votes
1 answer
48 views

Wrong table name in scope response

My contract has two tables mcat and mcatmig. Problem: scope request return wrong table name mcat........1 instead of mcatmig: % cleos get scope teresacode { "rows": [{ "code": "teresacode", "...
  • 125
1 vote
1 answer
119 views

cleos data getting inserted and deleted but table shows empty record

I have written one smart contract for insert, update and delete data. The smart contract is compiled and deployed to the two accounts. I insert data using calling the action upsert, this transaction ...
  • 307
0 votes
1 answer
131 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 ...
1 vote
0 answers
34 views

unordered map in eosio-cpp

I want to have an unordered_map inside a table so that I can have O(1) entry and retrieval. Can someone please link me to a snippet which implements that? I am new to cpp.
0 votes
1 answer
108 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 "...
  • 1
0 votes
1 answer
540 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
1 answer
78 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
1 answer
388 views

Can we store date on eosio table?

Is there any direct datatype in eosio to store date? and if not then how can we store dates in eosio table? void mainloan::paymentConfirm(uint64_t pay_id,uint64_t pay_date,double pay_amunt,name from ...
1 vote
0 answers
49 views

Which of the following is better for CRUD in a table?

I have two approaches to save data on blockchain, but I don't know which one is the best from time as well as space complexity perspectives. I want to store key value pairs in a table. First Approach:...
0 votes
1 answer
36 views

what are supported STL types in tables?

What are the supported STL types in tables? I'm specifically curious about std::pair
1 vote
0 answers
49 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 ...
  • 1,844
1 vote
1 answer
107 views

How to delete record on EOS if I forget table structure

I issue an EOS token for fun half a year ago and I'm planning to release my EOS ram recently. The problem is that I forget the table structure I made before and I overwrite the contract and there is ...
1 vote
1 answer
106 views

How to reclaim ram?

If a user is the authenticator when adding a row to a table, on chain, they supply the ram required to instantiate the new row. In the case of certain tokens, mainly airdropped tokens, the contract ...
4 votes
2 answers
838 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 ...
  • 41
0 votes
1 answer
49 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 ...
2 votes
1 answer
386 views

Why does using available_primary_key() as scope for a table result in this behaviour?

Scenario: Two tables, each using uint64_t as a primary key Table A rows need to reference rows in Table B Why? Relational database data duplication reasoning etc etc Both table's primary keys are ...
0 votes
3 answers
326 views

Smart contract - find on two columns

I am currently writing a blog PoC on EOS. I would like the ability to delete a post. Now deleting by the ID alone is simple, I have it implemented as follows: whisper::post_index posts(_code, _code....
  • 131
0 votes
2 answers
364 views

Erasing records with for loops

if I want to erase a table: orderbook b(_self, _self.value); auto m = b.get_index<name("idxprod")>(); for (auto &i : m) { m.erase(i); } I get the error: Error 3160005: The table ...
  • 515
4 votes
1 answer
345 views

How to sort a table?

I'm following this explanation https://developers.eos.io/eosio-cpp/v1.1.0/docs/multi-index-table-tutorial using v1.5.0 of the CDT. Here's what I've got: struct [[eosio::table]] order_struct { ...
  • 515
0 votes
1 answer
72 views

What is the most reliable way to sync contact account tables?

I have a contract account which has some tables. I want to watch for onchain table changes and sync them to an offline database as soon as possible. What is the most reliable way to do this? I have ...
1 vote
2 answers
54 views

Is there a way to check the histroy of a contract's table?

Is there a way to check the history after deleting the information in the table? For example, check yesterday's table information.
  • 23
0 votes
1 answer
323 views

Indexing a table by asset symbol -- how to find?

suppose I declare: struct [[eosio::table]] tst { asset component; uint64_t primary_key() const { return component.symbol.code().raw(); } }; where I mean to keep a list of assets. ...
  • 515
1 vote
0 answers
27 views

tables of eosio.token are not generated in abi file

I am using "server_version_string": "v1.2.3". And I am trying to compile and customize the eosio.token contract, but the tables are accounts and currency_stats table are not generated in abi file. How ...
0 votes
1 answer
262 views

Can we typecast string to use it as a id in table?

I need to use a string as a id of table in my smart contract. Initially i found some answers that string can't be use as primary key. But i use string as a key in table as given below: //@abi table ...
2 votes
1 answer
103 views

Multiple Inheritance within ABI files

I have various classes that use multiple inheritance, i.e.: class A { }; class B { }; class C : public A, public B { }; Single inheritance in an ABI file is possible using the base layer as ...
2 votes
1 answer
1k views

scope in the get table command

What is the meaning of scope argument in the get table command? For example, in the todo_contract, (https://developers.eos.io/eosio-cleos/reference#cleos-get-table) we have cleos --wallet-url http:...
1 vote
1 answer
215 views

Is it possible to have a secondary index as unique?

As per title, I'm using a key256 as a datatype for a secondary index on a multi-index table and want it to be unique. Can't find any documentation on it. TIA.
0 votes
1 answer
226 views

How can I create a table in an .hpp for a general contract? (Using the CDT)

THE STRUCTURE OF MY PROJECT I am working in mycontract.cpp, which imports myheader.hpp WHAT I WANT I want to create a table in myheader.hpp, for a generic contract, "IN THEORY" as follows: struct [...
2 votes
3 answers
1k views

How to properly use cleos get table with --key-type sha256 / secondary index (failing on 1.4.2)

I am not able to filter a hash correctly, using get table / get_table_rows. Also I noticed that the abi is not generating a secondary index, although I am assuming this is not the problem, since ...
1 vote
1 answer
56 views

Are table lookups, like get_table_rows, included in CPU/NET resource calculation?

If a smart contract includes user data, would our smart contract be charged CPU/NET resources to do lookups on those tables, or is it only charged for transfers and actions etc.
4 votes
1 answer
114 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 ...
  • 49
3 votes
2 answers
478 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
1 answer
423 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 ...
0 votes
1 answer
191 views

Contract Table Query Exception

As i was following eosio developers documentation #include <eosiolib/eosio.hpp> #include <eosiolib/print.hpp> using namespace eosio; using namespace std; class addressbook : public ...
  • 85
1 vote
1 answer
867 views

Assertion failure after updating a smart contract with tables

Before the update Before the update of the code of my c++ smart contract, this uses to work absolutely fine. Data storing on the table and actions execution were done successfully. After the update ...
1 vote
1 answer
74 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 ...
  • 137
1 vote
1 answer
48 views

Can we store documents in a table.If yes, Is this a right approach?

I want to store some documents in my smart contract that some users upload. Can I use table for storage? But second thing is table resides in RAM and this doesn't seems good to store data in Ram. Is ...