The transfer flow

transfer flow

1. Alice enters a request to transfer funds in the application.

Alice enters a request to transfer funds using the off-chain application.

2. The application sends a TransferRequest transaction to StarkEx.

The application sends a transfer request transaction to the StarkEx gateway, using the add_transaction API with the TransferRequest transaction type.

The request includes the following information:

amount

The quantized amount of the asset to transfer.

sender_public_key

The sender’s public Stark key.

sender_vault_id

The sender’s vault id.

receiver_public_key

The receiver’s public Stark key.

receiver_vault_id

The receiver’s vault id.

token

The token to be transferred.

fee_info_user

The maximum fee that the sender is willing to pay for the transaction.

expiration_timestamp

The time after which the request is no longer valid, in hours since the Unix epoch.

nonce

A nonce issued by the caller, to prevent replay attacks.

signature

The sender’s signature.

3. StarkEx validates the transfer request.

StarkEx checks the following to validate the transfer request:

  • The signature is valid and the transfer request is signed by a Stark key that corresponds to the order’s vault id.

  • The balance in the sender’s vault is sufficient to fulfill the transfer.

  • The receiver’s vault has the receiver’s Stark key.

  • The maximum fee that the party is willing to pay for the transaction is not less than the actual fee.

  • The transfer request has not expired.

  • According to the orders tree, the order has not already been fulfilled.

4. The transfer is included in a batch

If the transfer request is valid, the transfer is included in a batch to be submitted on-chain along with a validity proof.

Implementing a transfer in your application

To implement transfer functionality in your application, use the add_transaction API with the TransferRequest transaction type.

The StarkEx REST API reference includes all necessary information.