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
0
votes
2answers
166 views

How to get list of active smart-contracts on EOS

It appears cleos has no way of returning a list of active smart-contracts. Is there another way?
2
votes
3answers
342 views

Need to perform automatic smart contract function execution

Can we have a function in a smart contract to be executed automatically after some time? for example, transfer some tokens after every 5 seconds.
4
votes
2answers
284 views

Is there a sample code of how to link EOS with IPFS for data storage?

Let's say I am making a todo list smart contract or do I even need a smart contract for this? I want to be able to store the todo list items on IPFS storage file. Is there an example of how this can ...
2
votes
1answer
76 views

static_assert failed "Types with user specified constructors (non-aggregate initializable types) are not supported

I am writing a smart contract for use with the EOSIO system contract, and am receiving this error message multiple times when I try to compile the code. I have checked my constructors and they are ...
2
votes
1answer
140 views

Constructor error message

I am writing a smart contract for use within the EOSIO system contract. I am receiving this error message multiple times: constructor for 'eosio::multi_index<13510798882111488, BP>::item' must ...
6
votes
3answers
1k views

When to use or not use the Contract Scope?

Analyzing the eosio.token contract we see that the token stats is stored under the SYM scope. So if I want to read a token stat, like supply, I need to execute: cleos get table eosio.token EOS stats ...
9
votes
1answer
110 views

Issue a transaction on a foreign blockchain

What is the correct way to send a transaction to the bitcoin blockchain from an EOS smart contract. Can anyone provide a code example ?
5
votes
1answer
192 views

eosio multisig exec problem

For multisig transaction, 1. Firstly I have created two accounts(partner1 and partner2) with same key(EOS....HoCF) cleos create account eosio partner1 EOS8FE********HoCF cleos create account ...
1
vote
1answer
70 views

Makefile Compiler Error

I have been using this tutorial from Medium to build my first smart contract. I've come far, finally got a nodeos local node up and running and producing blocks on my Ubuntu VM. I've hit a snag though ...
3
votes
4answers
761 views

How to add "time lock" to the EOS tokens

