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.

109 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
2answers
75 views

What are the advantages and disadvantages of using multiple smartcontracts?

I have noticed many EOS contract programmers choose to have a token contract and a seperate smart contract for other things to do with those tokens. What are the advantages and disadvantages to this ...
3
votes
1answer
191 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
204 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
153 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; ...
2
votes
0answers
43 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 ...
2
votes
1answer
40 views

Execution order of actions

I want to implement "continious minting" which means first I should call issue, and only then transfer. My contract has a functionality of eosio.token . I call create to create my token with ...
2
votes
0answers
203 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 ...
2
votes
1answer
124 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 ...
2
votes
1answer
48 views

Is there a way to prevent me spending tokens until an action is called?

I am creating a smart contract but came to a halt when writing the code. Is there a way, in a smart contract, to prevent me from spending tokens transferred to me by another user through the smart ...
2
votes
0answers
78 views

Where are deferred transaction errors logged to?

I'm trying to learn about deferred transactions. I'm creating a bogus deferred transaction that invokes a non-existent action "fakeaction": transaction out{}; out.actions.emplace_back(...
2
votes
2answers
255 views

A possible alternative sign in/login process instead of firebase auth / amazon cognito using an eos contract?

I had the the idea of a secure alternative login process using an EOS smart contract instead of firebase or Amazon cognito. I would like to know if something like this feasible? My idea is somewhat ...
2
votes
2answers
119 views

How do tokens that pay dividends work?

If a token is created as a standard eosio.token, what are some approaches for paying out dividends to token holders?
2
votes
1answer
64 views

Reclaim RAM for dApp that creates an account and transfers funds

A dApp that creates a new account and transfers EOS to that account will have to 'pay' for 240 bytes of RAM for the new balance object on the new account. When the new account transfers some funds, ...
2
votes
1answer
88 views

ABI File To Communicate With Unity Game Engine

So I'm building an HTML5 Unity game that will run in an internet browser attached to the Interplanetary File System. Unity allows for JSON files to be used to send and receive binary data between ...
2
votes
1answer
146 views

Send same action as `cleos push action hello hi …` in smart contract tutorial

I finished smart contract tutorial, and it worked well. Now I'm trying to send same action as cleos push action hello hi '["bob"]' -p user@active in tutorial by using RPC API, cause need to implement ...
2
votes
1answer
93 views

How to setup action access control?

Let's say contract-A has a couple of actions defined. If access to one of the contract-A's action, say action1(), needs to be controlled on account basis, how to do it? For example, only few ...
1
vote
1answer
16 views

Eos-sharp jungle Error 3090003 when trying to call external smart contract

I’m trying to achieve something quite simple. I try to call eosio.token transfer from one of my smartContract (lomtaxjungle dopurchase), but after severals days i still don’t manage to do it. From ...
1
vote
1answer
43 views

I have doubts about intercontract communication

I have read that: In order to call an inline action, that is to call an action of contract A from contract B, there is a need to set some special permission. In this case, the Ram payer for the ...
1
vote
1answer
21 views

Profiling EOS.IO smart contract code

What's the best way for profiling the code of an EOS.IO smart contract? I'd like to know what percentage of the CPU time is spent on executing each function\line (including multi index table function ...
1
vote
0answers
15 views

How to retrieve tx object within contract

I'm trying to retrieve tx within contract, but I only can find tx_hash using read_transaction. Anybody can help me?
1
vote
0answers
18 views

How to view Macro extended code?

I use this command is ok: eosio-cpp hello.cpp -o hello.wasm But I want to view Macro extended code by option -E - Only run the preprocessor, I use this command: eosio-cpp hello.cpp -E And get ...
1
vote
2answers
211 views

How to free up used memory

I have this picture for my account memory: quota: 220.4 KiB used: 207.5 KiB I want to free the memory and sellram. Is it possible, and if yes, how to do that?
1
vote
0answers
16 views

How does smart contract development differ between each of the EOS.IO side/sister chains?

Most tutorials that exist for smart contract development are directed at the EOS Mainnet chain. But there are several sister and side chains available, and the number is growing all the time. How does ...
1
vote
1answer
21 views

How to tell a certain contract in indeed used in a dApp?

The dapp review sites often list the contract names a dapp is using. I see that this is added by whoever has added that dApp into the review site. But is there a verifiable way (through an explorer ...
1
vote
1answer
84 views

Is it possible to deploy contract via curl?

Using command line i am deploying smart contract "eosio.token". cleos -u http://127.0.0.1:8888 set contract eosio.token ./eosio.token -p eosio.token Is it possible to deploy smart contract using ...
1
vote
0answers
16 views

Hide information in the blockchain

Lets say I want to create a player vs player game with a battlefield and moving armies, the movement and data about the armies and where is it going is put on the blockchain. My question is how to ...
1
vote
2answers
73 views

How to get a contract to accept tokens as payment

I keep getting the following error: transaction declares authority '{"actor":"test2","permission":"active"}', but does not have signatures for it under a provided delay of 0 ms, provided permissions [...
1
vote
1answer
145 views

Transfer tokens inside a smart contract from an account to another account

I need to write a simple function that would send tokens using a different account action. Exactly the same situation as in these questions: one and two But I have to use not eosio.token contract but ...
1
vote
0answers
41 views

Get symbol & contract from asset

I currently have an asset property that stores a value, i.e. 100 EOS which could also be another token like 100 TLOS. Is there a way to extract the symbol and possibly the token contract from that ...
1
vote
1answer
258 views

Duplicate symbol WASM compilation error when using header/hpp for contract

I'm looking to use a hpp file as an interface for multiple contracts. I've created a test contract and receiving a WASM compilation error. I based the test contract on the format used by eosio.token....
1
vote
0answers
29 views

No tables in abi file

I am trying to write a smart contract but for some reason my tables aren't being added to the abi file and therefore aren't being added to the blockchain. My code is as follows. Am I possibly ...
1
vote
0answers
30 views

cannot get latest state of table after modifying table in inline action

As shown with code below, I modify table in an inline action, and then want to get the latest data. But the data I get is not the latest. Why? void mycontract::myfunc() { action ( ...
1
vote
0answers
31 views

Payment to dapp with text comments best practice

I am new in eos, so maybe i say something strange. I want to create a dapp that can receive payments from mobile wallets with text comments. I imagine this like front end where user type text and ...
1
vote
1answer
411 views

How to solve !action_type.empty(): Unknown action hi in contract hello?

I am following this doc: https://developers.eos.io/eosio-home/docs/your-first-contract. This is the hello.cpp contract code which is successfully deployed: #include <eosiolib/eosio.hpp> #...
1
vote
0answers
88 views

How to solve !action_type.empty(): Unknown action hi in contract hello?

I am following this doc: https://developers.eos.io/eosio-home/docs/your-first-contract. This is the hello.cpp contract code which is successfully deployed: #include <eosiolib/eosio.hpp> #...
1
vote
0answers
53 views

Signing a users account contract deployment remotely with a users arbitrary signature

What I am trying to do is deploy a contract on the behalf of the user, by getting them to sign the deployment remotely. I have been informed that if I get a arbitrary signature on the setcode, I can ...
1
vote
2answers
256 views

What is the difference between transaction.send and action.send?

I found that there are two types of transfer I can use in an EOS contract, but I don't know what is the difference between them. 1st type 2nd type
1
vote
1answer
134 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
vote
0answers
35 views

How to make real time my contract transition history

I want to make real time my contract transition history,Do I have to learn what components of EOS blockchain?
1
vote
0answers
60 views

How can i prevent another contract call my contract's method?

how can i prevent another contract call my deployed contract? Or how can i know that the caller is an eos account with contract or not. Thanks.
1
vote
0answers
33 views

EOS smart contract upgrading/recompiling, variables and symbol mappings

EOS allows to reset the contract code payload, unlike some other blockchains: https://www.reddit.com/r/eos/comments/91aqjx/how_many_contracts_can_an_account_have_on_the_eos/e2ww4la/ How the code ...
1
vote
1answer
109 views

Smart contract error while calling recover_key

Specs I am using the function recover_key from the library crypto.h at the following link: https://github.com/EOSIO/eos/blob/master/contracts/eosiolib/crypto.h Code int compressed_size = ...
1
vote
0answers
13 views

Publish a contract using hardware wallet

Is there a way to publish a contract using hardware wallet (ledger preferably) without ever exposing private keys?
1
vote
0answers
304 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-...
1
vote
0answers
245 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
379 views

How to use recover function in crypto.hpp to verify signature and public key

I want to sign some data in client using eosjs-ecc.sign() and result is a string like "SIG_K1_KcTmv..." I want to use the recover_key(const checksum256* digest, const char* sig, size_t siglen, char*...
1
vote
0answers
130 views

How to trigger the user account token stake or unstake automatically by using contract

Actually , I have a scenario that users need to stake his or her own certain tokens on a platform by using eosio contract without worrying the platform will take over the users's tokens. and some ...
1
vote
0answers
305 views

How do I add second and third indices to the multi_index object?

I have thoroughly read the documentation and isolated my problem down to a small set of sample code. I'm not sure where my problem is. I am trying to add multiple indices to a multi_index object so ...
1
vote
0answers
106 views

Eosflare.io shows the wrong Connector Balance for EOSIO.RAM account?

It currently shows 66730 EOS (http://eosflare.io/account/eosio.ram), but here in the first answer (How to get current (last) RAM price?) is said that it should be 1021789.6640 EOS (see quote.balance). ...
1
vote
1answer
102 views

Authorization flow in dapps

How authorization works in EOS dapps? I mean in application layer. For example in a trello like application how we manage to just the participants in the project are able to see the tasks?