Skip to main content

Trade Lifecycle

Lifecycle of a trade from submission to settlement.

A Step-by-Step Walkthrough

Let's say Alice is a user of Wallet A and is thinking about purchasing some SOL as a long-term investment. Alice places an order to swap 150 USDC for 10 SOL, and receives 10 SOL in her Solana wallet.

This is what happened behind-the-scenes.

DFlow Overview

0: Retail investor shows trading intent and prompts wallet to request for price quote. This step is not necessary as it depends on how the trading app is set up. Some trading apps require the user to review the trade before confirmation, other apps may fetch quotes on a set interval.

1: Wallet sends endorsement request to its endorsement server and receives an endorsement for its quote request. Each price quote request on DFlow requires an endorsement. An endorsement is like a signature and verifies the request came from the wallet.

2: Wallet sends firm quote request to DFlow node. A firm quote (vs. an indicative quote) is fetched because Alice showed intent of submitting the order. A quote request is needed because price discovery on DFlow uses the request-for-quote (RFQ) liquidity model, a common model also used in traditional markets.

3: DFlow node verifies endorsement and if approved, relays the firm quote request to the winning market maker. This firm quote is fetched from the market maker who won the relevant auction (i.e. the SOL-USDC auction for the correct order size range) – let's say it's Market Maker B.

4: Market Maker B returns firm quote to the DFlow node. Market Maker B will get a last-look at this quote so it's able to quote tighter. However, the market maker must pay for the order regardless of whether they completed the trade, which hedges the risk of failing to complete the trade.

5: When the DFlow node receives the quote, it crafts a relevant blockchain transaction specifying token swap details. In this example, Alice sent an order from Solana so the DFlow node crafts and returns a Solana transaction to Alice.

6: Alice sees the quote on the frontend and signs the transaction, if desired. The price quote states the amount of tokens to be swapped, meaning Alice is guaranteed to receive the price as long as the market maker gives final approval.

7: When Alice approves the order transaction, wallet sends an order transaction request to the DFlow node.

8: DFlow node relays transaction to Market Maker B. Order delivery updates the accounting (i.e. delivered order amount is incremented) for the auction on the DFlow Chain and pro-rata payment is forwarded to the wallet.

9: Market Maker B gets a last look at the quote and gives final approval before forwarding settlement transaction to the relevant blockchain. Here, Market Maker B sends the transaction to be settled on Solana. The transaction to Solana contains instructions to transfer the send quantity (USDC in this example) to the market maker's address on Solana and the receive quantity (SOL in this example) to Alice's address on Solana.

Important Takeaways

  • Blockchain order transaction is crafted off-chain by the DFlow node but the settlement happens on-chain on the relevant Layer 1.
  • DFlow node is built to support transaction buffers to all major Layer 1s and roll-ups, making it convenient for wallets from various domains to access a single source of liquidity.
  • Layer 1 tokens are not bridged to DFlow Chain. Incoming token swap orders are settled on their corresponding Layer 1 blockchains and at no point are assets bridged to the DFlow Chain.
  • The entire user trading experience is low-latency as users are completely abstracted away from the DFlow Chain. Retail investors like Alice get the same familiar trading experience and do not need to sign any additional transactions that go directly to the DFlow Chain.