Stack Exchange Network

Stack Exchange network consists of 174 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
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

Anything related to decentralized application (dApp) development, concepts and possibilities with smart contracts, or technical questions for the development of smart contracts

3
votes
1answer
17 views

Ethereum Remix equivalent for EOS?

Is there an equivalent online IDE for EOS to write the smart contracts? https://remix.ethereum.org/
0
votes
1answer
17 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 ...
2
votes
1answer
41 views

Can I get the current RAM usage in contract?

I want to calculate the ram usage when I conduct an action in contract, if ram is over the limit, I will let the action fail automatically. How can I get the current ram usage in contract?
1
vote
1answer
24 views

How to search extra information which is attatched to a transaction?

For example, in one smart contact, a transaction is made, which contains some extra information, let's say the buyer's name. Once the transaction is committed, it is saved into one block. As you know,...
2
votes
1answer
31 views

Is “Smart Contract” supported by EOS ? Which Language?

What is the equivalent platform of Ethereum Smart Contract in EOS ? And by which programming languages we can develop a smart contract? Is there a specific language like Solidity in Ethereum? And is ...
1
vote
0answers
14 views

How to use the onerror event?

If a deferred transaction fails for whatever reason, it triggers an onerror event, which can be captured as follows: void apply_onerror(const onerror& error ) { print("What can I do with this?\...
2
votes
1answer
31 views

Addition overflow when doing delegatebw in contract

So I wanted to do delegatebw in my contract as a deferred transaction: eosio::transaction out; out.actions.emplace_back(eosio::permission_level{_self, N(active) }, N(eosio), N(delegatebw), std::...
1
vote
0answers
28 views

How to correctly use Docker to run eosio (including eosiocpp)?

I can get the basic quickstart working very easily but when I try to add smart contract I get a lot of conflicts. I have read an article here claiming - https://medium.com/@ekkis/eos-development-on-...
3
votes
1answer
59 views

How does EOS prevent one contract from accessing another contract's tables without authorization?

I noticed that multi-index (which is under eosio namespace) uses the following to prevent access to another contract's tables: eosio_assert( _code == current_receiver(), "cannot create objects in ...
5
votes
1answer
23 views

Is it possible for a smart contract to deploy another?

Is there a command for a smart contract to deploy another? As an example, is it possible to create a token factory, where users can select the name/total supply, and be given ownership of a new ...
3
votes
1answer
45 views

What's the difference between “time” and “time_point_sec”?

Seems that they are both datatype for storing number of seconds that have elapsed since 1970. So what's the difference between them, when should I use which? Edit: An example of the "time" datatype I'...
4
votes
1answer
47 views

How to convert asset to string in a contract?

How to convert asset to string in a contract? asset my_asset = asset(10000, S(4, EOS)); string my_asset_string = ??? //How to convert my_asset to a string "1.0000 EOS"?
3
votes
1answer
41 views

What's the relationship between eosio-abigen and eosiocpp?

I am running stable version v1.1.2 After running eosio_build.sh, there are one eosio-abigen executable which locate at /build/programs/ and another one is eosiocpp which locate at /build/tools ...
3
votes
1answer
47 views

eosio.contract cannot compile with error code 1 of eosio.wasmsdk by Clion

We are compile the eosio.contract v1.2.0 using Clion by following that: Dependencies: eosio v1.1.2 eosio.wasmsdk v1.1.0 Cannot get compiler information: Compiler exited with error code 1: /usr/...
6
votes
1answer
54 views

Is there a flaw in deciding who can pay for RAM?

Lets say I interact with an action from a smart contract, if I'm not careful and didn't read or couldn't understand the source code for the smart contract, is it not possible that the contract could ...
2
votes
1answer
48 views

Smart contract call - Error 3090004: Missing required authority

I'm getting this error: "Error 3090004: Missing required authority" when I try to call contract method. Jungle testnet is used. That is the method: //@abi action void add(account_name ...
4
votes
1answer
32 views

What are the worst cases if I allow my contract to call an evil action of an evil contract?

I am considering to allow my contract to call the transfer action of a user specified contract. I would like to know what are the worst cases that can happen with this design. My contract code will ...
3
votes
1answer
20 views

What is an overhead of a smart-contracts compiled to WebAssembly using different languages?

Let's say I'm going to write a simple smart-contract to be executed in wasm. Is there any inherit overhead by the language I will use? In particular I'm interested of overhead between following ...
3
votes
1answer
47 views

How can I generate an ABI out of a wasm?

Currently I've written a rust program to print "5" and converted the same into wasm using the the rust tool (target add wasm32-unknown-unknown). I want this wasm to be executed on the local blockchain ...
3
votes
1answer
45 views

What happens when wallet is kept unlocked on eos mainnet?

Lets say, for pushing a transaction I unlocked my wallet and pushed the transaction with the active permission by command line. So, while wallet is remained unlocked, can anyone who knows my account ...
0
votes
0answers
15 views

Action firing eosio_assert of another action

I'm not really familiar with leaks or overflows but I've been getting an intermittent bug in my smart contract on the Jungle testnet that is hard to pinpoint. An action, let's call it action A has ...
1
vote
0answers
21 views

Is it possible to call “updateauth” to change account keys from within a smart contract?

I am trying to write a smart contract that changes the keys of an account (not itself). The transaction will be of course be authorized by the account for which the keys are changing. I feel like it ...
3
votes
3answers
53 views

How does one prevent smart contracts from taking all your tokens, when you give them your auth?

Suppose you are a malicious smart contract developer and embedded an inline transaction in your smart contract that calls eosio.token::transfer 100 eos from the caller's account to your account. An ...
3
votes
1answer
50 views

Passing the parameters in actions vector of transaction struct

In the below code, I am passing parameters to actions struct which takes account_name, action_name, permission vector and arguments. But while sending the account_name using N it is taking the exact ...
0
votes
0answers
31 views

Using recover_key with eosjs

I want to validate user signatures in my smart contract. As I understood, I am supposed to do that with recover_key function from crypto.h I am using JavaScript with eosjs and eosjs-ecc for ...
1
vote
1answer
59 views

Set a contract containing deferred transaction from front-end

I am trying to figure out the way to set contract which has deferred transactions at run time from front-end. Is it even doable? Any suggestions would be appreciated.
4
votes
1answer
83 views

How to get transaction logs from EOS?

Suppose I have a dapp that monitors transaction of some assets. The smart contract would be generating transactions and I'd get messages like "executed transaction: ...
3
votes
3answers
216 views

Can not find <eosiolib/eosio.hpp> when compiling with eosiocpp #2

I'm trying to compile any smart contract. Let's say the skeleton one. When running eosiocpp -o it can't find the header file for eosio. Not a duplicate of Can not find <eosiolib/eosio.hpp> when ...
0
votes
0answers
35 views

Is it possible to compile a smart contract using g++ or clang?

I want to write and execute some unit tests on a smart contract outside of nodeos, but to do that I need to be able to compile the code the normal C++ way, using g++ or clang, so that I get object or ...
1
vote
2answers
73 views

How to specify a `uint128_t` literal in the code?

I'm trying to store really large value to a table in field uint128_t, but I get this "integer literal is too large to be represented in any integer type" error when trying to compile. When i ...
1
vote
1answer
51 views

CPU Time difference between eosflare and EOS Resource Planner

i would like know why these two sites shwo different CPU Time i have/(could have) with my Account. Example: 1000 EOS on EOS Resource Planner => 45 s/day 1000 EOS on eosflare => 14,4 s/day (scaled) ...
2
votes
1answer
47 views

Is it possible to set permission of the current account in a contract?

I thought this might solve a trust problem. I have considered the Dice example in the tutorial. If I'm the host (Dice) and I have the owner and active permission, then I'm able to transfer all of ...
0
votes
0answers
59 views

Convert string to float or double

I am trying to convert a string to a float or double, however none of the standard C/C++ methods seem to work. I have tried: atof strtof strtod sscanf In each case, I get an error message when ...
0
votes
1answer
76 views

use EOS as private blockchain for a loyalty system

We are working on a loyalty system powered by blockchain. Using blockchain enables us to have basic security at the beginning and scale easily. it makes total sense to us. the loyalty system will ...
1
vote
1answer
31 views

Split Smart Contracts or not?

Is it computationally more heavy to put all functions into one smart contract, even though you only call one function at a time? Or is it better to split all functions into individual smart contracts?
1
vote
1answer
70 views

How to get accounts info in smart contract

How can I get accounts info in a smart contract? Or if given a public key and account_name, is there any way can verify that account has this public key in a certain permission?
1
vote
1answer
24 views

Smart contract constructor called every time action is called?

i created smart contract and i created contructor like this: public: TestContract(account_name self): contract(self) { method1(); method2(); print("...
1
vote
1answer
60 views

How to call action of another contract within a contract?

If I'm right then to call the event of another contract, I need to configure the permissions (allow the call). For example, I have contract aliceclass: class aliceclass : public contract { public: ...
0
votes
2answers
74 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 ...
0
votes
2answers
50 views

How to update contract that has already been published to nodeos?

I published a contract to my localnet using: cleos set contract myaccount mycontractfolder -p myaccount Then I made some updates to the code, and want to publish them, I type the same command again, ...
1
vote
1answer
32 views

Can you create a smart contract with a smart contract?

I know that you can create a new account but I am not sure if this can be done
3
votes
2answers
24 views

Commented owner/active parameters in the newaccount smart contract

In contracts/eosio.system/eosio.system.cpp, the following function has the owner and active authority parameters commented: void native::newaccount( account_name creator, ...
1
vote
1answer
34 views

Tables and storage issues

I need some help clarifying some conceptual problems. Am i right to say that the data stored in a contract are stored as tables and that for every row, we would have to emplace that row to a user, who ...
0
votes
2answers
38 views

print in contract not showing output in eosjs docker

i want to print some logs in eosjs docker version. But somehow it is not showing anything. I have set: # print contract's output to console (eosio::chain_plugin) contracts-console = true in the ...
0
votes
1answer
52 views

Is it possible to create new account in SmartContract?

we can create new account using cleos . cleos system newaccount <myacount> <newaccount> <new EOS Public key> <new EOS Public key> --stake-net "0.1 EOS" --stake-cpu "0.1 EOS" -...
2
votes
1answer
43 views

Can a smart contract bill the RAM storage to another smart contract?

I know that you can bill another user for storage but what if i want to bill another smart contract which in turn will then bill its users. Is it possible?
2
votes
2answers
55 views

How to check balance of dynamically determined token contract?

If I am using eosio.token as my token contract (or I know my token contract during compile time), the following code will work. accounts accountstable(N(eosio.token), account); auto itr_a = ...
0
votes
1answer
47 views

Error 30700002: Smart contract's apply function not exported; non-existent; or wrong type

I have written a smart contract and I want to start testing it, it contains an apply function, which currently checks for a transfer, and then calls the appropriate function: void mycontract::apply(...
0
votes
2answers
252 views

Require inline action be sent by contract, and not account

I have contractB trigger an inline action: /// @abi action void send() { action( permission_level{ _self, N(active) }, N(contractA), N(get), std::make_tuple( _self ) ...
1
vote
0answers
22 views

Is it possible to use multi_index on property of a struct in a struct?

can i use the id of a struct in an other struct as return value for multi_index? like: //@abi table test i64 struct st_test{ uint64_t id; string name; uint64_t primary_key() const {return ...