Virtual Account - Withdrawals from Master Exchange Address

Modified on Mon, 27 Mar 2023 at 03:57 PM

There are two withdrawal methods from a Virtual Account:

  • From a Virtual Account deposit address
  • From a Master Exchange Address


Additional information is available at the following link.



Steps for Virtual Account asset withdrawal from Exchange Master Address

  1. Store information about withdrawal
    • Check the id of the Virtual Account, the available balance or the UTXO balance
    • Decrease the amount and fees from the Virtual Account
    • Prepare transaction to broadcast transfer to the blockchain
  2. Blockchain transfer
    • Standard blockchain transfer from address to address
    • Verify the result of the transfer
  3. Complete/Rollback
    • IF blockchain transfer fails - rollback VA balance
    • ELSE complete withdrawal


Example:

  1. User_A: VirtualAccount_A balance is 0 MATIC.
  2. User_A: DepositAddress_A connected to VirtualAccount_A receives 3 MATIC.
    • VirtualAccount_A balance is now 3 MATIC.
  3. Exchange_Owner: Transfers 3 MATIC from DepositAddress_A to MasterBlockchainAddress.
  4. User_A: Withdraws and transfers 3 MATIC from VirtualAccount_A to VirtualAccount_B owned by User_B.
    • Endpoint: Send payment
    • VirtualAccount_A balance is now 0 MATIC.
    • VirtualAccount_B balance is now 3 MATIC.
  5. User_B: Withdraws to transfer out 3 MATIC from VirtualAccount_B  to an unrelated blockchain address.
    1. Exchange_Owner: Store withdrawal --> /v3/offchain/withdrawal
    2. Exchange_Owner: Standard blockchain transfer via: Send MATIC from account to account
    3. Exchange_Owner: Completes or Cancels the withdrawal
      1. Complete withdrawal --> /v3/offchain/withdrawal/{id}/{txId}
      2. Cancel withdrawal --> /v3/offchain/withdrawal/{id}

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article