Transfer lifecycle

This document describes a transfer from Alice's account to Bob's account.

Notarize transaction

Alice initiates a transfer by sending a signed notarizeTransaction message to the Notary. The message contains an accountLedger document and it contains a transfer transaction type.

The transaction contains two items:

Everything is signed by Alice.

Alice initializes a transfer

Notary responds with @notarizeTransaction message. It contains accountLedger with transaction type atTransfer (response to transaction transfer). The transaction contains a response for each item. The items' status is acknowledgement or rejection.

Both items contain an inReferenceTo the whole copy of original item. The response item is signed by the Notary to prove that the Notary agreed with it. Both items have set inReferenceTo, numberOfOrigin and transactionNum to origin Alice's transaction number.

When the Notary accepts Alice's transaction, the Notary creates a new pending transaction and puts it into Bob's inbox and Alice's outbox.

Alice expects a new transaction in her outbox, so she downloads it by combination of getAccountData, getBoxReceipt. TODO: why has Alice new copy of transfer.

Bob gets transfer to inbox

The same is done by Bob. Using getAccountData and getBoxReceipt messages, Bob downloads a new receipt from his inbox. The receipt contains a pending transaction signed by the Notary. The transaction contains Alice's original transfer with her signature.

Bob accepts the pending transaction by performing a new processInbox transaction. This transaction contains two items:

Notary accepts Bob's processInbox and sends atAcceptPending to Bob in reply. As Bob accepted the transfer, Notary generates a new transferReceipt transaction and drops it into Alice's inbox.

Alice gets a notification that the transfer is complete

Alice receives a new transferReceipt in her inbox.

Alice responds to transferReceipt by acceptItemReceipt in processInbox.

Notary sends atAcceptItemReceipt.