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

Is there a way to call a multisig approval programmatically from within a contract?

Following scenario: There's an action which requires 3 signatures - two are 'normal accounts' and the third one is like 'system or robot', which does some verifications from within the smart contract....
0
votes
1answer
40 views

How is memory aligned in the EOSIO smart contract consensus memory?

Are there any memory savings if I declare a table record that has, say, a 64-bit integer (occupies 8 bytes) and a 16-bit integer (occupies 2 bytes)? Or is it aligned at 64 bits and said record would ...
0
votes
1answer
57 views

How do I access a contract class variable from an extern “C” function “void apply()”?

In some scenarios, It's convenient to configure the conditions for monitoring some certain transactions by using this method extern "C" { void apply(uint64_t receiver, uint64_t code, uint64_t ...
0
votes
0answers
19 views

Can I deploy a contract from within a contract? [duplicate]

We can create accounts from contract code: https://github.com/angelol/smart_account_creator and we can query things about accounts: https://github.com/nsjames/Account-Has-Code is there a way to ...
2
votes
1answer
81 views

Is it possible to create new contract from another?

Ethereum has a opportunity to create new contract from another. Does eosio has the same? I found a code with new account creation, but I didn't find nothing about setting code and abi from contract.
0
votes
2answers
123 views

require_auth() not working as expected

I adapted the hello contract, expanding with require_auth() and added an additional account oliver that should be able to execute the action hashin on behalf of the contract owner doctest1. I adjusted ...
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 ...
5
votes
1answer
238 views

eosio.contract cannot compile with error code 1 of eosio.wasmsdk by Clion

We are compile the eosio.contract v1.2.0 using Clion by following that: Dependencies: eosio v1.1.2 eosio.wasmsdk v1.1.0 Cannot get compiler information: Compiler exited with error code 1: /usr/...
1
vote
2answers
79 views

Why actions can't have return values?

I can't understand why actions can't return values. A simple use case is for adding records in multi_index. I need to return the primary key to link that to my off-chain data.
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 ...
9
votes
2answers
562 views

Which version of C++ can I use in smart contracts?

Which version of C++ can I use to implement smart contracts? For example: C++11, C++14 or C++17? Do we have any constant or doc where it is defined? Also, in my understanding the code is sandboxed, ...
0
votes
1answer
46 views

Is there a library for encryption/decryption in EOS? [duplicate]

I want to perform some encryption on a given message, so I am wondering if there is a library that I can use in EOS? And I have checked the post Cryptographic Operations in Smart Contracts?, but the ...
3
votes
5answers
715 views

Cryptographic Operations in Smart Contracts?

Is it possible to perform cryptographic operations inside a smart contract? I'm specifically thinking about simple hashing (SHA-1/256/3) and symmetric encryption (AES). Obviously, handling key ...
1
vote
1answer
240 views

Broadcast Smart Contract 'Hello World' error

I am going through the eos tutorial but I got stuck at the contract broadcast. When I compile the contract with eosio-cpp -o hello.wasm hello.cpp --abigen the console seems to get stuck and I have ...
0
votes
1answer
53 views

Is there any API in EOS Smart Contract to decrypt message? [duplicate]

I would like to create a smart contract that would be able to decrypt some symmetrically encrypted message. Here is the scenario: Party "A" sends a message encrypted with key "123456" to ...
2
votes
3answers
220 views

How to detect an account is a contract account or not

I want to exclude all contract account to use my contract. How can I detect the account has deployed contract or not?
0
votes
1answer
55 views

Stake EOS and then unstake

Is there any documentation on staking or unstaking EOS using smart contracts? I basically want to provide an escrow service where the seller needs to stake the value of the item and the buyer stakes ...
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 ...
2
votes
1answer
141 views

How is a Ricardian Contract created? (file type, location, and naming convention)?

The Hello World tutorial defines a sample Ricardian Contract (abreviated snippet below): ## CONTRACT FOR HELLO WORLD ### Parameters Input parameters: NONE Implied parameters: * _**account_name**...
3
votes
1answer
76 views

Conditional behavior based upon auth

