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
3
votes
1answer
65 views

Returning values from actions

I am trying to return a value from an action as follows: [[eosio::action("test2")]] int test2(int x) { return x; } The code compiles correctly, and the ABI file shows the correct action ...
3
votes
1answer
429 views

What is a context free action?

I have been doing some digging into the system smart contracts and eosio core code, and I found context free actions. Can somebody please explain what the difference between a context free action and ...
3
votes
1answer
219 views

Error message: Exceeded call depth maximum

I am writing a smart contract and I am receiving this error message: Error 3070002: Runtime error processing WASM Error details: Exceeded call depth maximum I am confused, since I believe this ...
3
votes
1answer
180 views

eosio.cdt 1.3.2 indexed_by error: non-type template argument is not a constant expression

I'm trying to shift my contract and build it with the latest CDT, v1.3.2. The transition docs say to use the new ""_n name constructor but it doesn't appear to be working. I have: typedef ...
3
votes
2answers
189 views

Meaning of N() function in multi_index

What is the role of N() in defining tables using multi_index. The primary key function does not return string. Why so? e.g. string primary_key() const {return Some_String_Object}. This throws an error....
3
votes
3answers
599 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
2answers
533 views

Building smart contract error: redefinition of 'time' as different kind of symbol typedef uint32_t time;

I am pretty desperate at this point to search for hints on this issue, though I am pretty sure it's because I'm new to C++ include system. I am getting an error while trying to run a wasm executable ...
3
votes
2answers
2k views

How to send an action from one contract to another?

From contract A, I want to send an action to contract B. How to do that? There is SEND_INLINE_ACTION but that seems to need a pointer to the contract (usually *this), correct? Solution Using action....
3
votes
1answer
852 views

How to pass arrays into a smart contract's action method

I have a smart contract action that needs to be able to take in an array of values as one of its parameters. This array is of arbitrary length. What is the proper method signature to use for the ...
3
votes
1answer
114 views

Error 3030002 when trying to set contract steps

I'm following steps from exchange-tutorial-python's README file inside the Docker container: $ docker run -it eosio/eos # nodeosd.sh 2>/dev/null & # cleos wallet create Creating wallet: ...
3
votes
1answer
39 views

How to pass specific eosio-cpp/eosio-ld options via cmake

I'm typically using CMake to compile my contracts, like described here. How can I pass specific eosio-cpp/eosio-ld options (specifically -stack-size) described here?
3
votes
1answer
157 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?
3
votes
1answer
361 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
370 views

How to push a vector to an action

I'm troubled with a problem about how I can use command line cleos push action to push a vector to an already existing action, such as: void vectortest(const std::vector &vec) ; Anyone who can ...
3
votes
1answer
904 views

What is "Transaction as Proof of Stake" (TAPOS) and when would a smart contract use it?

