Dexter
Dexter
Docs

Sessions Overview

MPP sessions let agents deposit funds once and stream thousands of micropayments with only two on-chain transactions. Open a session, exchange off-chain vouchers at microsecond speed, settle once when done.

The Bar Tab Analogy

A session works like a bar tab:

  1. You open a tab (authorize a spend limit)
  2. You order drinks (make API calls, receive signed vouchers)
  3. You close the tab (one settlement for the total consumed)

The bartender never takes your wallet. You can close the tab and leave at any time. The tab has a maximum. If you dispute, you have the receipts.

How It Works

sequenceDiagram
    participant Buyer
    participant Seller
    participant Dexter
    participant Solana
 
    Note over Buyer,Dexter: One-time onboarding
    Buyer->>Dexter: Provision Swig wallet + grant delegation role
 
    Note over Buyer,Solana: Session open (1 on-chain tx)
    Buyer->>Dexter: Open session (seller, deposit)
    Dexter->>Solana: Verify Swig role on-chain
    Dexter-->>Buyer: Channel ID + session keypair
 
    Note over Buyer,Seller: Pay loop (off-chain, microseconds)
    loop Every API call
        Buyer->>Dexter: Request voucher (amount, nonce)
        Dexter-->>Buyer: Signed voucher (Ed25519)
        Buyer->>Seller: Request + x-mpp-voucher header
        Seller->>Seller: Verify voucher locally (Ed25519)
        Seller-->>Buyer: 200 + data
    end
 
    Note over Buyer,Solana: Session close (1 on-chain tx)
    Buyer->>Dexter: Close session
    Dexter->>Solana: TransferChecked (cumulative total)
    Dexter-->>Buyer: Settlement signature

Non-Custodial Model

Session funds never leave the buyer's wallet until final settlement.

PropertyDetail
Where funds liveBuyer's Swig smart wallet
What Dexter can doExecute TransferChecked for the specific SPL token, up to the spend limit, while the role is active
What Dexter cannot doTransfer arbitrary tokens, exceed the spend limit, act after TTL expiration, prevent revocation
Buyer revocationRemove Dexter's role at any time with a single Swig instruction. Immediate, unilateral, no cooperation required.
EnforcementOn-chain by the Swig smart wallet program (audited), not by Dexter

The closest traditional analogy is a credit card pre-authorization: the buyer authorizes a maximum charge, the processor can charge up to that amount, the buyer can dispute or cancel, and the funds remain in the buyer's account until settlement.

Voucher Verification

Sellers verify vouchers locally using Ed25519 signature checks. No RPC calls, no network round-trips. Verification completes in microseconds.

The SDK's verifyVoucher() checks:

  • Ed25519 signature is valid for the voucher payload
  • Cumulative amount is monotonically increasing (no reuse, no rollback)
  • Sequence number is strictly increasing
  • Amount meets minimum (no underpayment below pricePerUnit)
  • Signer consistency across all vouchers in a channel (no key rotation mid-session)

Balance Monitoring

Active sessions are monitored every 15 seconds by the facilitator. If a buyer's wallet balance drops below the cumulative settled amount, the session closes automatically with emergency settlement. This protects sellers from buyer rug-pulls.

Gas Sponsorship

Buyers need zero SOL for the entire session lifecycle. Dexter sponsors gas on both the open and close transactions. Voucher exchanges during the session are entirely off-chain.

Integration Guides

On this page