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.

102 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
1answer
223 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
236 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
161 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
1answer
59 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
1answer
231 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
53 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
87 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
284 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
138 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
76 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
98 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
166 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
102 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
0answers
11 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
0answers
24 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
0answers
20 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 ...
1
vote
1answer
38 views

Smart contract compiling loop

When I try to compile the contract the process creates an infinite loop. Here is my code, please help! kjnjrwsyxszg.cpp #include "kjnjrwsyxszg.hpp" void kjnjrwsyxszg::create(const name owner,...
1
vote
1answer
37 views

Multiple transaction hash collisions on mainnet

There are currently multiple transaction hash collisions in consecutive blocks in EOS as noted below: 7dcdcdb558028c7703faddee96e1aa48e9bbe7cd3a07cd0a74513a3599185b40 at block 10712420 and 10712421 ...
1
vote
0answers
6 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
1
vote
1answer
22 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
61 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
29 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
1answer
33 views

Amount deposited not being recorded in contract

I'm learning to make my own contract and I'm having a hard time getting LNX that is transferred to the contract to be recorded ad a balance. #include <eosio/eosio.hpp> #include <eosio/asset....
1
vote
0answers
16 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
21 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
396 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
17 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
30 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
111 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
19 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
107 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
213 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
53 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
405 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
32 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
34 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
33 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
478 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
91 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
58 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
320 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
0answers
36 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
38 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
121 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
308 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
257 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
422 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
146 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 ...