Suspended Transactions

Suspended transaction

A suspended transaction is a transaction that is completed after multiple delays.

Ordinary non-suspended transactions are done in one go, and all the conditions must be met when the transaction is submitted, for example, all signers must sign together.

However, in reality, many transactions are completed with a process. For example, the participants of the transaction may not be able to complete the signature at the same time. The suspended transaction allows the signature to be provided step by step until the transaction is successful.

The lifecycle of a suspended transaction could be divided into four steps:

  • Execute newsuspend action on the chain to create a new suspended transaction
  • Execute aprvsuspend action on the chain to append signatures
  • Execute cancelsuspend action on the chain to cancel a suspended transaction if you want
  • Execute execsuspend action on the chain to execute a suspended transaction if all necessary signatures are satisfied

Create suspended transactions

use --proposal-name(the name of this suspended trx) and --proposer(the one who propose this suspended trx) options to create a suspended transaction.

For example:

evtc domain create cookie2 EVT7JoY9nbkfWCx2opvUhS9pPmWbLjRuhNCmDTG971PVkhxvAzWWr --proposal-name ppp --proposer EVT7JoY9nbkfWCx2opvUhS9pPmWbLjRuhNCmDTG971PVkhxvAzWWr --payer EVT7JoY9nbkfWCx2opvUhS9pPmWbLjRuhNCmDTG971PVkhxvAzWWr

output:

executed transaction: 74e5b5c697b2300a8a3417810ac42d6bb089e154ca2ac1a6f4461ebbd5bc9e55
total elapsed: 292 us
total charge: 0.00000 S#1
(1 of 1)
   action : newsuspend
   domain : .suspend
      key : ppp
  elapsed : 88 us
  details : 
|->name : ppp
|->proposer : EVT7JoY9nbkfWCx2opvUhS9pPmWbLjRuhNCmDTG971PVkhxvAzWWr
|->trx : 
    |->expiration : 2018-09-08T06:59:52
    |->ref_block_num : 51006
    |->ref_block_prefix : 2543749167
    |->max_charge : 10000
    |->actions : 
        |->name : newdomain
        |->domain : cookie2
        |->key : .create
        |->data : 399a66511001000000033e99592520f81a861184b92f0dabd1ebd1e4095cba5eec8f7c827196e909f93b000000008052e74c01000000010100033e99592520f81a861184b92f0dabd1ebd1e4095cba5eec8f7c827196e909f93b0100000000b298e982a40100000001000001000000000094135c6801000000010100033e99592520f81a861184b92f0dabd1ebd1e4095cba5eec8f7c827196e909f93b0100
    |->payer : EVT7JoY9nbkfWCx2opvUhS9pPmWbLjRuhNCmDTG971PVkhxvAzWWr
    |->transaction_extensions : (empty)

After a suspended trx proposed, it nended to be approved by all the user included, and then it could be excuted.

And aprove suspend trx:

evtc suspend approve ppp

output:

executed transaction: b344c4131265131d31e92f377c35a908c87b40cd7ea20c3e1e449859da5107cf
total elapsed: 128200 us
total charge: 0.00000 S#1
(1 of 1)
   action : aprvsuspend
   domain : .suspend
      key : ppp
  elapsed : 117781 us
  details : 
|->name : ppp
|->signatures : 
      |->SIG_K1_KdZRQ6z9nPwxNmixGDUUyRZkGM2Uw8bTrZHPV8oJYA6kfuedPNhjcso28waKLTY2cxdGJ6eNff8KwLp4FkG6mDMZW1eGVr

then you can excute it:

evtc suspend execute abc EVT7JoY9nbkfWCx2opvUhS9pPmWbLjRuhNCmDTG971PVkhxvAzWWr --payer EVT7JoY9nbkfWCx2opvUhS9pPmWbLjRuhNCmDTG971PVkhxvAzWWr

output:

executed transaction: 0c907cd818507e31c3276c322299e3327a3f0a00a24270f050ebbc0c3e21ab31
total elapsed: 84711 us
total charge: 0.00000 S#1
(1 of 1)
   action : execsuspend
   domain : .suspend
      key : abc
  elapsed : 48371 us
  details : 
|->name : abc
|->executor : EVT7JoY9nbkfWCx2opvUhS9pPmWbLjRuhNCmDTG971PVkhxvAzWWr