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
3
votes
1answer
189 views

How can I send information to an account without transferring EOS?

When I use bloks.io or eosflare.io, I see that I have some contracts leaving information in my account without it being part of a memo from a transfer. How is it possible to send messages in this way?
3
votes
1answer
285 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 ...
3
votes
2answers
105 views

Is is possible to defer a non abi action using a abi action?

I know we can defer a action in EOS, I invoke a non-abi action from an abi action like this: eosio::transaction txn{}; txn.actions.emplace_back( eosio::permission_level(owner, N(active)), N(...
3
votes
1answer
205 views

Ethereum Remix equivalent for EOS?

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

Getting an unknown key error while transfer some EOS form one account to another

I have written an action transfer in my contract which is as below // @abi action void second::transfer( account_name from, account_name to, asset ...
3
votes
1answer
56 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
361 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
617 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
1answer
328 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("...
3
votes
2answers
1k 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: ...
3
votes
1answer
225 views

Why is action 'eosio::setcode' on the action blacklist in the mainnet?

Error 3130005: Action to execute is on the blacklist Error Details: action 'eosio::setcode' is on the action blacklist pending console output: in mainnet Why is this?
3
votes
2answers
320 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 = ...
3
votes
1answer
54 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 ...
3
votes
1answer
332 views

How do I listen to the actions contained in a transaction to my smart contract?

For example, if Alice sends a transfer from the eosio.token contract to my smart contract, how do I listen to see if she has actually sent me a transfer from the eosio.token contract and get the data ...
3
votes
1answer
677 views

Can not unpack data from received eosio.token::transfer action

v1.0.6 I am trying to make my contract react to the token transfer. The code compiles fine, but I get the error when I do >cleos set contract accountsale . accountsale.wast accountsale.abi ...
3
votes
1answer
135 views

Can we upload contracts to testnet or mainnet without being fully synced?

From an enterprise developer's POV I'm hoping the blockchain will one day be as easy to query, and write contracts for as it is for me to connect to a db through a database ide such as SSMS (SQL ...
3
votes
2answers
704 views

How to take snapshot of EOS blockchain?

How can I take a snapshot of EOS blockchain up to a particular block? Is the snapshot helpful to get EOS balance in each account? Any help will be appreciated.
3
votes
1answer
90 views

What exactly happens when an Airdrop occurs?

From my understanding of an Airdrop, it is a distribution method for a certain token based on stake holding of another currency (EOS in this case). On a more technical perspective, what exactly ...
3
votes
2answers
88 views

eosiocpp tool generates different types

If you look into every ABI file in the contract folder you will find: { "version": "eosio::abi/1.0", "types": [{ "new_type_name": "account_name", "type": "name" }], ... } when I am ...
3
votes
1answer
370 views

Contract A makes an inline call to contract B. How can B determine that A is the one making the call?

Contract A calls an inline action on contract B via INLINE_ACTION_SENDER(...). How can contract B determine that it is being called by contract A?
3
votes
1answer
670 views

Can actions have return types?

I've been looking at most of the example contracts and every action seems to return void. Does this mean that you can not have a return type for your actions? Instead, would you have to send a ...
3
votes
1answer
250 views

How can I call third party APIs from inside a smart contract at a set time or interval?

In a scenario where a smart contract needs to check against a third party service (Let's say an API with weather information from a trusted source like Weather.com) and make a decision on moving ...
3
votes
1answer
53 views

When would the branch "native-contract-debugging" be merged to the master?

I've gotten a message that there would be a better method to debug a custom contract from Telegram. This would be implemented in the branch "native-contract-debugging" which would be merged to the ...
3
votes
1answer
55 views

Where is the smart contract is stored

I would like to know where the smart contract is stored after the copilation and deployment. Thanks
3
votes
1answer
247 views

Deploy Contract from browser using eosjs

so I would like to deploy an EOS contract using eosjs. I encountered several problems (especially with converting the .abi and .wasm files). All the examples either use node (so fs is available) or an ...
3
votes
1answer
250 views

What is the reason for appearance of "misaligned reference"?

I have written a big contract with a lot of template functions and can find a place, which causes 2018-11-19T08:14:11.454 thread-0 binaryen.hpp:608 translate_one ] misaligned ...
3
votes
1answer
528 views

How to authorize inline action of another contract within a contract?

I deployed a contract omes.user. In the reguser(account_name user) action of contract omes.user I want to send an inline action to another contract eosio.token to issue some tokens to user. Here is ...
3
votes
1answer
164 views

Execute get_supply function within contract

I want to execute get_supply from currency.hpp. Here is the definition: asset get_supply( symbol_name symbol )const { accounts t( _contract, symbol ); return t.get(symbol).balance; ...
3
votes
2answers
80 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, ...
2
votes
3answers
1k 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.
2
votes
1answer
298 views

How the persistent database is saved on the blockchain

I know that the eos blockchain saves the transactions generated data in a persistent database. It has methods to insert, modify and erase data. As the blockchain is supposed to be immutable, does the ...
2
votes
1answer
1k 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 ...
2
votes
3answers
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 ...
2
votes
2answers
595 views

what's the difference between receiver and action in eos contract?

void apply( uint64_t receiver, uint64_t code, uint64_t action ) What's the difference between receiver and action in eos contract?
2
votes
1answer
154 views

Are EOS smart contract self executing? Can a contract monitor an external API call from a weather site and send a transaction if it's sunny?

Ethereum contracts require someone to execute the contract and are not self aware. Are EOS contracts self executing if some external thing happens like the weather changing when detected from a ...
2
votes
1answer
199 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
83 views

Is it possible to create new contract from another?

Ethereum has a opportunity to create new contract from another. Does eosio has the same? I found a code with new account creation, but I didn't find nothing about setting code and abi from contract.
2
votes
2answers
117 views

How to avoid cpu usage limits

Task Compute some fields for all table rows when action called contract::priceupdate(price) Input data: Table with 10000 rows Problem Cpu limit 30ms so i cant update whole table in 1 transaction ...
2
votes
1answer
280 views

Why is try block disabled for EOSIO smart contract

Why can't we use a try block inside a eosio smart contract? This is the error I get when I try to catch the exeption from eosio::require_auth2() function... error: cannot use 'try' with ...
2
votes
1answer
190 views

Can I stake back my bandwidth without cost?

Say I have staked enough eos for 10mb of bandwidth. When I run out of bandwidth, can I unstake and stake back as soon as possible to get 10mb more of bandwidth without any cost?
2
votes
2answers
132 views

Set source file properties called with incorrect number of arguments

When attempting to compile a new contract, I am getting this error. I'm using eosio version 2.1 for this. CMake Error at /home/michael/eosio.cdt/build/lib/cmake/eosio.cdt/EosioCDTMacros.cmake:18 (...
2
votes
1answer
29 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 ...
2
votes
1answer
264 views

How can i burn the tokens i create with eosio.token

I want to burn the tokens i created for some reasons, I found the method "retire" in eosio.token. But, this method only change the supply of the token, the maximum supply is still the same as it is ...
2
votes
2answers
561 views

Make a transfer inline

I would like to send SYS token owned by the smart contract account to a third party account when anyone call a specific action. I have tried the following code but I am getting an error: [[eosio::...
2
votes
1answer
76 views

static_assert failed "Types with user specified constructors (non-aggregate initializable types) are not supported

I am writing a smart contract for use with the EOSIO system contract, and am receiving this error message multiple times when I try to compile the code. I have checked my constructors and they are ...
2
votes
1answer
126 views

How to send a data from on contract to other?

https://developers.eos.io/eosio-home/docs/sending-an-inline-transaction-to-external-contract In above tutorial, I can see that 'addressbook' send notofication message to 'abcounter', but the data(...
2
votes
3answers
335 views

Need to perform automatic smart contract function execution

Can we have a function in a smart contract to be executed automatically after some time? for example, transfer some tokens after every 5 seconds.
2
votes
1answer
610 views

How can I convert a uint128_t to a string?

I am using a uint128_t as an id type for a contract I am working on. For a certain check, I need to convert this variable to a string so I can check for it in another table (whose type cannot be ...
2
votes
2answers
705 views

Unable to compile eosio.token

I'm following the https://developers.eos.io/eosio-home/docs/token-contract block one tutorial using the latest eosio/eos-dev docker image (v1.4.0). I have some issues when I compile eosio.token.cpp ...

1 2 3
4
5
12