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
1answer
201 views

How to understand RAM and log storage from the view of Smart Contract?

The knowledge on RAM and smart contract is obscure to me. In white paper, RAM is defined and I know now there're only 64GBs in total. However in developer manual https://developers.eos.io/ it never ...
0
votes
1answer
471 views

How to delete struct object in a vector<struct>?

I thought it would be good idea to store a object of struct in a vector because I have seen it in a tutorial Tutorial but now I have a problem if I want to remove it from the vector. I want to make ...
2
votes
2answers
388 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.
0
votes
1answer
138 views

Can smart contract code query the block chain?

A EOS C++ smart contract can have code that query and iterate through the blockchain, to get the actions and transactions and related data? In eos.js you can do eos.getActions(accountName) but inside ...
3
votes
1answer
329 views

How do I listen to the actions contained in a transaction to my smart contract?

For example, if Alice sends a transfer from the eosio.token contract to my smart contract, how do I listen to see if she has actually sent me a transfer from the eosio.token contract and get the data ...
2
votes
1answer
269 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; ...
1
vote
2answers
505 views

Difference Between Eosio.token and Eosio.system

I have an idea for a DApp I'm looking to build after launch. It won't be large, but it'll be on a large platform (won't name it here because I don't want anyone taking my idea lol). After cloning the ...
0
votes
2answers
44 views

Why the EOS documentation still says Dawn 4.1?

Has the documentation been updated to 1.0?
1
vote
1answer
423 views

How to create a token using eosio.token contract?

