Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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

1
vote
0answers
11 views

How to get a contract to accept tokens as payment

I keep getting the following error: transaction declares authority '{"actor":"test2","permission":"active"}', but does not have signatures for it under a provided delay of 0 ms, provided permissions [...
0
votes
0answers
6 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
1answer
40 views

Transfer tokens inside a smart contract from an account to another account

I need to write a simple function that would send tokens using a different account action. Exactly the same situation as in these questions: one and two But I have to use not eosio.token contract but ...
1
vote
1answer
19 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 ...
2
votes
1answer
36 views

What is the meaning of “scope” in a Smart Contract?

Since I have read the tutorial. I don't understanding the following: Note that scopes are used to logically separate tables within a multi-index (see the eosio.token contract multi-index for an ...
0
votes
2answers
21 views

Can not find `eosio/eosio.hpp` while compiling with eosio-cpp

I used the documentation provided by EOSI. I made all the required installation as suggested in the docs. While writing the hello world contract, I face this issue when running the following command ...
2
votes
0answers
32 views

How to debug eosio::on_notify(“eosio.token::transfer”) actions?

I'm working on a contract that will run an action when receiving tokens. The following code does not run when the account receives EOS or JUNGLE tokens on the Jungle Testnet. #include "./test.hpp" .....
1
vote
1answer
27 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 ...
0
votes
1answer
18 views

Can I use Timers?

I know that there's no timer in other smart contracts and even this is not possible in regular blockchains. But, EOS uses C++, and they already did lots stuffs which makes smart contracts more usable. ...
0
votes
0answers
19 views

How large should the 'secrets' be when doing random number generation on a smart contract?

I am trying to implement an RNG system like the following, with the hash as a SHA-1 function: Randomness without risk of anyone "knowing" it requires a three step process: both parties ...
0
votes
1answer
21 views

eosio-cpp command not found error?

When I am trying to run hello world smart contract using a command eosio-cpp -abigen -o hello.wasm hello.cpp shown an error eosio-cpp: command not found?
0
votes
1answer
30 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....
1
vote
2answers
55 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 (...
0
votes
1answer
21 views

EOS Token contract audit issue

My token contract was done by a third party vendor that did not share source code of the token contract with me. Can you help me on how to find the code, so that I can submit it to you for audit ...
0
votes
1answer
60 views

Why is [[eosio::on_notify(“eosio.token::transfer”)]] not working?

Network: kylin testnet. I transferred eos to this contract, but it the "deposit" function was not called. What do I miss?
0
votes
1answer
21 views

Acting on upon a receipt of a token, using v1.6 c++ libraries

Let's say I wanted to act upon receipt of a token and/or a message to a smart contract. Previous versions of EOS used the apply function to do this, however as of v1.6 things have changed to pure cpp ...
0
votes
0answers
15 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
25 views

Using find on multi index table

I have a table defined as the following: struct [[ eosio::table, eosio::contract("voting") ]] identity { uint64_t key; key256 identityHash; time_point_sec createdAt; uint64_t ...
1
vote
0answers
18 views

Get symbol & contract from asset

I currently have an asset property that stores a value, i.e. 100 EOS which could also be another token like 100 TLOS. Is there a way to extract the symbol and possibly the token contract from that ...
3
votes
1answer
25 views

What are the advantages and disadvantages of using multiple smartcontracts?

I have noticed many EOS contract programmers choose to have a token contract and a seperate smart contract for other things to do with those tokens. What are the advantages and disadvantages to this ...
0
votes
1answer
21 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; ...
1
vote
1answer
68 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 ...
0
votes
0answers
12 views

Is there an EOS-equivalent for the ERC-1404-Standard?

I recently saw a Video about the erc1404-standard and read some articles about it. I think It's an interesting standard for security-tokens and international regulatory requirements. Is there an ...
0
votes
0answers
10 views

What's the difference between “using contract::contract” and define your own constructor function when designing a eos smart contract?

I got this piece of codes from https://developers.eos.io/eosio-cpp/docs/using-multi-index-tables Here, something confused me, 1. what does this "using contract::contract" mean ? in cpp ,this means ...
1
vote
2answers
37 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
21 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
27 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 ...
2
votes
0answers
38 views

Ricardian Contract

Does eosio also sign the transaction with ricardian contract of user consent or/and how application can proof the validity that a party agree on said ricardian contract? I have integrated the ...
0
votes
1answer
19 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
15 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
59 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.
1
vote
1answer
32 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 ...
2
votes
0answers
50 views

CPU-Usage Optimization

I'm trying to figure out how to optimize one of my smart contracts for less billed CPU-usage. There are typically different methods to optimize performance of algorithms but I'm not clear about if a ...
2
votes
0answers
27 views

Why does using available_primary_key() as scope for a table result in this behaviour?

Scenario: Two tables, each using uint64_t as a primary key Table A rows need to reference rows in Table B Why? Relational database data duplication reasoning etc etc Both table's primary keys are ...
1
vote
2answers
35 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
127 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
34 views

Duplicate symbol WASM compilation error when using header/hpp for contract

I'm looking to use a hpp file as an interface for multiple contracts. I've created a test contract and receiving a WASM compilation error. I based the test contract on the format used by eosio.token....
0
votes
1answer
21 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 ...
0
votes
1answer
21 views

Smart contract - find on two columns

I am currently writing a blog PoC on EOS. I would like the ability to delete a post. Now deleting by the ID alone is simple, I have it implemented as follows: whisper::post_index posts(_code, _code....
0
votes
1answer
25 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
24 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 ...
0
votes
1answer
30 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 ...
0
votes
0answers
13 views

Eclipse IDE configuration

I am using Eclipse IDE for EOS smart contract development. I followed https://developers.eos.io/eosio-cpp/docs/ide-configuration but unfortunately, I have many false positives spotted by Eclipse. Any ...
1
vote
1answer
59 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
2answers
30 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 ...
2
votes
0answers
74 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 ...
3
votes
1answer
160 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 ...
0
votes
2answers
65 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 ...
4
votes
2answers
202 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?
2
votes
1answer
124 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::...