Skip to main content
Share Your Experience: Take the 2024 Developer Survey
16 votes
Accepted

How can I create a deferred transaction?

It's super simple, from your contract just call the below code: transaction out{}; out.actions.emplace_back(permission_level{_self, N(active)}, N(pet), N(feedpet), std::make_tuple(pet....
Leo Ribeiro's user avatar
  • 3,023
6 votes
Accepted

Can we set the deferred transaction for the delay more than the maximum delay?

You may modify your deferred transaction to call it recursively until remaining_delay is less than max_transaction_delay. The code snippet looks like this. void deferred_txn(uint64_t delay,string ...
Umesh Maheswari's user avatar
5 votes
Accepted

How can a action be scheduled to execute at specific timestamp or block?

Yes, you can do that. It's handled by the delay_sec property of the transaction structure. Check this answer: https://eosio.stackexchange.com/a/389/54 If you are using EOSRPC or inside the contract ...
Leo Ribeiro's user avatar
  • 3,023
5 votes
Accepted

What is sender_id param in send_deferred function?

The sender_id is just a value set by the contract that sends the deferred transaction so that later operations can refer to the same transaction. The semantics are: sending a new transaction with ...
Bart Wyatt's user avatar
5 votes
Accepted

Is it advisable to use global variable in smart contract?

Global variables are more or less a design thing. I personally do not like them because of object-orientation for languages like c++. They are good for script languages, but if your application or ...
tmm's user avatar
  • 2,114
4 votes

Is it possible to see a list of deferred transactions

So I found a way to access deferred transactions using the following command: curl NODE_HERE/v1/chain/get_scheduled_transactions --data '{"json":"true","limit":-1}' after this, you would have to ...
Phillip Hamnett - EOS42's user avatar
4 votes

Authorisation failure with deferred transaction

as Nirdesh alluded to in the comments, when a transaction is deferred, it is run by the eosio account and therefore that account needs to be given permission to make the call. Nirdesh's solution ...
ekkis's user avatar
  • 515
3 votes
Accepted

How to find out if deferred transaction was executed

Todd Fleming answered this in the EOS Developers Telegram channel as follows: Todd Fleming There isn't an intrinsic to do it. Flag seems like a good option. Refering to Gassa's answer about ...
cmichel - LearnEOS.dev's user avatar
3 votes
Accepted

Can you create a deferred transaction with cleos?

Update 19th September: v1.3.0 added a --delay-sec flag to cleos push action so you can now set a delay for your action from cleos directly. I can't see anything in programs/cleos/main.cpp that would ...
confused00's user avatar
  • 5,554
3 votes

Can we set the deferred transaction for the delay more than the maximum delay?

You can add an intermediate deferred transaction that will have a counter and manage the extended time you want to defer to. Say for example that you want to delay for 365*24*60*60*2 = 63072000 ...
Ami Heines's user avatar
  • 1,686
3 votes
Accepted

How to transfer EOS after a particular delay?

You need to call the transfer action of eosio.token contract with the appropriate arguments after your preferred delay: void send(account_name from, account_name to, asset amount, string memo, ...
confused00's user avatar
  • 5,554
3 votes
Accepted

How can I cancel the deferred transaction in EOS after we push the deferred transaction in the blockchain

void send(const uint128_t& sender_id, account_name payer, bool replace_existing = false) First parameter(sender_id) is the id of the deferred transaction. You can call cancel_deferred(sender_id) ...
afu802's user avatar
  • 201
2 votes
Accepted

Set a contract containing deferred transaction from front-end

If I understand your question correctly, you can send a deferred transaction like you usually would but defining the delay as a function parameter: void send(account_name account, std::string message,...
confused00's user avatar
  • 5,554
2 votes

How to tell if a transaction was initiated by account or contract code

If an action is initiated by user account, it will be included in the trx.trx.actions array of a transaction. Follow this idea, we could do: We have a output actions list from your cleos get actions &...
Tong Shen's user avatar
  • 475
2 votes

How to find out if deferred transaction was executed

I don't know about the proposed solution (the onerror part of the question). This answer deals differently with the original problem. At the very least, the original action can maintain a flag in the ...
Gassa's user avatar
  • 598
2 votes

Is there any way to discard a committed transaction?

You can delay a transaction. While using cleos just add --delay-sec [seconds to delay] and probably cleos wallet lock will stop cleos from pushing the transaction as long as you're within the ...
cmadh's user avatar
  • 1,929
1 vote
Accepted

COMPILATION ERROR error: static_assert failed "Something went wrong. Please report this issue to the github

Change std::make_tuple(itr) to std::make_tuple(*itr). The type of itr is const_iterator and it's not serializable.
conr2d's user avatar
  • 2,320
1 vote

error: no type named 'transaction' in namespace 'eosio'

I have found a solution, but I am unsure if this is the right way to do it. The included files were under /usr/opt/eosio.cdt/1.6.1/include/eosiolib/contracts/eosio/ From there, it seems that the file ...
LemmeTestThat's user avatar
1 vote
Accepted

How to add nonce to generated (deferred) transcation

Michael Yeates gave a good suggestions on Telegram. Simply add an action instead of a context_free_action. A code example would look like this: auto nonce = getNextId(); txn.actions.emplace_back(...
colin's user avatar
  • 267
1 vote
Accepted

Making an EOS delay send transaction into the future?

Yes you can use cleos to do the delay send by adding the option: --delay-sec [seconds to delay] And no it does not lock up your eos, it will just fail when that time comes to send it.
Patoshi パトシ's user avatar
1 vote

delay_sec is not accurate for deferred transaction

Answer from the telegram by admin Todd Fleming: There is no guarantee that delayed transactions will execute on time, or at all. Trying to make guarantees like that would compromise the integrity ...
crax's user avatar
  • 111
1 vote

Can a deferred transaction make the initial transaction fail

No, the success or failure of the deferred transaction is independent of the action in which it is called. The only exception is if the deferred transaction would objectively fail in the original ...
Phillip Hamnett - EOS42's user avatar
1 vote

How do permissions on deferred transactions work?

I would refer to this: https://github.com/EOSIO/eos/issues/3013 It looks like Dawn 4.0 changed the permissions a contract needs to call another contract. You need to grant [email protected] ...
btclibertarian's user avatar
1 vote
Accepted

Is is possible to defer a non abi action using a abi action?

It isn't possible to call a non-ABI action in the way you want. Only something in the ABI can be called in a transaction, whether it is deferred or not.
Phillip Hamnett - EOS42's user avatar
1 vote

How to use the onerror event?

To resend failed transaction you have to unpack it from onerror struct and resend it. transaction failed_tx = error.unpack_sent_trx(); failed_tx.send(tx_id, self); see also proxy contract
eosx's user avatar
  • 11
1 vote

Addition overflow when doing delegatebw in contract

I have found a solution to my problem. The problem was caused by the fact that the delegatebw function implicitly calls the transfer function from the contract to the receiver. This, combined ...
Phillip Hamnett - EOS42's user avatar
1 vote
Accepted

whose permission is required while sending transaction and how can we give that permission

I'm not quite sure in your code what's account1 as it's not defined anywhere. Did you mean N(account1)? Also, what does account1::transfer() look like? Are you trying to transfer EOS tokens? You ...
confused00's user avatar
  • 5,554
1 vote

How can create a deferred action which is executing at specific interval

What's tester and tester::hello() looking like? Your code may look ok or not depending on how those are implemented. Any small error may result in the whole thing failing with no helpful error message....
confused00's user avatar
  • 5,554

Only top scored, non community-wiki answers of a minimum length are eligible