I am trying to follow the tutorial, deployed eosio.token contratc to eosio.token account. I have no problem to do the following: eos.transaction({ actions: [ { account: 'eosio.token', ...
5
votes
1answer
286 views

How eos prevent contract upgrade for evil?

Can the publisher do evil with upgrading the smart contract? In eos, the smart contract is controlled by an account.
3
votes
1answer
250 views

Who will get the ram back when delete records?

In EOS, when create a table record, someone will pay the ram, and when modify the record, maybe someone else will pay the ram, and when delete the record, who will get the ram back? the creator or the ...
2
votes
0answers
50 views

Does eos smart contract support sha3(keccak)? [duplicate]

In the eosiolib/crypto.h, I only saw the sha1, sha256, sha512, ripemd160, and recover keys method. If I'd like to add the sha3 method, did I need to write the library in the contract? That will be ...
2
votes
1answer
126 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-...
1
vote
2answers
325 views

transcation take to long on cleos push action in EOS 1.0.2

Exception encountered while processing chain.push_transaction: 3040005 expired_tx_exception: Expired Transaction transaction has expired, expiration is 2018-06-12T12:30:04 and pending block time is ...
1
vote
0answers
313 views

How do I add second and third indices to the multi_index object?

I have thoroughly read the documentation and isolated my problem down to a small set of sample code. I'm not sure where my problem is. I am trying to add multiple indices to a multi_index object so ...
7
votes
1answer
2k views

How to convert an account_name to a string?

I need to be able to convert a name/account_name to a string for some processing in my smart contract. I have found and used the string_to_name function for converting in the other direction, but ...
0
votes
1answer
314 views

How do I add more RAM on existing account?

-All of my EOS is staked for CPU and NET bandwidth, should I un-stake some of it first, and how ? -What command should I execute with a BP to buy, lets say, 600 EOS worth of RAM on an existing ...
1
vote
0answers
107 views

Eosflare.io shows the wrong Connector Balance for EOSIO.RAM account?

It currently shows 66730 EOS (http://eosflare.io/account/eosio.ram), but here in the first answer (How to get current (last) RAM price?) is said that it should be 1021789.6640 EOS (see quote.balance). ...
1
vote
2answers
92 views

Is there a BP with available smart-contracts that we can simply run without submitting?

Submitting a smart contracts to different BPs gives me different errors. Would there be a BP with ready-to-run smart-contracts (which are found in a /contracts directory) that can be executed by EOS ...
2
votes
1answer
260 views

Error generating abi file for type “double” or “float” using eosiocpp tool

I am writing a smart contract that uses a multi index table with a member type double. //@abi table tbltest i64 struct test{ uint64_t uid; double margin; uuid_t primary_key() const { ...
5
votes
0answers
99 views

Releasing your RAM, not caring for pre-existing records [duplicate]

Say if, I push an action to an existing contract on the EOS main net. This action creates a record in a table/multi index container with me as the payer in the emplace method. No other action ...
3
votes
1answer
134 views

Can we upload contracts to testnet or mainnet without being fully synced?

From an enterprise developer's POV I'm hoping the blockchain will one day be as easy to query, and write contracts for as it is for me to connect to a db through a database ide such as SSMS (SQL ...
1
vote
1answer
165 views

Why use databases in smart contract?

As we can store data in map, why we need to create table for it, and why we need to pay for the fee for create and modify records? How much is the ram fee, how to avoid it? If I use map, who will ...
10
votes
3answers
2k views

How to do an inline transfer of a token?

When I perform a token transfer from the cleos command line, it works with no problems: $ cleos push action eosio.token transfer '["rider2","vehicle1","1000.0000 TOK","initial"]' -p rider2 executed ...
3
votes
1answer
89 views

What exactly happens when an Airdrop occurs?

From my understanding of an Airdrop, it is a distribution method for a certain token based on stake holding of another currency (EOS in this case). On a more technical perspective, what exactly ...
2
votes
1answer
1k views

How can I transfer Eos in Eos smart contract?

I am learning Eos smart contract. But there are no information except Eos wiki. In ethereum, ethers can be transferred by payable function. How can I transfer Eos in Eos smart contract?
1
vote
0answers
127 views

unpack_action_data - error: !“unresolvable”: env.free. #

I am trying to use unpack_action_data. void apply(const account_name contract, const account_name act) { if (act == N(transfer)) { transferReceived(eosio::unpack_action_data<...
7
votes
1answer
395 views

How do you define who pays and who stores on your Smart Contract tables?

Sometimes I find myself lost deciding how I will store data for my application. I have a dilemma about: Decentralization vs Accessibility for everybody? Looking to this table, which manage DAOs: // ...
2
votes
1answer
248 views

EOS Token Economy with Contract, Wallet, Account

i'm trying to making dApp with EOS. I have some questions. About token. Should i use "eosio.token" contract to make token economy? Or it is just for example? Then should i make new smart contract ...
2
votes
1answer
95 views

How do you stream data from an input file when writing contracts on EOS?

I emulated the tic.tac.toe tutorial code and made a simple contract that allows me to add and remove car information. However, I can only push action one at a time and this only allows me to add/...
3
votes
1answer
254 views

Can an action in a smart contract concurrently executed?

In a smart contract if an action is executed simultaneously and if it tries to modify the same record in a table(using multi index API), How to add mutual exclusion to the shared resources? For eg. ...
2
votes
1answer
295 views

How the persistent database is saved on the blockchain

I know that the eos blockchain saves the transactions generated data in a persistent database. It has methods to insert, modify and erase data. As the blockchain is supposed to be immutable, does the ...
3
votes
1answer
82 views

Problem to generate an abi to a struct that has two keys

I'm trying to generate an abi to a struct that has two keys I have tried different combination but could not have both indexes generated. Has someone succeed trying something like that ? Is this a ...
4
votes
1answer
164 views

What are the differences between eosiocpp and g++

I am using time functions within my smart contracts and I'm seeing differences between eosiocpp and g++. The below compiles and executes with no problem using g++. time_t rawtime; tm * timeinfo; ...
3
votes
1answer
367 views

Contract A makes an inline call to contract B. How can B determine that A is the one making the call?

Contract A calls an inline action on contract B via INLINE_ACTION_SENDER(...). How can contract B determine that it is being called by contract A?
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
404 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.
3
votes
1answer
233 views

How can I call third party APIs from inside a smart contract at a set time or interval?

In a scenario where a smart contract needs to check against a third party service (Let's say an API with weather information from a trusted source like Weather.com) and make a decision on moving ...
9
votes
2answers
2k views

How to validate if an Account exists?

I know that we have require_auth to check for permission, but I'm looking for something like is_valid_account to check if the account exists and is active in the chain. Do we have anything like that?...
2
votes
1answer
1k views

How to get block info (e.g. block hash code) in smart contract?

I want to use action context information, such as block hash code, to generate number as "random" numbers in smart contract. But I can't find any interface to get block hash code.
1
vote
1answer
105 views

Is there any fallback function in smart contract similar to Ethereum?

In example dice at contracts directory, alice/bob should set permission to dice account for transferring EOS token from alice/bob to dice. alice dice contract eosio....
11
votes
1answer
2k views

What is the purpose of `require_recipient`?

I saw the description of the function require_recipient and it says: Add the specified account to set of accounts to be notified I would like to understand what's the purpose of receive this ...
7
votes
1answer
343 views

Developing Smart Contracts with Docker

If I have the eos chain running in a Docker container, how can I interact with it from my local file system? I would love to be able to create my contracts, compile them, and deploy to my docker ...
8
votes
1answer
848 views

How to use two secondary keys as a filter? (WHERE f1 AND f2)

In the contract multi index tables we can filter by the primary key or we can just create an indexed_by as an additional index. Then we have basically two options: filter by the primary key or ...
5
votes
1answer
49 views

What's the difference between register() and claimAll()?

I'm using MyEtherWallet to register/map the EOS key. The steps suggests to use register() function, however in another tutorial I've seen it's using claimAll() function. So, I'd like to know the ...

1
8 9 10 11
12