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.

107 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1
vote
0answers
15 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
315 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
259 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
447 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
152 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
320 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
108 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
120 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?
1
vote
0answers
131 views

unpack_action_data - error: !"unresolvable": env.free. #

I am trying to use unpack_action_data. void apply(const account_name contract, const account_name act) { if (act == N(transfer)) { transferReceived(eosio::unpack_action_data<...
0
votes
0answers
2 views

any way to know inline action depth on blockchain explorer

the following error was encountered recently, any way to check the inline action depth of the transaction on blockchain explorer or other approach? max inline action depth per transaction reached
0
votes
0answers
16 views

How to link an external library to my eosio smart contract?

I normally use eosio-cpp to compile my smart contract, but recently I needed to use an external lib and link to it to build my project. I checked the docs here, but it basically shows how to use cmake ...
0
votes
0answers
32 views

how can i pass array of integers to smartcontract action using SwiftSDK

I have following action in my smartcontract: ACTION uploadfile1 (name creator, vector<uint8_t> content, string filename) I'm trying to push action from my Swift application using following code:...
0
votes
1answer
29 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
0answers
12 views

Does anybody have a complete code example of changing the e.g. active key of a contract account from within that contract?

I want a contract to set its active permission to a hardcoded key (an "EOSxxxx" string) from within the contract code, but I can't find an actual complete code example that works. This ...
0
votes
1answer
9 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
1answer
30 views

Nested depth exceeded

kipping set abi because the new abi is the same as the existing abi Publishing contract... Error 3070002: Runtime Error Processing WASM Error Details: Nested depth exceeded pending console output: ...
0
votes
1answer
46 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, ...
0
votes
1answer
38 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:...
0
votes
2answers
28 views

how to make sure the tx to be included in block

as subject, any way to make sure the tx to be included in block, what i think of is, if the tx meet the condition, then notify the contract to execute the specified action, otherwise notify an account ...
0
votes
2answers
31 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 ...
0
votes
0answers
16 views

Implement Shamir Secret Algorithm in smart contract

I need to implement Shamir's Secret algorithm in EOS smart contract. Looking for some open source libraries which will support EOS. I researched some here https://github.com/topics/shamir from which I ...
0
votes
1answer
59 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
0answers
30 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 ...
0
votes
1answer
62 views

How can I change quantity in transfer

Good Day!! I want to change add_balance in transfer How can change quantity value in add_balance? Ex) invalid operands to binary expression ('eosio::asset' and 'int') add_balance( to, quantity - 100 , ...
0
votes
1answer
110 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
0answers
37 views

How to generate unique string id from given array of strings in smart contract?

I am writing an EOS smart contract in which need to write the action to generate a unique id from the given array. Array consisting of n number of string elements (UUID). Suppose I pass 10 strings to ...
0
votes
0answers
51 views

How to set vector type field as a secondary index in smart contract?

I want to set a group vector as a secondary index in the user smart contract. group is the list of groups. Following is the changes I am doing: struct [[eosio::table]] usertable { ...
0
votes
1answer
28 views

Question cost while using token contract

I am sorry to bother you, I am a little confused about the cost while using a token contract: the contract provider will pay all the utilities if a user using the contract including the CPU, NET and ...
0
votes
1answer
40 views

make inline transfer contract and using it on jungle testnet

hello everyone i am faceing a problem on jungle testnet i am trying to make a inline transfer but i got this error after i work with the api_endpoint the code is #include <eosio/eosio.hpp> #...
0
votes
0answers
21 views

Make a trade contract between two tokens like (EOS) & (SYS)

hello everyone i made a small contract that trade between two tokens using eosio.token but if i wasn't work on local test how can i have access to EOS tokens or SYS in the main net and how can i do ...
0
votes
1answer
41 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
1answer
67 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
1answer
62 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
2answers
160 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 ...
0
votes
1answer
73 views

Is it possible to see the RAM delta of a multi_index table operation, or see who is currently paying for a row in a table

My question is in the context of smart contract development, so I'm looking for solutions that work within smart contracts: 1st: Is is possible to see the RAM delta of either an individual ...
0
votes
1answer
153 views

How to parse json string in contract?

My contract want to receive transfer with memo in json format, is there any libraries supporting the json parse?
0
votes
1answer
63 views

I would like to make listener contract

I would like to make a contract, wich listens to the incoming transfers. How do I make a listener contract, wich listens to incoming transfers on the account?
0
votes
2answers
108 views

How to pay for user resources cost for payable action?

I have a smart contract which has a payable action defined. I want to cover the cost of transfering token to my contract, what's the best way to do this? Thanks.
0
votes
0answers
43 views

Code abstraction

I need a little guidance. I've been structuring my code like this: #include <eosio/eosio.hpp> class [[eosio::contract("table")]] Square { private: struct [[eosio::table]] square { ...
0
votes
1answer
79 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:...
0
votes
0answers
36 views

Catch errors when calling deposit

When I send EOS in a contract to several recipients, it can happen that this fails, e.g. because a recipient has a contract running like that: Example contract of one recipient: [[eosio::on_notify("...
0
votes
0answers
54 views

How can i Improve my code (Transaction took too long)

I have Enough CPU and NET i have staked 13 EOS for each and still unable to run the code. Please suggest if i can improve anything. IS there any problem of table index Got this from developer.io if ...
0
votes
1answer
80 views

multi_index table get const_iterator at a specific position

is there a better way than a loop to get the value/const_iterator at a specific position in multi_index table? current: auto idx = _table.get_index<"name"_n>(); const_iterator b; int count = ...
0
votes
0answers
272 views

Error message assertion failure with message: "read"

I made my own smart contract. and tried to erase my table. But it didn't. I will attach the following error { "code": 500, "message": "Internal Service Error", "error": { "code": 3050003, ...
0
votes
0answers
91 views

When deploying a contract what is important (overall contract/wasm size or amount of functions etc) to not get transaction took too long

when I try to deploy the system.contract I sometimes get transaction took too long with the new eosio version 1.8.1. Now I would like to know on which part of a contract do I need to pay attention ...
0
votes
0answers
74 views

env.is_feature_activated unresolvable while setting up eosio.system contract

I am following BIOS Boot Sequence. I want to set up my own private EOS network that's why I am setting up the EOSIO network. at step 1.12 I am not able to set the eosio.system contract it will give me ...
0
votes
2answers
76 views

Is there a way to issue tokens infinitely?

I want to design a system where token supply can grow infinitely. Is it possible not to fix total supply at the token creation moment?
0
votes
2answers
78 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
0answers
82 views

Time point to string

I am currently trying to get the current time using time_point_sec(now()); Does someone know how to convert that to a std::string?
0
votes
1answer
101 views

read datastream of length 29 over by -4

enum house_status: uint64_t { NEW = 10, FULL = 20, ONGOING = 30, OVER = 40 }; struct [[eosio::table, eosio::contract("game")]] house{ uint64_t id; uint64_t owner_player_id; ...