All Questions
Tagged with contract or smart-contract
618 questions
0
votes
1
answer
168
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
71
views
How much RAM does a smart contract consume?
I have a smart contract compiled resulting in a 10,961 Bytes wasm file and a 2,372 Bytes abi file. However, when deploying the contract on chain it consumes about 110,000 Bytes which is almost 10x the ...
0
votes
1
answer
75
views
Compiling smart contract not getting done
I have a setup of multi-node of 4 peers blockchain. Blockchain is running, few days before I deployed the smart contract and using it to save data on the blockchain. Now, I did some changes to the ...
0
votes
1
answer
83
views
Issues regarding the update of a staking contract
Suppose that we need a token staking mechanism (similar to the stake and lock function introduced in the EOSIO training). Someone owns that contract. Now the question is:
How would the rest of the ...
0
votes
1
answer
90
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&...
0
votes
1
answer
111
views
How do I record LOG in eosio smart contract?
I deployed and tested eosio smart contract. I want to record the logs of a smart contract using the web API. How can I do this? I searched but didn't get any satisfying answer. I tried to get logs by ...
1
vote
3
answers
158
views
on_notify does not get triggered
I am using a very simple example:
mycontract.hpp:
[[eosio::on_notify("eosio.token::transfer")]]
void depos(name from, name to, asset quantity, string memo);
mycontract.cpp:
[[eosio::...
0
votes
2
answers
826
views
Why is [[eosio::on_notify("eosio.token::transfer")]] not working?
Network: kylin testnet.
I transferred eos to this contract, but it the "deposit" function was not called. What do I miss?
2
votes
3
answers
2k
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.
3
votes
1
answer
381
views
Sending transaction with Scatter from a single-page application
Request for help:
I need a simple example of sending transaction (pushing a contract action test) by Scatter written in plain JS for a single-page browser scrip without any requirjs , vue , angularjs ...
3
votes
1
answer
392
views
Getting account CPU usage in smart contract
Is it possible to access the CPU usage of a given account from within a smart contract?
For eg. in a smart contract transfer notification, you call get_account_info(N(some_account_name)) which ...
1
vote
0
answers
27
views
getting error when i try to add permission to a user who is signing a smart contract action
here is what i am trying to do :
users will sign a specific action which will take their username, permission_name, smart_contract_name, action_name, public_key
i am trying to assign the user ...
1
vote
0
answers
33
views
How can i update a table by TransactionID? And can transactionId be the same when we update the data?
I am running my nodeos on my local machine, I can retrieve all the data via api and do some CRUD also. I have succeeded update the table by tableId,
But can someone suggest to me how do I update the ...
1
vote
1
answer
124
views
nested stuff inside index_table
I'm trying to build a small hearthstone like game and I've finished up the front-end for the game client. I created a NoSQL mockup of the user data and now it's time to move those to the index_table ...
0
votes
1
answer
328
views
Convert type string to type checksum256
fist off let me get this strait, yes I know the dangers of memo parsing, yes I am aware of the vulnerabilities that can be created from doing such a process, so please there is no need to lecture me ...
4
votes
1
answer
71
views
Trying to execute a smartcontract action using a multisig account, but it shows executed even when the transc fails due to smartcontract constraints
I'm proposing a transaction to execute an action of some smartcontract, the transaction is showing executed irrespective of failure or success of the smartcontract action(say transferFunds), this is ...
1
vote
1
answer
47
views
How to get table data from Jungle testnetwork?
I am trying to get all the insert data using get table on jungle testnet. But I was failed and get only an empty row value.
command:
cleos --url https://jungle3.cryptolions.io:443 get table ...
1
vote
0
answers
21
views
How to set a eos contract on jungle network [duplicate]
As I trying to deploy a contract on Eos Jungle test network using cmd. But I failed to run.
Command :
cleos --url https://jungle3.cryptolions.io:443 set contract tulsipadalia addressbook -p ...
2
votes
1
answer
39
views
cleos push action is not working on multihost peer node
I have a setup of multinode, one genesis node and another host node inita connected to the genesis node. Nodeos is running on both hosts. Genesis node is producing blocks and inita is receiving them. ...
1
vote
2
answers
116
views
EOSIO Tutorial : publishing contract error
I'm working on EOSIO tutorial
and now I'm workingon https://developers.eos.io/eosio-home/docs/data-persistence part.
Right now, I'm stuck on deploying contract.
jongbok@DESKTOP-96ICBPJ:~/eos/...
1
vote
0
answers
47
views
Where are accounts and smart contracts stored?
I'm a bit confused by answers to the following questions:
Where are new accounts stored?
Where is the smart contract is stored
How can everything be stored on RAM at all time? 3KB for each user means ...
3
votes
1
answer
243
views
Returning values from actions
I am trying to return a value from an action as follows:
[[eosio::action("test2")]] int test2(int x)
{
return x;
}
The code compiles correctly, and the ABI file shows the correct action ...
3
votes
1
answer
77
views
How to pass specific eosio-cpp/eosio-ld options via cmake
I'm typically using CMake to compile my contracts, like described here.
How can I pass specific eosio-cpp/eosio-ld options (specifically -stack-size) described here?
1
vote
1
answer
79
views
Difference between _self and get_Authorization and RAM optimization
I have build a Smart Contract with 14-15 Tables for I/O.
It will be used to store important data of our platform.
I have used require_auth(_self) as this contract will not be used by 3rd person.
It ...
2
votes
1
answer
68
views
how to find greatest common divisor inside smart contract?
I need the greatest common divisor between two numbers in the smart contract. I tried:
int gcd = __gcd(num1, num2);
num1 and num2 are two numbers. When the smart contract is compiled, its generating ...
1
vote
1
answer
67
views
Is it possible to get the initiating contract name from a token transfer?
When an external account transfers tokens to my account (which has a contract with an "on_notify" action for incoming transfers), is there any way I can get the name of the contract that ...
0
votes
2
answers
682
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() ...
2
votes
3
answers
314
views
Can I use uint256_t in EOS smart contracts?
I want to use uint256_t in my EOS smart contract but I am getting following error
unknown type name 'uint256_t'; did you mean 'uint16_t'?
I thought EOS supports uint256_t as I read it in some EOS ...
0
votes
1
answer
81
views
What does 'datastream<const char*>' mean in this code?
From this tutorial
addressbook(name receiver, name code, datastream<const char*> ds):
contract(receiver, code, ds)
I'm not familiar with 'datastream' and Googling isn't turning up any precise ...
1
vote
1
answer
27
views
Does the size of a contract affect CPU consumption
Does the size of a contract increase CPU consumption in general?
To my knowledge, there may be several secondary factors that slow down the processing of transactions.
For example, a memcpy command ...
0
votes
1
answer
148
views
Calling external action with 'action_wrapper' and 'action'
In contract we have two way to call another action:
Use 'action'
action(permission_level{get_self(), eosio::name{"active"}},
eosio::name{"eosio"},
...
1
vote
1
answer
180
views
If I issue an EOS token, how do I afford the running fee?
I got a question about how to afford the cost of emplace action...
code in eosio.token like :
statstable.emplace( _self, [&]( auto& s ) {
s.supply.symbol = maximum_supply.symbol;
...
-1
votes
1
answer
76
views
What's the max speed of EOSIO contract?
I try to do performance testing about EOS contract. I built private EOS network with 6 nodes.
I use apache bench to formulate http requests, and post to EOS service http://127.0.0.1:8888/v1/chain/...
3
votes
3
answers
1k
views
How to store contract state as singleton?
What is the best way to store fields specific for contract, for example if contract has 3 fields (2 strings, 1 uint64_t) and they can be changed?
Should I create new table for this, it would always be ...
1
vote
0
answers
9
views
is there a service that creates EOS or TRX div tokens?
is there a service that creates EOS or TRX div tokens? Or can someone point me in the right direction?
Thank you
0
votes
3
answers
338
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
1
answer
55
views
EOSlime TypeError: Contract.actionname is not a function
This is my test file:
const assert = require('assert');
const TOKEN_WASM_PATH = './contracts/group/group.wasm';
const TOKEN_ABI_PATH = './contracts/group/group.abi';
describe("EOSIO Group", ...
1
vote
3
answers
238
views
How does Jungle testnet create new account?
I have created new account in https://monitor.jungletestnet.io .
I have a copy of the log
# eosio <= eosio::newaccount {"creator":"junglefaucet","name":"myaccount","owner":{"threshold":1,"keys":[{...
0
votes
1
answer
54
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
1
answer
51
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",
"...
0
votes
2
answers
197
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
0
answers
111
views
How to generate unique string id from given array of strings in smart contract?
I am writing an EOS smart contract in which need to write the action to generate a unique id from the given array. Array consisting of n number of string elements (UUID). Suppose I pass 10 strings to ...
0
votes
0
answers
112
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
1
answer
322
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
1
answer
128
views
How to check authorization for a particular account in EOS smart contract?
I want to write an EOS smart contract to manage users data. I need that only some admin account will able to add, update and delete users and the particular user can only update data. Can I check ...
0
votes
1
answer
78
views
Complex smart contract for rule based auction in multiple currencies
The imagined application allows users to participate in an auction and make bids in cryptocurrencies. There are several behavioral rules that control the execution of the auction and determine the ...
0
votes
1
answer
39
views
Take output from GetActions and send to database using eossharp
I am using eos-sharp to get data from the eos smart contract. I am trying to get actions data by using:
var resultaction = await eos.GetActions("dqzmember", 0, 30);
I need information from ...
0
votes
1
answer
104
views
how to save data in mongodb from eos smart contract?
I am getting the actions log data using an action constructor in a smart contract. I need to save this data in MongoDB from the smart contract. How can I do this? I didn't get exactly my required ...
1
vote
1
answer
133
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 ...
0
votes
1
answer
31
views
How to access and manipulate tables when using native unit tests?
I am trying to write unit tests for functions in a smart contract that require access to tables within the smart contract. I tried to set this up using the hello_test.cpp code as a base and when I get ...