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
2
votes
3answers
640 views

How to specify a `uint128_t` literal in the code?

I'm trying to store really large value to a table in field uint128_t, but I get this "integer literal is too large to be represented in any integer type" error when trying to compile. When i ...
2
votes
1answer
646 views

Is it possible to create new account in SmartContract?

we can create new account using cleos . cleos system newaccount <myacount> <newaccount> <new EOS Public key> <new EOS Public key> --stake-net "0.1 EOS" --stake-cpu "0.1 EOS" -...
2
votes
1answer
73 views

Can a smart contract bill the RAM storage to another smart contract?

I know that you can bill another user for storage but what if i want to bill another smart contract which in turn will then bill its users. Is it possible?
2
votes
1answer
252 views

Do I get RAM back after deploying a contract?

Deploying a contract uses RAM. If I deploy a contract, am I going to get the RAM back? In not, is there any other way to get it back? EDIT, ANSWER, YES: Just re-deploy another contract instead, that ...
2
votes
1answer
270 views

B1 has voting limited by "time since 1st June". Can they abuse it using eosio.token transfer?

Going through eosio.system contract, I've noticed following lines, that limit Block.one EOSIO voting power by time: void validate_b1_vesting( int64_t stake ) { const int64_t base_time = 1527811200; ...
2
votes
2answers
123 views

How to emit specific messages after action is executed?

In solidity, we can emit many type messages when transaction finished, but in eos, I did't find it. I see the require_receipt api to notify the listeners the action but not the action result. Anyone ...
2
votes
1answer
229 views

set contract error

I tried to set contract with the promotion account, but kept getting this error: cleos set contract promotion car_promotion -p promotion Reading WAST/WASM from car_promotion/car_promotion.wasm... ...
2
votes
1answer
405 views

Example of smart contract action that itself executes a transaction

Can anyone point me to example code for writing a smart contract that calls actions on other smart contracts? The general method of doing this is documented here but example code is not provided.
2
votes
1answer
20 views

cleos push action is not working on multihost peer node

I have a setup of multinode, one genesis node and another host node inita connected to the genesis node. Nodeos is running on both hosts. Genesis node is producing blocks and inita is receiving them. ...
2
votes
1answer
261 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 ...
2
votes
3answers
83 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 ...
2
votes
1answer
347 views

Using name as secondary index

I want to save name in table, and to search by it. It doesn't seems that it is possible to have secondary index with type name for some reason. I would like also to pass name in function and to have ...
2
votes
1answer
288 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
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 ...
2
votes
2answers
235 views

unpack_action_data for transfer in newer CDT version

in the newer version of CDT, currency is removed from eoslib. Therefore, for unpack_action_data<currency::transfer>(), what value should substitute currency::transfer?
2
votes
2answers
779 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 ...
2
votes
3answers
223 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?
2
votes
1answer
440 views

How can I send or store an arbitrary text message to another EOS account?

I wan't to be able to send a text string to another EOS account. How can this be done? Are there any mobile wallets that support this?
2
votes
1answer
375 views

Receiving EOS tokens in the contract's action

I am working on a DAPP which requires users to pay a small amount of EOS in order to participate in the DAPP. In ethereum, every transaction has msg.value which specifies the amount of ether in the ...
2
votes
2answers
760 views

eosio-cpp: command not found

Is there an alias or PATH that we need to set for eosio-cpp to be accessible? Here's what I'm seeing: ~/eos/contracts/youvote $ eosio-cpp --help eosio-cpp: command not found I can access it via: ~/...
2
votes
1answer
23 views

Can an object of the class 'contract' or a class that inherits 'contract' be created in the cpp file of the contract we are making?

Can an object of the class 'contract' or a class that inherits 'contract' be created in the cpp file of the contract we are making?
2
votes
2answers
443 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 ...
2
votes
2answers
708 views

Does EOS VM support solidity?