From: ./contracts/eosiolib/transaction.h /** * Gets the block number used for TAPOS on the currently executing transaction. * * @brief Gets the block number used for TAPOS on the currently ...
3
votes
2answers
703 views

How to send EOS based tokens from one account to another?

While playing a game on Dapp if we want the user to donate some tokens in order to join the game, how can we accomplish it in the smart contract?
3
votes
2answers
183 views

Can we freeze our deployed smart contract?

Actually, I am a little bit confused about when we say that we can freeze a deployed smart contract and cannot perform any transaction till it is unfrozen. And we can unfreeze the contract after ...
3
votes
1answer
570 views

Smart contract call - Error 3090004: Missing required authority

I'm getting this error: "Error 3090004: Missing required authority" when I try to call contract method. Jungle testnet is used. That is the method: //@abi action void add(account_name ...
3
votes
1answer
136 views

What happens when wallet is kept unlocked on eos mainnet?

Lets say, for pushing a transaction I unlocked my wallet and pushed the transaction with the active permission by command line. So, while wallet is remained unlocked, can anyone who knows my account ...
3
votes
1answer
383 views

How is the json data in a transaction converted to a datastream internally?

I'm looking at datastream.hpp but it does not show how it creates a map or dictionary object as I would expect. Also, does the 'fields' attribute in the .abi file affect what gets deserialised?
3
votes
1answer
309 views

ICO/Payment contact

Anyone is working on some ICO/Payment contacts? What I would like to learn are following functionalities within the contract: Payment, where the fee is split into 3 accounts. a) So user sends a fee ...
3
votes
1answer
77 views

Conditional behavior based upon auth

Imagine a contract that does not require_auth() but instead has conditional behavior depending upon which auth is present. if (<conditional that checks auth>) { // do stuff given auth from ...
3
votes
1answer
381 views

EOS signatures vs Ethereum signatures

So I'm trying to find a way to sign a message with a certain private key, and then to be able to recover it's corresponding public key/address on both Ethereum and EOS. The thing is I'm having some ...
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 ...
3
votes
1answer
160 views

how to implement a 48-char-long symbol token with balances like "10.0000 custom.name.of.the.token"?

I need to create my.token smart contract on EOS that will be exactly the same as eosio.token contract but my.token's symbol_code will allow a much bigger string. Something like 50 character long ...
3
votes
1answer
264 views

Ram used in transactions?

Can anyone specifically tell me where we are using the ram suppose I am a dapp developer and I have staked some ram for accounts I am going to create Questions are For every transaction made by ...
3
votes
1answer
57 views

Is it possible to distribute cards randomly and anonymously in a contract?

In the contract, I would like to have cards distributed randomly to each user like so: User1: A User2: B User3: C User4: D Each user should only be able to determine what their card is, and each ...
3
votes
2answers
149 views

Do all Smart Contracts use the eosio namespace?

I'm new to creating Smart Contracts on EOS and I've followed a few tutorials (for example the official Hello World guide). Would someone be able explain why all of the examples seem to use the ...
3
votes
1answer
132 views

Ethereum event logs equivalent for EOS

One of the solutions for saving quite a lot data in Ethereum Smart contracts is to log data by emitting event, which saves our gas. Is EOS quite similar? Does it provide us with the very same ...
3
votes
1answer
1k views

What's the difference between "time" and "time_point_sec"?

Seems that they are both datatype for storing number of seconds that have elapsed since 1970. So what's the difference between them, when should I use which? Edit: An example of the "time" datatype I'...
3
votes
1answer
378 views

What's the relationship between eosio-abigen and eosiocpp?

I am running stable version v1.1.2 After running eosio_build.sh, there are one eosio-abigen executable which locate at /build/programs/ and another one is eosiocpp which locate at /build/tools ...
3
votes
2answers
131 views

What is needed to get the EOS ~1.1.4 tutorials working on Ubuntu 16.04 (having compiled from source)?

I've found lots of info for Dawn 3.0, but there's a note in the 1.1.0 release notes that acknowledges that the EOS Developer Portal tutorials (token, exchange, helloWorld) don't work and need updating,...
3
votes
3answers
145 views

How does one prevent smart contracts from taking all your tokens, when you give them your auth?

Suppose you are a malicious smart contract developer and embedded an inline transaction in your smart contract that calls eosio.token::transfer 100 eos from the caller's account to your account. An ...
3
votes
1answer
370 views

Passing the parameters in actions vector of transaction struct

In the below code, I am passing parameters to actions struct which takes account_name, action_name, permission vector and arguments. But while sending the account_name using N it is taking the exact ...
3
votes
1answer
931 views

How to print the real time is EOS contract?

In EOS contract library, it supports the now() and current_time()method to get the current time, but it only represent the block time and won't be changed during the execution. But now I want to ...
3
votes
1answer
126 views

How to accept deposits with required quantity of tokens?

What are the best practices for setting a minimum deposit amount for a contract?
3
votes
1answer
83 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 ...
3
votes
2answers
598 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 ...
3
votes
1answer
321 views

Sending transaction with Scatter from a single-page application

Request for help: I need a simple example of sending transaction (pushing a contract action test) by Scatter written in plain JS for a single-page browser scrip without any requirjs , vue , angularjs ...
3
votes
3answers
119 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 ...
3
votes
1answer
98 views

Ricardian Contract

Does eosio also sign the transaction with the ricardian contract of user consent and/or how does the application proove that a party agreed on said ricardian contract? I have integrated the ricardian ...
3
votes
1answer
523 views

How do I create a Multi-Index DB secondary index from a String?

I'm developing a Smart Contract for EOSIO. I have a Multi-Index table with a uint64_t primary key. I'd like to add a secondary index to the table. Ideally the data I'd be indexing on would be a std::...
3
votes
1answer
420 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 ...
3
votes
2answers
247 views

eosio-cpp -abigen hello.cpp -o hello.wasm

Ubuntu 18.04.1 on VMware (Windows 10 64bit) EOSIO v1.4.1 eosio.cdt-1.3.2 i just run the compiler like this : win@ubuntu:~/eos$ eosio-cpp -abigen hello.cpp -o hello.wasm then, the terminal stopped ...
3
votes
1answer
83 views

do i still need to pay after deployed an eos contract

I have deployed a contract. and I am confused about the fees: Do I still need to pay for resources such as RAM and CPU for actions like emplace and modify after I deployed a contract? Or can I just ...
3
votes
1answer
344 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 ...
3
votes
1answer
228 views

Issue setting permissions for use of eosio.token in smart contract

I have an action in a smart contract called submanager that I want to make use of the transfer action from eosio.token (I'm using eosio.cdt v1.3). ACTION subscribe(name from, name to, asset quantity,...
3
votes
1answer
404 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 ...
3
votes
1answer
139 views

EOSIO account and smart contract

I have some questions about the account and smart contract: From google and my research, I found that one account can have only one smart contract, why? It seems you can't have the same action name ...
3
votes
4answers
759 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 ...

1 2
3
4 5
12