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
0 answers
36 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 ...
Tachyon's user avatar
  • 131
0 votes
1 answer
82 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 ...
Capacytron's user avatar
1 vote
1 answer
288 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 ...
Techbro965's user avatar
0 votes
2 answers
79 views

Transaction took too long while using std::shuffle

Get the error when I push a action on my contract on the local testnet: But if I remove this code from the action I called, there is no problem: class urng: Does anyone know what caused this?I just ...
Lich's user avatar
  • 3
5 votes
1 answer
580 views

What could be the reason for 'Error 3050008: Abort Called'

I'm getting the following error without any further description. What could be the issue for that? I'm performing some binary arithmetics when calling this action, are there any known problems with ...
cmadh's user avatar
  • 1,929
6 votes
2 answers
2k views

How to use checksum256 secondary index to get table rows

Does anyone know the correct way to get table rows using checksum256 (fixed_bytes<32>) secondary index through the get_table_rows RPC API? I found a way using key256, but key256 is deprecated ...
m0t0k1ch1's user avatar
0 votes
2 answers
178 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 ...
mikem's user avatar
  • 1
5 votes
2 answers
2k 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?
Phillip Hamnett - EOS42's user avatar
2 votes
2 answers
696 views

Make a transfer inline

I would like to send SYS token owned by the smart contract account to a third party account when anyone call a specific action. I have tried the following code but I am getting an error: [[eosio::...
poiuytrez's user avatar
  • 165
3 votes
1 answer
197 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?
Fabiana Cecin's user avatar
1 vote
1 answer
86 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 = ...
nakomis's user avatar
  • 23
1 vote
1 answer
332 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.
sulo's user avatar
  • 11
0 votes
3 answers
413 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")]] ...
koukotsu's user avatar
  • 121
0 votes
2 answers
217 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; ...
koukotsu's user avatar
  • 121
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 ...
mashup's user avatar
  • 155
2 votes
1 answer
167 views

Issue while compiling smart contract - eosio.cdt

I have installed eosio.cdt in Ubuntu system by using commands from EOS Developers Portal wget https://github.com/EOSIO/eosio.cdt/releases/download/v1.4.1/eosio.cdt-1.4.1.x86_64.deb sudo apt install ./...
Muhzin's user avatar
  • 510
1 vote
2 answers
132 views

What can prevent one from changing contract code?

I find one major characteristic of EOSIO is that the smart contract code is interchangeable, so that developers can easily fix any bugs or change its logic. But what if someone changes the code to ...
Jinu's user avatar
  • 210
1 vote
0 answers
51 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 ( ...
yiqi chen's user avatar
2 votes
1 answer
97 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 ...
Taner Seytgaziyev's user avatar
4 votes
2 answers
249 views

Require authorization with conditions require_auth(name1 OR name2)

Is there any possibility to implement conditional require_auth(<condition>) or what is a good practice to make contract accept invocations from a set of predetermined accounts? Is there any ...
Dexaran's user avatar
  • 53
2 votes
2 answers
98 views

Is there a way to prevent me spending tokens until an action is called?

I am creating a smart contract but came to a halt when writing the code. Is there a way, in a smart contract, to prevent me from spending tokens transferred to me by another user through the smart ...
Oxyi's user avatar
  • 21
2 votes
2 answers
136 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 ...
v.tsurka's user avatar
  • 123
0 votes
1 answer
176 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::...
Varsh's user avatar
  • 307
1 vote
1 answer
148 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 ...
Dexaran's user avatar
  • 53
3 votes
1 answer
309 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 ...
simba's user avatar
  • 51
2 votes
0 answers
117 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(...
Fabiana Cecin's user avatar
0 votes
1 answer
46 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?
Fabiana Cecin's user avatar
0 votes
1 answer
607 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 ...
Fabiana Cecin's user avatar
1 vote
1 answer
140 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 ...
Fabiana Cecin's user avatar
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","...
Thomson Ignesious's user avatar
0 votes
1 answer
110 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. ...
Thomson Ignesious's user avatar
0 votes
1 answer
82 views

Is it possible to overload contract actions?

I had a method: -- t.hpp -- [[eosio::action]] void exchange(); -- t.cpp -- void token::exchange() { ... } EOSIO_DISPATCH(eosio::token, (exchange)) and then decided that if a parameter were ...
ekkis's user avatar
  • 515
1 vote
1 answer
509 views

Authorisation failure with deferred transaction

I have a contract action that does some cleanup: void token::cleanup() { ... } that I want to run asynchronously from another action like this: schedule("cleanup", 10). my scheduling method looks ...
ekkis's user avatar
  • 515
0 votes
0 answers
86 views

Exception Details: 3080006 deadline_exception: Transaction took too long

I'm getting this error and have read all there is to read on the net (which isn't much) about it. mostly I see others complaining about this error when they run an action for the first time in my ...
ekkis's user avatar
  • 515
0 votes
2 answers
376 views

Erasing records with for loops

if I want to erase a table: orderbook b(_self, _self.value); auto m = b.get_index<name("idxprod")>(); for (auto &i : m) { m.erase(i); } I get the error: Error 3160005: The table ...
ekkis's user avatar
  • 515
4 votes
1 answer
354 views

How to sort a table?

I'm following this explanation https://developers.eos.io/eosio-cpp/v1.1.0/docs/multi-index-table-tutorial using v1.5.0 of the CDT. Here's what I've got: struct [[eosio::table]] order_struct { ...
ekkis's user avatar
  • 515
1 vote
1 answer
40 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 ...
ekkis's user avatar
  • 515
1 vote
2 answers
57 views

Is there a way to check the histroy of a contract's table?

Is there a way to check the history after deleting the information in the table? For example, check yesterday's table information.
Taby's user avatar
  • 23
0 votes
2 answers
86 views

Asset instantiation woes

if I declare an asset: asset a(10, symbol("TST", 0); and I print it: a.print(); I get pretty much what I'd expect: TST the format's not quite right (10 TST would have been better), but ...
ekkis's user avatar
  • 515
1 vote
1 answer
121 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"); ...
ekkis's user avatar
  • 515
0 votes
1 answer
1k 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 ...
ekkis's user avatar
  • 515
1 vote
2 answers
170 views

Passing a string to an action?

I have an action that needs to operate on a string: void token::MyAction(std::string key); so I would expect I can make the call like this: cleos push action MyAccount MyAction '["burn"]' -p ...
ekkis's user avatar
  • 515
0 votes
2 answers
51 views

Referring to permissioned account within contract code?

I've created a table within a contract where I want to store user information. the .emplace() method's first parameter specifies the "scope" (I guess) for data to be stored and thus the user account ...
ekkis's user avatar
  • 515
0 votes
1 answer
107 views

delay_sec is not accurate for deferred transaction

I have set some seconds but sometimes it is delayed more than 10 minutes. I know that delay_sec is not the accurate time because of the block production mechanism. The real time is much later than it ...
crax's user avatar
  • 111
1 vote
2 answers
47 views

Error about billed CPU time when set Hello World Smart Contract

My VM Spec (VMWare ESXI) CPU : Xeon CPU E5-2620 v2 @ 2.10GHz Memory : 8GB HDD : 70GB EOS 1.5.3 , EOS.CDT 1.4.1 Compile from Source Code with AutoBuild Scripts. I try to create first smart contract ...
Chanwit Chonsuwanwat's user avatar
0 votes
1 answer
196 views

EOSIO: name.value secondary index returns end iterator, even though searched value exists in table

I've got a multi-index table going with two secondary indices: TABLE entry { uint64_t id = 0; eosio::name player; std::vector<uint16_t> allocation; ...
bitgenstein's user avatar
1 vote
1 answer
103 views

Can a deferred transaction make the initial transaction fail

Imagine a user sending me some eosio.token to my contract and when I receive the notification, I start a new deferred transaction that fails later. Can the deferred transaction make the initial ...
rawinput's user avatar
2 votes
1 answer
105 views

Multiple Inheritance within ABI files

I have various classes that use multiple inheritance, i.e.: class A { }; class B { }; class C : public A, public B { }; Single inheritance in an ABI file is possible using the base layer as ...
Phillip Hamnett - EOS42's user avatar
0 votes
2 answers
302 views

Best way to read data from contract using eosjs or Cleos

How you read the data from your contracts, just by using actions? Or there is another way? Thanks!
Kristian's user avatar
  • 121
2 votes
3 answers
111 views

Updating existing token contract code

I have deployed a token on main net and called the create method to issue tokens. However, I would like to update the token code to add an extra feature. I can't find any information on the best ...
koukotsu's user avatar
  • 121

1
3 4
5
6 7
13