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
0 votes
1 answer
30 views

What is the eosio private key when running on local?

I was trying to test the smart contract I created in my local but I am currently blocked as I can't create a new account. As per EOS documentation, I used the command below to create a new account: ...
0 votes
1 answer
92 views

Generate random numbers in the smart contract

I am writing smart contract and stucked on this line : int p = 0; p = (rand() % 997); This is giving error error: use of undeclared identifier 'rand' I do search and got some reference links but ...
2 votes
1 answer
188 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 ...
0 votes
1 answer
12 views

Alternative to std::ifstream for eosio contract

I'm watching for an alternative to "std::ifstream" because "#include " can't include as header in a contract. My code is: std::istream& operator>>(std::istream& str, ...
3 votes
1 answer
308 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 ...
1 vote
1 answer
614 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> #...
2 votes
2 answers
331 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 ...
1 vote
1 answer
495 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*...
0 votes
1 answer
237 views

Token transfer missing_auth_exception

{ "code":500,"message":"Internal Service Error", "error":{"code":3090004,"name":"missing_auth_exception", "what":"Missing required authority", "details":[{"message":"missing authority of thomsoimj21","...
1 vote
1 answer
454 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 ...
2 votes
2 answers
171 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?
3 votes
1 answer
182 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; ...
0 votes
1 answer
88 views

Is there a way to mark accounts like give an account a property value?

Let's say I'm making a game character and each eos account is a unique character. Is there a way to mark an account with different properties like strength, speed, durability, etc....
2 votes
1 answer
120 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
1 answer
81 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,...
0 votes
1 answer
56 views

Immutable smart contract

In EOS, smart contracts can be updated by the account owner. This could be a problem for certain applications in finance. For instance, if I want to deploy a token, the transfer function should be non-...
0 votes
1 answer
145 views

What should I do to specify an optional action parameter for cleos?

I wrote an action that has an optional parameter, as something like: [[eosio::action]] void foo(..., const std::optional<name>& recipient); Then in the generated .abi, it is represented as:...
2 votes
1 answer
395 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 ...
0 votes
1 answer
73 views

EOSIO failed when using Smart Contract Action with updated Parameters

I deploy a Smart Contract first time and the action becomes usable as it's supposed to be, but when Action's parameters is updated with a new one between existing p1 and p2 old parameters (result: p1, ...
2 votes
1 answer
138 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 ...
0 votes
1 answer
37 views

How to get name of account which is processing action recent in contract?

I need to authorize with admin table of contract. but I could not account name which is processing action of contract. Let me know about any eos function to get account name, if anyone know well. ...
1 vote
1 answer
81 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
1 answer
49 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 ...
0 votes
1 answer
73 views

Does EOSIO Have Native Contracts Built-Into Protocol Layer?

On the Bitshares site I read https://bitshares.org/technology/industrial-performance-scalability Based upon the lessons we learn from LMAX, we know that a virtual machine for a blockchain should be ...
1 vote
1 answer
46 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 ...
0 votes
2 answers
90 views

Ico smart contract update

I would like to update this code, because it is CDT 1.2. I would like to update for CDT 1.5 or CDT 1.6. What do I need to change? #include <eosiolib/eosio.hpp> #include <eosiolib/currency....
0 votes
1 answer
63 views

Declare custom structs

I am trying to create a custom struct called Student in a contract. Where do I declare or define the struct? I tried to define it in the abi file, but the file was over written when I compile the ...
0 votes
1 answer
63 views

Get table row count or property from the last row

As I said I need to get the count of rows in a table. Preferly via rpc with http plugin or from a new action inside the Smart Contract. This is my Smart Contract: #include <eosio/eosio.hpp> ...
0 votes
1 answer
207 views

EOS Blockchain How to free up RAM or optimize Smartcontract

We have developed a small program that uses the EOS blockchain and we are storing some of our data in an EOS smart contract. Together with a UUID we are storing the object status. Our goal is to have ...
0 votes
1 answer
86 views

Cleos set contract, Internal Service error timeout_exception

I am running EOS on my laptop. If I execute the "cleos set contract" command and the contract size is more than 200kb, I get an error: error 2021-06-01T17:44:30.084 http-1 http_plugin.cpp:...
2 votes
2 answers
806 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?
0 votes
1 answer
43 views

What is the maximum size of smart contract?

I'm developing a smart contract and yesterday I couldn't deploy it into testnet with error: root@698a02be20d9:/# cleos --verbose set contract myaccount /work/mycontract -p myaccount@active Reading ...
1 vote
1 answer
97 views

Contract transaction cannot be found after i get result of pushSignedTransaction

I've send a contract trans on mainnet use eosjs@20, and i've tried for 4 times, every time i get a trans result, but all of them seemed been drop, i cannot find them on explorer or on chain, can any ...
1 vote
1 answer
989 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....
2 votes
1 answer
116 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
1 answer
210 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
1 answer
213 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 ...
3 votes
1 answer
273 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 ...
0 votes
2 answers
51 views

How check deferred transaction logs on EOS jungle testnet?

As I working on jungle testnet and perform a 1 deferred transaction with some scheduled automatic time. But I failed to see transaction logs on the jungle testnet. Can any please guide me here with ...
1 vote
1 answer
123 views

Can a smart contract perform actions on a scheduled delay indefinitely?

I am pretty new to working with EOS, so please excuse my ignorance and improper terminology. I am trying to repeatedly excecute a given action on a set time delay. For example, trying to submit a ...
0 votes
1 answer
1k views

WAX - Signature error : "Message: transaction declares authority, but does not have signatures for it."

I'm trying to send a transaction from my react frontend to local chain, I have signed in wax cloud wallet and made a transaction. But at last I met this signature error. "Message: transaction ...
0 votes
1 answer
36 views

Caller of action detail in code

I need to check Account of caller action ,as in ethereum we have a concept of msg.sender to get the caller eth_address, similar is there a way to get caller of action details in EOS.
0 votes
1 answer
128 views

Is there way to retrieve auto incremented primary key after submission of transaction?

I'm working on sample dApp application to understand the working of multi_index table in EOS smart contract. I have defined two multi_index table. The primary key of table1 is auto incremented using "...
0 votes
1 answer
42 views

how can my on_notify trigger calls contract actions (permisson issue)

I need to write a contract that automaticaly mint nfts when tokens are being transferred. So i have my : [[eosio::on_notify("*::transfer")]] void logdeposit(name from,name destination, ...
1 vote
2 answers
415 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
0 votes
1 answer
89 views

How to check in my contract the incomming amount?

I would like to check in my contract the incomming amount. I tried these: void mycontract(name from, name to, eosio::asset quantity, std::string memo){ check( quantity.amount > 50, "must ...
0 votes
1 answer
159 views

How to Define and use Array of Strings in Struct?

My Sample Struct and its method // Department Table struct [[eosio::table]] department_info { uint32_t ID; std::string deptname; std::string deptcode; std::...
0 votes
1 answer
141 views

How to deploy a smart contract on the mainnet?

I created and tested my smart contract on testnet. Now I want to deploy it on mainnet, I assume I have to purchase some EOS token and buy ram, cpu and net... I can't find anything in the docs about ...
1 vote
1 answer
113 views

How to access data inside multi-index table when using 2D vector / 2D array?

What is going on? :D I write data, but cannot find it after I write it. The following code successfully emplaces the row into the multi-index table: See specifically the vector<vector <...
0 votes
2 answers
246 views

Use UUID as primary key in multi_index

How can I use a uuid as the primary. struct [[eosio::table]] blackboxdata { name user; std::string uuid; std::string hash; std::string sqlrequest; uint64_t ...

1
2 3 4 5
13