BeginSwap
- Begin exchange operation (signed by the sender)sender
- sendertarget
- recipienttimestamp
- expiration timealg
- hashing algorithmhash
- hash?DATA (amount, color, etc)
- data about the frozen fundsCommitSwap
- complete the exchange operation (does not require a signature)hash
- hash of the secret as exchange operation identifiersecret
- secret phrasesender
- exchange initiatortarget
- recipientRollbackSwap
- Roll back an exchange operation (does not require a signature)hash
- hash of the secret as exchange operation identifiersender
- exchange initiatorCancelSwap
- Cancel the exchange operation (signed by the sender and recipient).hash
- hash of the secret as exchange operation identifiersender
- exchange initiatortarget
- recipientBeginSwap
initiates the exchange operation by freezing the funds in the sender's account. To do this, coins are deducted from the account and information about the operation (secret, lifetime, deducted amount, etc.) is being recorded in the account in a special field with unfinished exchanges.CommitSwap
unfreezes the funds and transfers them to the recipient. For this purpose, the secret, whose hash was specified earlier, is provided before the expiration of the exchange operation. In fact, the operation adds the transaction amount to the recipient's balance (it was deducted from the sender when the exchange was created), and then the information about the incomplete operation gets deleted from the sender's account.CancelSwap
cancels operations by mutual consent. It can be performed at any time, including before the exchange expires. This is an optional operation.