Withdrawal

Basic Flow

sequencediagram-withdrawalwf-0

For a user to perform a withdrawal in the normal state of affairs, two transactions are required:

  1. An off-chain call to the exchange to initiate a withdrawal.

  2. A call to the on-chain withdraw function to perform the actual withdrawal of funds transferring them to the user account.

The detailed withdrawal flow is described below:

  1. The User makes an off-chain withdrawal request to the exchange.

  2. The Exchange sends the withdrawal transaction to the StarkEx service. Note that withdrawal transactions do not require a user signature.

  3. The StarkEx service generates a proof containing the withdrawal (along with other transaction) and sends it to the blockchain.

  4. The user calls the withdraw contract function to withdraw the funds evicted off-chain state.

Privacy-Preserving Flow

Part of the public input for the proof containing the withdrawal is the vault content. For applications that want to keep the users balances private, we modify the deposit flow. The user first transfers the funds to a temporary vault and then withdraws them from that vault. The following diagram demonstrates this flow.

sequencediagram-withdrawalwf-1