I have issued some tokens base on eosio.token in jungle testnet, and I am able to transfer the tokens between accounts. Now if I want to enforce some control to the tokens sent ( for example, time ...
6
votes
3answers
932 views

Why the first time I execute an action I get "Error 3080006: transaction took too long"?

WHAT I WANT Call an action and see it succeed at the first execution. WHAT IS NOT WORKING The function, which I am executing, the first time fails with error: Error 3080006: Transaction took too long ...
2
votes
1answer
214 views

Multi-index table logic

I'm new to smart contracts and I'm having difficulty understanding the logic behind instantiating multi-index tables and how they persist. For example in the addressbook example, it seems a new ...
2
votes
2answers
788 views

How can I find the code of Smart Contract on a EOS account?

Maybe a basic question, but how can I find the code of Smart Contract on a EOS account? For example the code on https://eosflare.io/account/betdicelucky ? I need this to audit if I can trust the code ...
7
votes
2answers
1k views

What's the difference between `asset` and `extended_asset`?

tl;dr: I just wanted to reuse a "token currency type" with symbol and precisions validations out-of-the-box. If I’m implementing “token” currency in my contracts, which one should I use? I’m just ...
3
votes
2answers
426 views

Is it possible to use a type other than uint64_t for a table primary key?

I want to use a uint128_t as a primary key in a multi_index table. Is this possible? If so, how should the ABI file be written to accomodate it?
1
vote
0answers
95 views

How to solve !action_type.empty(): Unknown action hi in contract hello?

I am following this doc: https://developers.eos.io/eosio-home/docs/your-first-contract. This is the hello.cpp contract code which is successfully deployed: #include <eosiolib/eosio.hpp> #...
3
votes
1answer
428 views

Example Smart Contract for Staking and Unstaking your own Token

I'm searching for an example Smart Contract snippet for staking and unstaking a token, for example how KARMA / POKER / DICE are working. If I stake the token, I'm able to collect dividends. If I ...
2
votes
1answer
47 views

Can one provably disable user-initiated transfers from an account?

In this scenario a deployed smart contract should have and retain full control of the funds (excluding BPs of course) on the account. How can one stop transfers from an account by the account owner? ...
1
vote
2answers
434 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
134 views

In the eosio.token contract, why are the structs private?

In my contract, I'd like to be able to check how much EOS an account has. For that, I'd write some C++ code like this: token::accounts the_table("eosio.token"_n, "useraccount1"_n.value); auto it = ...
1
vote
0answers
89 views

How to format string in a contract [closed]

I'm trying to format string using boost library, but EOS gives error <atomic> is not supported on this single threaded system. But, as for me, boost format is the most convenient solution. ...
1
vote
2answers
159 views

Divide funds by % to send to different wallets

I need a contract that can send funds at 1 time to multiple addresses by percentage. Ex: n disbursements 1@ 20% Another - 14% Another - x% Another - x% and so on. Ethereum does NOT have this ...
1
vote
1answer
49 views

Why don't need ram_payer for erase method in mulit_index class?

mulit_index class has three methods (emplace, modify, erase) to update a table. emplace and modify methods need to select ram_payer. But erase method doesn't need to select it. I think these methods ...
3
votes
1answer
166 views

Storing the data in "Memo" of block chain transaction

Can I store large size of data such as MP3 in Memo? Are there any implementation examples? To store the data or any comments in Memo, should I send some amount of EOS? Can I store the data without ...
1
vote
0answers
46 views

how to use singleton in eos contract? no member named 'get_or_default' [duplicate]

no member named 'get_or_default' #include <eosiolib/singleton.hpp> struct [[eosio::table]] glo { uint64_t key; uint32_t stamp; EOSLIB_SERIALIZE(glo, (key)(stamp)) }; typedef eosio:...
3
votes
2answers
599 views

How to audit an eos smart contract

In Ethereum it is very easy to audit a smart contract as its source is posted in the blockchain. In EOS, the generated web assembly code is published. In this case, how can we check if the published ...
8
votes
2answers
1k views

How to convert public key string to char[34] inside contract?

I need a way to convert a public key string (e.g. "EOS8KgkQikWK84J2jJ1Nvd3ttfJNRicYZsdbunbe9biR99dHGb24a") into a struct public_key { char[34]; } inside of a contract. The char[34] seems to be ...
1
vote
0answers
259 views

Using recover_key with eosjs

I want to validate user signatures in my smart contract. As I understood, I am supposed to do that with recover_key function from crypto.h I am using JavaScript with eosjs and eosjs-ecc for ...
3
votes
3answers
602 views

How to update contract that has already been published to nodeos?

I published a contract to my localnet using: cleos set contract myaccount mycontractfolder -p myaccount Then I made some updates to the code, and want to publish them, I type the same command again, ...
3
votes
1answer
348 views

How can multisig trigger an action in contract other than eosio.token contract?

Other than eosio.token contract how can we call the inline actions in contract from multisig contract. For example, I have a contracts namely mltisigmetup(with action meetup). Now I need a ...
1
vote
1answer
76 views

Private Transactions inside Smart Contract

Is there a way to make some transactions private inside a smart contract? It's needed for a game theoretic model. Like imagine poker on blockchain: you'd like not to reveal cards until some point in ...
2
votes
1answer
618 views

How can I convert a uint128_t to a string?

I am using a uint128_t as an id type for a contract I am working on. For a certain check, I need to convert this variable to a string so I can check for it in another table (whose type cannot be ...
4
votes
2answers
980 views

How to get transaction logs from EOS?

Suppose I have a dapp that monitors transaction of some assets. The smart contract would be generating transactions and I'd get messages like "executed transaction: ...
6
votes
3answers
1k views

Is there event emitting function in smart contract?

I am porting Ethereum smart contract in Solidity to EOS platform, but I meet a problem: how to send some events to Dapp so as to update the UI? Now I have to poll the table the smart contract saved ...
2
votes
1answer
224 views

How do trade eosio token and other token (NFT) in contract?

I'm trying to develop NFT's contract with reference to unicoeos/eosio.nft. Also I'm trying to develop NFT's shop contract in order to trade NFT and eosio.token. The logic trading NFT and eosio....
1
vote
1answer
168 views

mutable globals cannot be imported: globalImport.type.isMutable

I compile hello.cpp in the examples folder in eosio.cdt version1.3.1, which has a lot of updates compares to version 1.2.X. then completely follow the smart contracts tutorials in https://developers....
1
vote
1answer
59 views

Tutorial on how to load up your own ERC20 EOS token using a template contract.

I have the following template contract: https://github.com/EOSIO/eos/tree/master/contracts/eosio.token Is there a step by step tutorial on what I need to do to load up my own token? What are the ...
1
vote
1answer
61 views

What are the main pros / cons for smart contract development on EOS vs Ethereum smart contracts? [closed]

What are the pros and cons when doing smart contract development when coming from Ethereum? How does one differ in strength and weakness?
1
vote
2answers
628 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 ...
2
votes
1answer
151 views

Is it possible to compile EOS contract with out 'make install' of EOSIO?

building eosio source needs pretty high resource, so I want to deploy with out build eosio source. or at least I want to compile it with out "make install". could it be possible?
3
votes
1answer
365 views

How the IBC works exactly?

I am curious about how to transfer tokens between two chains. As I understand I need two smart contracts on different chains and a process of transfering tokens to the second chain will look like this:...
3
votes
1answer
414 views

Why smart contract function fails with "Error 3090004: Missing required authority"?

WHAT I WANT From the contract mycontract I want to call a function function1. The function function1 calls another function of mycontract called function2. The function function2 calls an action of ...
1
vote
0answers
40 views

How to make real time my contract transition history

I want to make real time my contract transition history,Do I have to learn what components of EOS blockchain?
1
vote
1answer
210 views

multi_index in eos with AddressBook example

I building AddressBook by link https://developers.eos.io/eosio-home/docs/data-persistence, Dependencies: EOSIO.CDT (Contract Development Toolkit) Version : 1.3.1 Here is my code: #include &...
1
vote
0answers
61 views

How can i prevent another contract call my contract's method?

how can i prevent another contract call my deployed contract? Or how can i know that the caller is an eos account with contract or not. Thanks.
1
vote
1answer
184 views

Hello contract: How do i execute "hi" action when notified by eosio.token contract of an EOS transfer?

I want to extend the Hello contract (as an exercise) How do i execute "hi" action when notified by eosio.token contract of an EOS transfer ? I understood i have to extend EOSIO_ABI macro to handle ...
1
vote
1answer
33 views

About authorities

On eosio.token.cpp, there are transfer function with require_auth(from). So executing this contact needa "from" active permission. For some reason, I change require_auth parameter from "from" to "...
1
vote
1answer
377 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 ...
8
votes
2answers
688 views

Encrypting with a public key

I have user specific data in a table on my smart contract that I don't want others to see. Can I encrypt that data with a public key of the user? If possible then how to encrypt that data with the ...
1
vote
0answers
39 views

EOS smart contract upgrading/recompiling, variables and symbol mappings

EOS allows to reset the contract code payload, unlike some other blockchains: https://www.reddit.com/r/eos/comments/91aqjx/how_many_contracts_can_an_account_have_on_the_eos/e2ww4la/ How the code ...

1
7 8
9
10 11
13