Two-Phased Transactions are similar a bit to Bitcoin’s multisig transactions implementation in Nxt but different in many aspects as well.
Simplest example: Alice starts a Two-Phased transaction. In the first stage a transaction is included in a blockchain but it isn’t processed immediately and has the status of ‘pending’. For it to be processed, Bob has to complete the second phase of the transaction by approving it. This has to be done before the deadline set by Alice has elapsed.
Please note the biggest difference from Bitcoin’s multisig: phased transaction is going to be included into blockchain immediately.
- Bob approving a transaction of Alice
- Shareholders voting whether to send another 1M Nxt to a marketing service or not
- Multisig wallet protected from a hacker(think about BTER case etc) (needs Account Control)
- Trustless escrows
- Conditional or unconditional transaction happening in some certain moment in future
- most types of transaction could be 2-phased (but not all, see “Phasing-Safe Transactions” section)!
- different consensus types: M-of-N account consensus,shareholders voting with assets, currency holders voting with a Monetary System currency units
- possible vote threshold setting(e.g. only accounts holding 100+ assets could vote)
- whitelist of voters
- transaction could be released only prior to finishHeight(or at the height exactly )
- None - synthetic mode, used for unconditional transaction execution at some height in future
- By account - 1 account is 1 vote
- By balance - 1 nqt is 1 vote
- By asset - 1 qnt(asset’s quant, so non-divisible part) is 1 vote
- By MS currency - 1 unit is 1 vote
- By transaction - phasing transaction becomes approved if there are transactions in blockchain with hashes set in phasing transaction
- By hash - another synthetic mode, used for pay-with-secret
Not all transaction types are phaseable, so some of them couldn’t be phased at all. Some phasing transactions are phaseable but not phasing-safe, means they doesn’t make sense as phasing transactions(e.g. message could be phased, but you can read it immediately) or there’s a risk a transaction couldn’t be applied at finish height due to some changes in the outer world’s state. Following table shows phaseable & safe transaction types. Please note unsafe phasing transaction could be pretty safe in some practical case, but that’s not guaranteed by the core.
|Transaction Type||Is Phaseable ?||Is Safe ?|
|Phasing Vote Casting||Yes||Yes|
|Ask/Bid Order Placement||Yes||Yes|
|DGS Listing / Delisting||Yes||Yes|
|DGS Price Change||Yes||No|
|DGS Quantity Change||Yes||No|
|Forging Balance Leasing||Yes||Yes|
|Tagged Data Upload||No||-|
|Tagged Data Extend||No||-|