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
1 answer
73 views

How to pass specific eosio-cpp/eosio-ld options via cmake

I'm typically using CMake to compile my contracts, like described here. How can I pass specific eosio-cpp/eosio-ld options (specifically -stack-size) described here?
cmadh's user avatar
  • 1,929
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::...
Harsh Mehta's user avatar
1 vote
1 answer
78 views

Difference between _self and get_Authorization and RAM optimization

I have build a Smart Contract with 14-15 Tables for I/O. It will be used to store important data of our platform. I have used require_auth(_self) as this contract will not be used by 3rd person. It ...
Harsh Mehta's user avatar
2 votes
1 answer
58 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 ...
Varsh's user avatar
  • 307
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 ...
Varsh's user avatar
  • 307
1 vote
1 answer
53 views

Is it possible to get the initiating contract name from a token transfer?

When an external account transfers tokens to my account (which has a contract with an "on_notify" action for incoming transfers), is there any way I can get the name of the contract that ...
Matthew's user avatar
  • 11
2 votes
1 answer
37 views

cleos push action is not working on multihost peer node

I have a setup of multinode, one genesis node and another host node inita connected to the genesis node. Nodeos is running on both hosts. Genesis node is producing blocks and inita is receiving them. ...
Varsh's user avatar
  • 307
0 votes
1 answer
75 views

What does 'datastream<const char*>' mean in this code?

From this tutorial addressbook(name receiver, name code, datastream<const char*> ds): contract(receiver, code, ds) I'm not familiar with 'datastream' and Googling isn't turning up any precise ...
user avatar
0 votes
1 answer
142 views

Calling external action with 'action_wrapper' and 'action'

