transfer flow

Step 1: Alice Sends Transfer Request to the Application

Alice sends the Application a signed Transfer request, which includes:

  • The receiving vaultId, and starkKey

  • The vaultId and starkKey of the vault that funds will be taken from

  • The relevant ( quantized) amount and assetId

  • expiration_timestamp

  • nonce

For the full transaction structure, see message encodings for Spot Trading.

In starkEx for perpetual trading, only transfer of the collateral asset id is allowed.

Step 2: Application Sends Transfer Transaction to StarkEx

The Application sends the Transfer transaction to StarkEx service. StarkEx service verifies:

  • The signature is valid and the signing starkKey matches the vaultId

  • The sender vaultId has enough funds (according to the application business logic)

  • The receiver vaultId indeed has the receiver starkKey

  • The Transfer has not expired

  • The Transfer was not executed before (checked in the ordersTree)

  • For perpetual trading: the assetId corresponds to the collateral token

Step 3: Transfer Included in a Batch

If the Transfer is valid, the Transfer is included in a batch to be submitted on-chain along with validity proof. For full details on state update on-chain, see Contract Management.