Withdrawing From a Master Exchange Address

Withdrawing From a Virtual Account Master Exchange Address

There are two withdrawal methods from a Virtual Account:

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

Workflow Example

  1. User_A: VirtualAccount_A balance is 0 MATIC.
  2. User_A: DepositAddress_A connected to VirtualAccount_A receives 3 MATIC.
    1. VirtualAccount_A balance is now 3 MATIC.
  3. Exchange_Owner: Transfers 3 MATIC from DepositAddress_A to MasterExchangeAddress.
    1. This is a standard blockchain transfer via: Send MATIC from account to account
    2. VirtualAccount_A balance remains 3 MATIC.
  4. User_A: Withdraws and transfers 3 MATIC from VirtualAccount_A to VirtualAccount_B owned by User_B.
    1. Endpoint: Send payment
    2. VirtualAccount_A balance is now 0 MATIC.
    3. 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}

How to withdraw assets from a Master Exchange Address

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

Important

The intended use case for Virtual Accounts (VA) is as a Self-Custodial Exchange, meaning all withdrawals are expected to be tracked in the VA ledger.

  • Tatum does not hold custody of mnemonics or private keys. As a result, it is technically possible to sign transactions using VA ledger deposit addresses outside the VA ledger and Tatum endpoints. For more details, refer to this article.
  • The blockchain’s on-chain balance takes precedence over the VA ledger. If unregistered transactions occur, the VA ledger will become misaligned, leading to liquidity inconsistencies between the on-chain balance and the off-chain VA ledger.
  • Virtual Accounts are designed to hold a limited number of deposit addresses (1-5). While adding many more deposit addresses may appear functional, this setup often leads to unrecoverable synchronisation issues across users over time.
  • Any on-chain assets already present in a blockchain address to bind to a Virtual Account will be ignored. More information HERE.
  • Deposits are only "recognized" as long as the "currency" of the VA matches the on-chain asset deposited
  • If a mistake occurs when creating or storing a withdrawal in the VA ledger, it can be deleted and retried. Check this article for addtional details.
  • Withdrawals from a VA deposit address can be automated using the VA Blockchain Operationsendpoints, ensuring they are properly logged in the VA ledger.

🚧

Attention

  • You are expected to hold 1:1 asset liquidity between the VA off-chain ledger and your end-users on-chain assets.
  • To avoid potential disruptions and ensure consistent performance, we recommend adhering to the intended usage of 1-5 deposit addresses per Virtual Account.
  • Be mindful of Tatum Derivation Path.

❗️

Warning

  • All withdrawals must be registered and executed through VA-specific endpoints.
  • Using standard blockchain transaction methods to sign and broadcast a transaction from a VA-linked deposit address bypasses the VA ledger, leadings to balance discrepancies. If this happens, the withdrawal must be manually registered.