Questions tagged [smart-contract]

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

Filter by
Sorted by
Tagged with
5
votes
1answer
49 views

What's the difference between register() and claimAll()?

I'm using MyEtherWallet to register/map the EOS key. The steps suggests to use register() function, however in another tutorial I've seen it's using claimAll() function. So, I'd like to know the ...
5
votes
1answer
55 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 ...
5
votes
1answer
286 views

How eos prevent contract upgrade for evil?

Can the publisher do evil with upgrading the smart contract? In eos, the smart contract is controlled by an account.
5
votes
3answers
747 views

How can I get my contract currency balance with c++ code?

I want to get my contract currency balance within my contract code, but the eosio::account::get (account_balance &acnt) cann't use, so how can I do that?
5
votes
2answers
510 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
2answers
397 views

Error 3090003 when calling a contract from another contract

I have deployed contracts hello and callhello, where callhello makes a call to hello, which in turn prints an output. However, i'm not getting the result I'm hoping for cleos push action callhello ...
5
votes
2answers
856 views

Can someone explain EOS sidechains to me?

Independent platform, Main chain, sidechains, smart contracts. Can someone define these terms for me? I don't quite understand the idea of sidechains. Is sidechains something like threads in ...
5
votes
1answer
186 views

eosio multisig exec problem

For multisig transaction, 1. Firstly I have created two accounts(partner1 and partner2) with same key(EOS....HoCF) cleos create account eosio partner1 EOS8FE********HoCF cleos create account ...
5
votes
3answers
483 views

How do you inherit an eosio contract?