Imagine a contract that does not require_auth() but instead has conditional behavior depending upon which auth is present. if (<conditional that checks auth>) { // do stuff given auth from ...
5
votes
1answer
351 views

Require at least one auth from a set of auths

require_auth() asserts that a particular auth is present. How to write a contract that proceeds if and only if at least one of a set of auths is present?
4
votes
2answers
1k views

How to get current time in different versions of EOSIO

Depending on which version of EOSIO you use, there are different options available for finding the current time. What are they?
0
votes
3answers
367 views

Custom dispatcher new CDT

I'm having compilation issues when creating a custom dispatcher. I'm getting issues when calling EOSIO_DISPATCH. Is it related to changes in new CDT? class [[eosio::contract("mycontract")]] ...
3
votes
1answer
151 views

How do I set my smart-contract / account to “immutable”?

What's the correct cleos command to yield the active/owner permissions of a deployed contract to "eosio.code", exclusively?
0
votes
2answers
166 views

Multi_index issues

I'm getting a lot of errors related to multi_index after updating to the newest eosio.cdt. Here is part of my code related to hash. struct st_hash { capi_checksum256 hash; uint64_t expiration; ...
2
votes
2answers
433 views

How can I know if I pay ram for a row in a table?

I am creating a non-fungible token. While I own the token, I pay ram for it. After transfer of the token the new owner should pay for it. My token contract updates the payer as soon as the new owner ...
0
votes
2answers
878 views

Convert string to float or double

I am trying to convert a string to a float or double, however none of the standard C/C++ methods seem to work. I have tried: atof strtof strtod sscanf In each case, I get an error message when ...
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 ...
2
votes
1answer
274 views

how to solve Error Details: Cannot charge RAM to other accounts during notify on testnet

I need help for an issue developing an EOS dapp. I want to call a contract function when someone transfer EOS to my contract. For this i used the apply method to call the function upon any transfer ...
2
votes
1answer
86 views

How to have real-time communication in dapp?

How would a real-time 1v1 game work on the EOS Blockchain? I've noticed that many of the games/gambling dapps on EOS are mostly player vs. blockchain, like EOSBet. Could I have real-time updates to ...
0
votes
1answer
377 views

no member named 'print' in 'std::__1::basic_string<char>'

if I declare a string and attempt to print it like this: std::string s; eosio::print(s); the EOS compiler pukes: In file included from t.cpp:1: In file included from ./t.hpp:4: In file included ...
1
vote
0answers
35 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 ( ...
2
votes
2answers
115 views

How to avoid cpu usage limits

Task Compute some fields for all table rows when action called contract::priceupdate(price) Input data: Table with 10000 rows Problem Cpu limit 30ms so i cant update whole table in 1 transaction ...
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 ...
0
votes
1answer
126 views

Passing the action name having return type to EOSIO_DISPATCH in EOSIO smart contract

I have following EOSIO smart contract: #include <eosiolib/eosio.hpp> #include <eosiolib/print.hpp> using namespace eosio; class random : public contract { public: using contract::...
28
votes
3answers
529 views

Is there a standard for naming and formatting that EOS projects should follow / EOS C++ coding style?

Coming from other C++ projects like Unreal Engine I was surprised to see coding standards in the EOS codebase is all lowercase, not only for variables but even for class names. Is there any resource ...
6
votes
1answer
1k views

How to get my contract balance in my smart contract? [duplicate]

I have copy the account struct from the smart contract eosio.token into my own contract and typedef multi_index like this: //@abi table accounts i64 struct account { asset balance; uint64_t ...
5
votes
3answers
758 views

How can I get my contract currency balance with c++ code?

I want to get my contract currency balance within my contract code, but the eosio::account::get (account_balance &acnt) cann't use, so how can I do that?
2
votes
0answers
89 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(...
0
votes
1answer
36 views

Can a contract know the creation date of accounts?

Is the creation date of accounts part of consensus? Can I query it within contracts? If so, how to do it?
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 ...
3
votes
1answer
210 views

Error message: Exceeded call depth maximum

I am writing a smart contract and I am receiving this error message: Error 3070002: Runtime error processing WASM Error details: Exceeded call depth maximum I am confused, since I believe this ...
3
votes
1answer
371 views

EOS signatures vs Ethereum signatures

So I'm trying to find a way to sign a message with a certain private key, and then to be able to recover it's corresponding public key/address on both Ethereum and EOS. The thing is I'm having some ...
0
votes
1answer
439 views

How to list all balances of tokens managed by an eosio.token contract?

Let's say I have deployed the standard eosio.token contract to an account called "myeosiotoken," and I have used it to create an "ABC" token. Then, I issue 1,000 ABC to "someaccount1" and 2,000 ABC to ...
3
votes
1answer
52 views

Is it possible to use multi_index on property of a struct in a struct?

can i use the id of a struct in an other struct as return value for multi_index? like: //@abi table test i64 struct st_test{ uint64_t id; string name; uint64_t primary_key() const {return ...
2
votes
1answer
42 views

How to publish an auditable EOS Smart Contract in a trustless way?

In Ethereum every smart contract is public. This can obviously have downsides, but an important upside is the auditability and trustworthiness of contracts. In EOS by default contracts are NOT public. ...
2
votes
1answer
135 views

About Updation of contract

I have 2 questions about updation of contract and multi-indexed tables? 1)Can i update contract as if i want to change ram payer for multi indexed tables can i change it after deploying contract ? ...
7
votes
1answer
127 views

Using “native” wat/wasm function in smart-contract

I have to do some heavy computation in my smart-contract, like say a+b. Fortunately, I have written some very efficient implementation in "native" (web)assembly, like: File add.wast: (module (func ...
0
votes
1answer
89 views

How to deploy a contract to api-kylin.eosasia.one testnet

I have written a helloworld contract and got compiled that successfully thomsonim123 is my kylin testnet account with some EOS when I want to deploy the contracct to the testnet I get few errors. ...

1
5 6
7
8 9
12