Are there any examples online for where I can see some examples of deferred transactions being created?


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.id));
        out.delay_sec = 10;
        out.send(pet.id, _self);

It's basically wrap an action on a transaction object (so you must import eoslib/transaction.hpp on your header) and you set the quantity of seconds to defer the transaction, in the above case it's 10 seconds.

  • 2
    is that possible to stop deferred transaction which having been pushed in a contract ?
    – Harry Ma
    May 23 '18 at 2:31
  • 1
    what means first parameter of transaction.send?
    – baltazar
    May 25 '18 at 8:45
  • yes it's possible to stop a deferred transaction, check cleos system ... the first parameter of transaction.send is the id of the transaction you want to create May 25 '18 at 13:19
  • are deferred transactions visible the second they are sent? I want to use them to hide some information but reveal at a later time. Aug 3 '18 at 12:16
  • 6
    who will pay for CPU in case of a deferred or inline action, the contract or the initial caller? Aug 27 '18 at 0:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.