In contract we have two way to call another action: Use 'action' action(permission_level{get_self(), eosio::name{"active"}}, eosio::name{"eosio"}, ...
Teresa's user avatar
  • 125
1 vote
1 answer
27 views

Does the size of a contract affect CPU consumption

Does the size of a contract increase CPU consumption in general? To my knowledge, there may be several secondary factors that slow down the processing of transactions. For example, a memcpy command ...
cmadh's user avatar
  • 1,929
0 votes
1 answer
133 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 , ...
jaehaha's user avatar
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 ...
EOSdev6416's user avatar
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,...
kjnjrwsyxszg's user avatar
1 vote
0 answers
76 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 ...
ralex's user avatar
  • 111
0 votes
1 answer
308 views

Convert type string to type checksum256

fist off let me get this strait, yes I know the dangers of memo parsing, yes I am aware of the vulnerabilities that can be created from doing such a process, so please there is no need to lecture me ...
nicholas labrecque's user avatar
1 vote
0 answers
9 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
Jarred Mann's user avatar
-1 votes
1 answer
72 views

What's the max speed of EOSIO contract?

I try to do performance testing about EOS contract. I built private EOS network with 6 nodes. I use apache bench to formulate http requests, and post to EOS service http://127.0.0.1:8888/v1/chain/...
lihao's user avatar
  • 1
1 vote
1 answer
131 views

Dispatcher in smart contract

I want to implement dispatcher in a smart contract. I research about this and understand theoretically but I am not getting practically. Exactly why the dispatcher is to be used? The basic thing I got ...
Varsh's user avatar
  • 307
0 votes
1 answer
49 views

EOSlime TypeError: Contract.actionname is not a function

This is my test file: const assert = require('assert'); const TOKEN_WASM_PATH = './contracts/group/group.wasm'; const TOKEN_ABI_PATH = './contracts/group/group.abi'; describe("EOSIO Group", ...
Varsh's user avatar
  • 307
0 votes
1 answer
52 views

eoslime test not saving data in table

This is my first experience with eoslime as I want to do unit testing for smart contracts. Not much experienced with nodejs .I am following eoslime documentation: https://docs.eoslime.limechain.tech/...
Varsh's user avatar
  • 307
0 votes
2 answers
191 views

how to define a vector with fixed size?

I want to define a vector of strings with a fixed size 3 in the multi-index table of smart contract. I search and tried different ways which I found for CPP vector like: std::vector<string> abc(...
Varsh's user avatar
  • 307
0 votes
1 answer
51 views

Wrong table name in scope response

My contract has two tables mcat and mcatmig. Problem: scope request return wrong table name mcat........1 instead of mcatmig: % cleos get scope teresacode { "rows": [{ "code": "teresacode", "...
Teresa's user avatar
  • 125
0 votes
0 answers
83 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 ...
Varsh's user avatar
  • 307
0 votes
0 answers
111 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 { ...
Varsh's user avatar
  • 307
0 votes
1 answer
311 views

Multiple smart contracts with single account

I have three smart contracts (A, B, C) and one account (X). As the requirement is I just need only one authority (administrator) who is going to manage all these smart contracts data. So I deployed ...
Varsh's user avatar
  • 307
0 votes
1 answer
120 views

How to check authorization for a particular account in EOS smart contract?

I want to write an EOS smart contract to manage users data. I need that only some admin account will able to add, update and delete users and the particular user can only update data. Can I check ...
Varsh's user avatar
  • 307
0 votes
1 answer
77 views

Complex smart contract for rule based auction in multiple currencies

The imagined application allows users to participate in an auction and make bids in cryptocurrencies. There are several behavioral rules that control the execution of the auction and determine the ...
Daniel Leiszen's user avatar
0 votes
1 answer
38 views

Take output from GetActions and send to database using eossharp

I am using eos-sharp to get data from the eos smart contract. I am trying to get actions data by using: var resultaction = await eos.GetActions("dqzmember", 0, 30); I need information from ...
Varsh's user avatar
  • 307
0 votes
1 answer
99 views

how to save data in mongodb from eos smart contract?

I am getting the actions log data using an action constructor in a smart contract. I need to save this data in MongoDB from the smart contract. How can I do this? I didn't get exactly my required ...
Varsh's user avatar
  • 307
0 votes
1 answer
31 views

How to access and manipulate tables when using native unit tests?

I am trying to write unit tests for functions in a smart contract that require access to tables within the smart contract. I tried to set this up using the hello_test.cpp code as a base and when I get ...
Phillip Hamnett - EOS42's user avatar
0 votes
1 answer
105 views

How do I record LOG in eosio smart contract?

I deployed and tested eosio smart contract. I want to record the logs of a smart contract using the web API. How can I do this? I searched but didn't get any satisfying answer. I tried to get logs by ...
Varsh's user avatar
  • 307
0 votes
1 answer
36 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 ...
spark666's user avatar
1 vote
1 answer
129 views

cleos data getting inserted and deleted but table shows empty record

I have written one smart contract for insert, update and delete data. The smart contract is compiled and deployed to the two accounts. I insert data using calling the action upsert, this transaction ...
Varsh's user avatar
  • 307
0 votes
1 answer
59 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> #...
AhmadKajjan's user avatar
3 votes
1 answer
67 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
user3819's user avatar
4 votes
1 answer
70 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 ...
AditiB's user avatar
  • 235
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 ...
Lomtax LADAMBERTI's user avatar
0 votes
0 answers
22 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 ...
AhmadKajjan's user avatar
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 ...
Jimmy Sullivan's user avatar
0 votes
1 answer
134 views

Check public keys on contract level

Is it meanwhile possible to check the public key of an account name on contract level? (Not with Cleos) Example: The contract contains some public keys (not the account names). If a user performs a ...
kei101's user avatar
  • 3
1 vote
1 answer
238 views

What is the difference between std::string and eosio::string?

Why should I use eosio::string over std::string? What are the use cases where it would make a difference?
Phillip Hamnett - EOS42's user avatar
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 ...
coder's user avatar
  • 43
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 ...
aaron zhan's user avatar
0 votes
1 answer
178 views

Strange checksum256->uint64_t casting

I'm trying to cast checksum256 to uint64_t Here is conversion code: uint64_t checksum_to_uint64(const eosio::checksum256 & digest) { auto checksum_bytes = digest.extract_as_byte_array()....
Mikky Snowman's user avatar
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 ...
Yogev Mashiach's user avatar
0 votes
1 answer
97 views

Trouble using EOSIO built in crypto library (can't resolve headers)

I ran eosio-init on the newest CDT (1.7) and made a -bare project. newtest.cpp #include "newtest.hpp" ACTION newtest::hi( name nm ) { /* fill in action body */ print_f("Name : %\n",nm); } ...
MegaBeans's user avatar
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 "...
Shashi's user avatar
  • 1
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 ...
Efraim's user avatar
  • 1
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 ...
Emilien's user avatar
  • 15
0 votes
1 answer
120 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 ...
Pocket Quads's user avatar

1
2
3 4 5
13