Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [table]

The tag has no usage guidance.

1
vote
1answer
27 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
1answer
33 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 ...
1
vote
0answers
38 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 ...
0
votes
1answer
23 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
0answers
27 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
1answer
21 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....
0
votes
1answer
60 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 ...
4
votes
1answer
73 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 { ...
0
votes
1answer
30 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
2answers
24 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.
0
votes
1answer
72 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. ...
0
votes
0answers
15 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
1answer
33 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
1answer
38 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 ...
1
vote
1answer
383 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
1answer
55 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
1answer
93 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 [...
1
vote
3answers
519 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
1answer
40 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
1answer
84 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 ...
3
votes
2answers
162 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
232 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
1answer
119 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 ...
1
vote
1answer
314 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
1answer
55 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 ...
1
vote
1answer
41 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 ...
5
votes
2answers
131 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/...
2
votes
2answers
110 views

ignore //abi table comment

I have general header, which I wanna include in different contracts: ent.h: //@abi table entities i64 struct entity { entity() {}; uint64_t id; uint64_t primary_key() const { return ...
2
votes
2answers
287 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 ...
7
votes
1answer
426 views

Can we add the permission to access the table?

I know how to declare ,initialize and get,set values in a table .My question is Can we add permission to access the table to a particular user inside our smart contract ?
1
vote
1answer
289 views

How to list all tables I have on main-net account, and how do I see the table keys?

I am struggling with listing all tables that exist on my account, as well as listing all the keys that I got in each table. What would be the cleos command ? Should I need to publish a contract, ...
0
votes
1answer
108 views

How to retrieve historical EOS supply?

I know $ cleos get currency stats eosio.token EOS reports the current supply in the blockchain, but how can I get the supply through time?
2
votes
1answer
383 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
731 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.
1
vote
0answers
96 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()
2
votes
1answer
1k views

Get table rows HTTP API in JSON

When I try to get table using curl --request POST \ --url http://bp.cryptolions.io:8888/v1/chain/...
9
votes
1answer
1k 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
112 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
2answers
406 views

One-to-many relationship in Multi Index Tables

Is there a method for storing one-to-many relationships within a table? Say I had a Player, and the player had multiple Tickets. How could I store multiple ticket primary keys within one player?
2
votes
1answer
1k views

EOSjs getTableRows lower and upper bound on account name

How can I pass an account name as the lower and upper bound in the getTableRows method? I've looked at types.hpp and saw the string_to_name method, is there a similar method in EOSjs?
8
votes
0answers
100 views

How do you properly change/add to the struct that is stored in a table as part of a contract upgrade? [duplicate]

Does this even work? Seems like I've broken my tables doing this but I have changed my contract pretty significantly. I'd imagine that someone may want to add a new "column" (member) to their "...
3
votes
1answer
2k views

Reading table rows with EOSJS

Is there a way to receive the return output of an action with EOSJS? Say for example I have an action that reads columns from a table, sums a row and returns the result. How would I structure the ...
5
votes
2answers
321 views

Is it possible to get the creation timestamp of a record of a Smart Contract Table?

Usually in centralized apps we have the fields created_at and created_by to know when and who created this record and also sometimes modified_at and modified_by to register who and when was the last ...
5
votes
3answers
927 views

When to use or not use the Contract Scope?

Analyzing the eosio.token contract we see that the token stats is stored under the SYM scope. So if I want to read a token stat, like supply, I need to execute: cleos get table eosio.token EOS stats ...
7
votes
1answer
332 views

How do you define who pays and who stores on your Smart Contract tables?

Sometimes I find myself lost deciding how I will store data for my application. I have a dilemma about: Decentralization vs Accessibility for everybody? Looking to this table, which manage DAOs: // ...
4
votes
1answer
412 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
526 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 ...
14
votes
1answer
2k views

How to read tables from other smart contracts?

I tried to look for inside the EOS repository and contracts examples but I could not find anything like this. I want to know how can I read another contract table. So, as an example: my contract ...
11
votes
1answer
424 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 ...