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
1
vote
2answers
346 views

How to get balance using smartcontract in the new CDT

Is there a way to access the balance(of EOS or any token for that matter) of a given account using smart contract in the new CDT? Thank you
1
vote
2answers
427 views

How to call get_balance function in eos contract in 1.3.2?

In the old version, I can get self balance by these code: auto token = eosio::token(N(eosio.token)); const asset balance = token.get_balance(_self, symbol_type(EOS_SYMBOL).name());...
1
vote
1answer
368 views

Trying to pass a sha256 hash to my contract and store it

I'm new to the EOS platform. For my use case I'm trying to pass a sha256 hash to a function in my contract and store it in a table which is indexed by that hash. I've realized you can't have the ...
1
vote
2answers
533 views

How to convert from name type to account_name type in contract?

I know how to do the other way round but don't know how to convert from name to account_name unless I convert it to string first. Please help. Thanks.
1
vote
1answer
71 views

How all the block producers get a consistent database for float point processing?

In the EOS smart contract, it support the float point computation, such as calculating the voting weight. And I think that, for different operation systems and different compilers, the float point ...
1
vote
2answers
92 views

Is there a BP with available smart-contracts that we can simply run without submitting?

Submitting a smart contracts to different BPs gives me different errors. Would there be a BP with ready-to-run smart-contracts (which are found in a /contracts directory) that can be executed by EOS ...
1
vote
1answer
166 views

Why use databases in smart contract?

As we can store data in map, why we need to create table for it, and why we need to pay for the fee for create and modify records? How much is the ram fee, how to avoid it? If I use map, who will ...
1
vote
1answer
60 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 ...
1
vote
1answer
78 views

Is it possible to set up a smart contract with multiple .cpp and .hpp files?

If we want to make our smart contract code modular, and keep each class, contract, and table in its own file, is it possible to do this, and if so, how?
1
vote
1answer
34 views

Can smart contract trigger some action on specified timestamp and change certain account balances?

Imagine I have a poll with specified timestamp for the end. At that point in time votes should be tallied and voters token balances should be adjusted in both directions (increase and decrease). How ...
1
vote
1answer
132 views

no member named 'check' in namespace 'eosio'