I am trying to inherit the 'eosio.token' contract found in '/eos/contracts/eosio.token/' into my new class 'my.token' My CMakeLists.txt looks like file(GLOB ABI_FILES "*.abi") configure_file("${...
5
votes
1answer
83 views

How can you make sure you know what the contract does when you send an action?

Say you want to send an action to a smart contract, and you know the WASM of the contract. You somehow obtained the original source code which was in C++, you compiled it to WASM, and you got the same ...
5
votes
1answer
107 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 ...
5
votes
1answer
238 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/...
5
votes
2answers
629 views

How to set up chain of permission levels for a user?

This is a great answer that describes the ways you can handle user permission levels for inline actions. According to that answer: This can be done a few ways (ordered from most risky for the user ...
5
votes
2answers
222 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/...
5
votes
0answers
99 views

Releasing your RAM, not caring for pre-existing records [duplicate]

Say if, I push an action to an existing contract on the EOS main net. This action creates a record in a table/multi index container with me as the payer in the emplace method. No other action ...
4
votes
2answers
2k 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 ) ...
4
votes
2answers
996 views

How to get current time in different versions of EOSIO

Depending on which version of EOSIO you use, there are different options available for finding the current time. What are they?
4
votes
2answers
682 views

Accessing current transaction ID within a smart contract

Is it possible to access the current transaction ID from within a smart contract?
4
votes
3answers
589 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 ...
4
votes
2answers
563 views

Tables are not generated in abi file

I have the contract class test : public contract { public: using contract::contract; test(account_name self) : contract(self) {} ... private: struct test_rec { test_hash ...
4
votes
1answer
340 views

How do I use big ints in eos?

Is there a library that will let me store big ints and then perform arithmetic on them in eos smart contracts? I was trying to use the multiprecision library in boost but kept on getting an error: ...
4
votes
2answers
280 views

Is it advisable to use global variable in smart contract?

I know we can use global variable in our smart contract. So, How can I make sure that nobody can access my global variable.
4
votes
1answer
164 views

What are the differences between eosiocpp and g++

I am using time functions within my smart contracts and I'm seeing differences between eosiocpp and g++. The below compiles and executes with no problem using g++. time_t rawtime; tm * timeinfo; ...
4
votes
2answers
270 views

Is there a sample code of how to link EOS with IPFS for data storage?

Let's say I am making a todo list smart contract or do I even need a smart contract for this? I want to be able to store the todo list items on IPFS storage file. Is there an example of how this can ...
4
votes
1answer
142 views

How RAM was allocated in dapp and how to optimize the table?

We are doing dapp development on EOS. And it seems cost more ram than we evaluated. How much ram will be used when stored a table record? And how to optimize the table structure to save the ram? See ...
4
votes
1answer
640 views

“dice” contract “withdraw” action problem

I wonder if anyone experienced a similar problem and managed to resolve it. I'm testing the "dice" contract on my local tesnet. I've setup up all necessary contracts and could deposit assets to the "...
4
votes
1answer
310 views

What could be the reason for 'Error 3050008: Abort Called'

I'm getting the following error without any further description. What could be the issue for that? I'm performing some binary arithmetics when calling this action, are there any known problems with ...
4
votes
1answer
94 views

How to check (within a smart contract) if an account has an associated smart contract?

Is it possible to check if an account has a smart contract, from within a smart contract?
4
votes
2answers
131 views

EOS smart contracts and big data

Imagine situation when I need to save a big data In smart contract (for example 1000 000 000 row of information - or just 1 TB). In case of ETH it's almost impossible because gas price goes to hell. ...
4
votes
3answers
173 views

How can a contract obtain and process variable data from the outside world?

Suppose I have a contract which depends on the current price of a real-world asset (like the price of gold). How would the contract obtain that price? How would I ensure that every time the contract ...
4
votes
2answers
149 views

Require authorization with conditions require_auth(name1 OR name2)

Is there any possibility to implement conditional require_auth(<condition>) or what is a good practice to make contract accept invocations from a set of predetermined accounts? Is there any ...
4
votes
2answers
961 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: ...
4
votes
2answers
443 views

Custom struct abi serialization

I am trying to understand, how the string "100000000.000 SYS" is serialized into struct asset from eosio.token example ( cleos push action eosio.token create '[ "eosio", "1000000000.0000 SYS", 0, 0, 0]...
4
votes
1answer
99 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 ...
4
votes
1answer
404 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?\...
4
votes
1answer
813 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?
4
votes
1answer
51 views

Creating a base contract with (virtual?) base methods that can be overriden

is there a possibility to create a base contract with methods that can be overridden in contracts that inherits from it? Cheers
4
votes
1answer
692 views

How can I create a custom permission within a contract and limit it to certain actions?

For example, say I wanted to create a custom permission called delegatee. An account with this permission would be only permitted to preform certain actions within my contract. Is this possible as of ...
4
votes
1answer
614 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 ...
4
votes
1answer
60 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 ...
4
votes
1answer
258 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 { ...
4
votes
1answer
369 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 ...
3
votes
3answers
954 views

`env.is_feature_activated` error when set contract

I'm trying to set up my eos enviroment. When I post the system contracts I get this error msg: Error 3070000: WASM Exception Error Details: env.is_feature_activated unresolveable enviroment: ubuntu ...
3
votes
6answers
603 views

eosiocpp -g generates empty abi file

I have created smart contract inside the /build/contracts and running this comman generates empty abi file. eosiocpp -g eosio.test.abi eosio.test.cpp tried both hpp and cpp but same result.
3
votes
2answers
1k views

get token balance from another contract

How do we accomplish this on EOSIO? In Ethereum we get the reference of another contract using the contract address, what about for EOSIO? Can anyone provide a sample code for this? Would like to ...
3
votes
5answers
713 views

Cryptographic Operations in Smart Contracts?

Is it possible to perform cryptographic operations inside a smart contract? I'm specifically thinking about simple hashing (SHA-1/256/3) and symmetric encryption (AES). Obviously, handling key ...
3
votes
1answer
571 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 ...
3
votes
1answer
250 views

Who will get the ram back when delete records?

In EOS, when create a table record, someone will pay the ram, and when modify the record, maybe someone else will pay the ram, and when delete the record, who will get the ram back? the creator or the ...
3
votes
2answers
409 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?
3
votes
1answer
254 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. ...

1
2
3 4 5
12