EOS smart contracts are writeen in c++, but does EOS VM also support (Ethereum's) solidity?
2
votes
1answer
230 views

Set a contract containing deferred transaction from front-end

I am trying to figure out the way to set contract which has deferred transactions at run time from front-end. Is it even doable? Any suggestions would be appreciated.
2
votes
1answer
50 views

Can you create a smart contract with a smart contract?

I know that you can create a new account but I am not sure if this can be done
2
votes
1answer
796 views

sha256 in function returns two different checksums and checksums don't change

i have two functions in which i calculate the checksume of a string. The first Problem is, i can change numa and numb as i want i always get the same checksume. It is as the string is not used. The ...
2
votes
1answer
157 views

Analogy to solidity msg.sender and address [duplicate]

what are alternatives in EOS to solidity address and msg.sender? for address is it account_name or? Cheers
2
votes
2answers
996 views

Can not find <eosiolib/eosio.hpp> when compiling with eosiocpp

I am trying to compile the Hello World Tutorial, using the following command: eosiocpp -o hello.wast hello.cpp However, this does not work, giving the error: hello.cpp:1:10: fatal error: 'eosiolib/...
2
votes
2answers
393 views

Can contract reject the token transfer?

If somebody transfer eos to my contract, can my contract reject the transfer? In ethereum, it seems that the contract can throw an exception to reject the transfer.
2
votes
2answers
1k views

Work around or disable CPU usage limit

In a private testing environment I've got a single nodeos instance. In case it is an important detail, note that the instance is not running the eosio.system contract. One of my own contracts is ...
2
votes
3answers
1k views

Listen for transaction to smart contract account

How can i set up a listener to handle deposits to my smart contract Related to this question: How to do an action in a contract to transfer tokens to other user accounts without adding permission in ...
2
votes
1answer
128 views

How to prevent cheating in a turn-based-game on blockchain?

I want to create game where p1 and p2 take actions in turns but neither p1 nor p2 should be able to see the action, the other is doing till the end of the game. If I would do it like in a normal Web-...
2
votes
2answers
154 views

Can a malicious contract consume users' ram?

Can an evil contract fill users' ram with junk data?
2
votes
1answer
99 views

EOS system contract is too large to execute in local machine!

When I set the eos system contract with mainnet-v1.0.3, it always give me a error, that the transaction is too long and give me the belong error {"now":"2018-06-14T08:16:44.376", "deadline":"2018-06-...
2
votes
1answer
1k views

require_auth differs from the auth check of INLINE_ACTION_SENDER but how?

In a contract action I've got the following: require_auth(from); // NOTICE THIS LINE... INLINE_ACTION_SENDER(contract, transfer)( N(contract), {from, N(active)}, // ... AND THIS LINE. {...
2
votes
1answer
190 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
1answer
153 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 ./...
2
votes
1answer
89 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 ...
2
votes
1answer
96 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 ...
2
votes
1answer
162 views

Fixing a smart contract written in old version of eosio.cdt

I am using Ubuntu 18.04 LTS first of all. So I am trying to look up how to start building an EOS dApp, starting with this example on Github. Here is the link: https://github.com/eosasia/eos-todo I ...
2
votes
3answers
241 views

Can I use uint256_t in EOS smart contracts?

I want to use uint256_t in my EOS smart contract but I am getting following error unknown type name 'uint256_t'; did you mean 'uint16_t'? I thought EOS supports uint256_t as I read it in some EOS ...
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? ...
2
votes
1answer
63 views

How to auth the issue permission to another contract?

I created a token "ABC" from account "tokenabc" and deployed a airdrop contract "airdroptoken". And I hope that everyone who transfers EOS token to this contract will get some airdrop token "ABC". ...
2
votes
1answer
137 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 ? ...
2
votes
1answer
44 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
150 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?
2
votes
1answer
266 views

Samples with eosio.cdt v1.3.0? multi_index with secondary indexes and get_index

Has anyone been successful getting a contract which uses secondary indexes to compile against the latest versions of the CDT (1.3.2)? I'm having trouble and don't see any updated samples which use ...
2
votes
2answers
243 views

How to make a random uint64 to send to an EOS contract

My friend had made an EOS contract and he has asked me to submit a random uint64, I need to generate this in nodejs. Do I need to use a library like big number https://www.npmjs.com/package/big-...
2
votes
2answers
539 views

Compile error: undefined symbol: apply

I am following the tutorials on EOS's Developer's Portal. My EOS build was successful. I initially had errors with BOOST but it ran fine when I installed it the second time. This is the code from ...
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 ...

1
3 4
5
6 7
12