I am trying to build a contract and receiving this error: In file included from /usr/opt/eosio.cdt/1.6.1/bin/../include/eosiolib/contracts/eosio/system.hpp:6:[0K /usr/opt/eosio.cdt/1.6.1/bin/../...
1
vote
1answer
72 views

What exactly the merkle function is returning?

In the below file, https://github.com/EOSIO/eos/blob/v1.7.4/libraries/chain/merkle.cpp, what do ids.front() mean?; what exactly this function Merkle is returning? Could you please explain what this ...
1
vote
1answer
77 views

How to delete record on EOS if I forget table structure

I issue an EOS token for fun half a year ago and I'm planning to release my EOS ram recently. The problem is that I forget the table structure I made before and I overwrite the contract and there is ...
1
vote
2answers
44 views

How do I confirm that the person sending an action is the same as a user in the parameter?

Specific example from a contract: ... void hi(name user){ // verification here, require_auth(user)? print(user); } ... I've tried require_auth(user) but that seems to always fail unless the user ...
1
vote
1answer
70 views

`cleos get table` not returning vector<string>

I declare a vector vector<string> data inside a contract. Contract Code: book.emplace(_self, [&](struct wname &a){ a.name = fa.pubaddress; a.namehash = ...
1
vote
1answer
124 views

How to extend the functionality of eosio.token?

I want to create an EOSIO token with additional functionality. For example, I want users to be able to claim() an additional token per day (since e.g. account creation date). Should I create a new ...
1
vote
1answer
89 views

Multiple print statements?

given the lack of debugging facilities in EOS contract development I add print() statements to my code, but I'm finding that only the first one gets printed, so: print("HERE\n"); print("HERE\n"); ...
1
vote
1answer
46 views

hello contract: not printing the name

I just set the hello contract and pushed action hi. But it did not print the name. Here is my test command. $cleos --wallet-url http://172.18.0.1:8899 -u http://172.18.0.1:8888 push action shlee ...
1
vote
1answer
346 views

How to write a contract to stake my own token without doing transfer?

In my case, I need to write a contract which has an action can stake my own token (issued by my account with eosio.token, like TADO). If A has 10 TADO already, when he stakes 4 TADO, his balance still ...
1
vote
2answers
109 views

EOSIO Tutorial : publishing contract error

I'm working on EOSIO tutorial and now I'm workingon https://developers.eos.io/eosio-home/docs/data-persistence part. Right now, I'm stuck on deploying contract. jongbok@DESKTOP-96ICBPJ:~/eos/...
1
vote
1answer
69 views

is that a good way to gather smart contract action data in backend with Demux.js?

there is a Bill functionality in my DApp, which need gather millions of EOS action data to make up a token transfer data for front end to display. the question is, it takes quite a long time. if it ...
1
vote
2answers
621 views

No matching constructor for initialization AddressBook example

Dependencies: EOSIO.CDT (Contract Development Toolkit) Version : 1.3.1 My code: #include <eosiolib/eosio.hpp> #include <eosiolib/print.hpp> using namespace eosio; CONTRACT ...
1
vote
1answer
721 views

Assertion failure after updating a smart contract with tables

Before the update Before the update of the code of my c++ smart contract, this uses to work absolutely fine. Data storing on the table and actions execution were done successfully. After the update ...
1
vote
2answers
166 views

How does EOS address its Smart Contracts?

Ethereum (for comparison purposes only), uses the address of the creator, the nonce, which is keccak (does EOS use this type of hashing?) hashed with the senders address(roughly- see related question ...
1
vote
1answer
48 views

How to check if smartcontract action has been actually run? How to count how many times?

Imagine an action, which is not const, and sometimes (but not always) modify a defined multi index. I would like to count, how many times a specific action was run. I do not want to introduce any ...
1
vote
1answer
140 views

How to parse iso8601 to eos time format?

How does one parse an iso8601 string to eos time_point format?
1
vote
1answer
298 views

how can i know if a name is account or contract?

How can i use cleos to get all rows from a table? It seems that cleos always only return 10 records? { "rows": [{ "buyer": "1111111111oo", "keys": 70, "award": 198185, "share_award": 0, "...
1
vote
1answer
213 views

Is it possible to compile a smart contract using g++ or clang?

I want to write and execute some unit tests on a smart contract outside of nodeos, but to do that I need to be able to compile the code the normal C++ way, using g++ or clang, so that I get object or ...
1
vote
2answers
239 views

The given contract doesn't exist in the blockchain

I have got contract code below: #include <eosiolib/eosio.hpp> #include <eosiolib/print.hpp> using namespace std; using namespace eosio; class deneme: contract { // @abi table ...
1
vote
1answer
165 views

How to retrieve historical EOS supply?

I know $ cleos get currency stats eosio.token EOS reports the current supply in the blockchain, but how can I get the supply through time?
1
vote
1answer
202 views

How to understand RAM and log storage from the view of Smart Contract?

The knowledge on RAM and smart contract is obscure to me. In white paper, RAM is defined and I know now there're only 64GBs in total. However in developer manual https://developers.eos.io/ it never ...
1
vote
2answers
242 views

Can a contract trigger events in the outside world?

Is it possible for a contract to somehow trigger an event which an external process may listen for? Or is polling the only practical way currently to determine an outcome in a contract?
1
vote
2answers
327 views

transcation take to long on cleos push action in EOS 1.0.2

Exception encountered while processing chain.push_transaction: 3040005 expired_tx_exception: Expired Transaction transaction has expired, expiration is 2018-06-12T12:30:04 and pending block time is ...
1
vote
2answers
506 views

Difference Between Eosio.token and Eosio.system

I have an idea for a DApp I'm looking to build after launch. It won't be large, but it'll be on a large platform (won't name it here because I don't want anyone taking my idea lol). After cloning the ...
1
vote
1answer
29 views

nested stuff inside index_table

I'm trying to build a small hearthstone like game and I've finished up the front-end for the game client. I created a NoSQL mockup of the user data and now it's time to move those to the index_table ...
1
vote
1answer
25 views

How to get table data from Jungle testnetwork?

I am trying to get all the insert data using get table on jungle testnet. But I was failed and get only an empty row value. command: cleos --url https://jungle3.cryptolions.io:443 get table ...
1
vote
1answer
37 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 ...
1
vote
1answer
25 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 ...
1
vote
1answer
105 views

Wondering how to fix eosio.token transfer error in contract

I am developing an EOS dapp game When the user acts on the contract after Scatter authentication, the logic is to deposit the bet amount from the user to the contract account. But I get an eosio....
1
vote
3answers
180 views

How does Jungle testnet create new account?

I have created new account in https://monitor.jungletestnet.io . I have a copy of the log # eosio <= eosio::newaccount {"creator":"junglefaucet","name":"myaccount","owner":{"threshold":1,"keys":[{...
1
vote
1answer
67 views

EOSIO's BP Benchmark

Today, I am researching how I can draw a diagram for BPs Benchmark, and luckily I found information about Ahola. But I cannot figure it out, how I can get value from Ahola's smart contract to draw a ...
1
vote
1answer
50 views

What are the patterns and anti-patterns when programming for EOS?

When programming smart contracts or writing eosjs code, there are certain pitfalls that you might fall into if you are not careful. What are some of the patterns and anti-patterns to be aware of that ...
1
vote
2answers
192 views

Transferring EOS within Smart Contract

I'm building a Smart Contract that transfers EOS from my contract account to end user accounts. I can not seem to find up to date and correct syntax for transferring EOS using eosio.token from within ...
1
vote
2answers
152 views

Contract compilation fails during elemental battles tutorial

I have followed the elemental battles tutorial until lesson 2 step 4, and at the end of it, the tutorial instructs to compile the existing code with eosio-cpp -o destination.abi source.cpp -abigen (...
1
vote
1answer
124 views

Serialization Error Processing WASM while following hello.cpp tutorial

I am following along the tutorial on the EOS website at https://developers.eos.io/eosio-home/docs/your-first-contract At the first smart contract development section, I cannot manage to publish the ...
1
vote
1answer
42 views

Is it possible to lock publish contract with set permission?

Is it possible to setup a lock (multisig) for the command cleos set contract ? in order to request one or more signatures to deploy a contract ? cleos set action permission eosio eosio set ...
1
vote
1answer
360 views

on_notify not being fired on local or jungle testnet

I'm using the following contract on both my local and jungle testnets, the on_notify methods are not being fired. Everything appears to be in order, I'm hoping I've missed something obvious. I ...
1
vote
1answer
247 views

How to convert a public key string to a eosio::publickey object inside a smart contract?

The smart contract takes a string as an input for the public key. I need to convert it into a public key object within the contract.
1
vote
1answer
119 views

Example of resource staking from contract

I'm looking for any relevant code example or documentation describing how to make contract stake resources for some account. I'm aware of delegatebw function of cleos however, I need the following ...
1
vote
1answer
36 views

Symbol stringification?

an action in my contract accepts an asset: void token::burn(asset a) which I want to print out: printf("Asset [%s] burnt\n", a.symbol.to_string()); except the symbol class does not offer ...

1
5 6
7
8 9
12