> ## Documentation Index
> Fetch the complete documentation index at: https://docs.range.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Technical Architecture

> Understand how Faraday routes, validates, and executes stablecoin transfers across chains

## Overview

Faraday is a REST API that abstracts swap aggregation, risk management, and compliance into a single unified interface. It integrates with 15+ swap aggregators and Range's continuously updated Risk Management Machine Learning models to provide:

* **Best execution** across multiple liquidity venues
* **Pre-trade risk screening** for every transaction
* **Compliance checks** including OFAC sanctions and Travel Rule
* **Complete audit trails** for regulatory reporting

<Info>
  **Non-Custodial Design:** Users maintain complete control of their funds at
  all times. Faraday never holds or has access to user assets.
</Info>

***

## Transaction Flow

To illustrate Faraday's architecture, let's follow Alice as she sends stablecoins to Bob. Faraday supports three types of transfers:

<CardGroup cols={3}>
  <Card title="Same Chain" icon="link">
    Single token transfer on one blockchain
  </Card>

  {" "}

  <Card title="Cross-Chain" icon="bridge">
    Same token across different chains
  </Card>

  <Card title="Swap + Bridge" icon="shuffle">
    Different tokens across different chains
  </Card>
</CardGroup>

***

### Scenario 1: Same Chain, Same Token

When Alice transfers USDC to Bob on the same chain (e.g., Solana), Faraday bypasses external aggregators and generates a direct transfer transaction.

**Transaction Flow:**

1. **Request Quote**: Alice specifies source chain, token, amount, and destination address
2. **Risk & Compliance Check**: Faraday screens the destination address for sanctions, malicious patterns, and compliance requirements
3. **Generate Transaction**: An unsigned transaction is created and returned to Alice for review
4. **Sign & Submit**: Alice signs the transaction locally and submits it to Faraday
5. **Broadcast**: Faraday broadcasts the transaction to the blockchain unchanged

<Frame caption="Same-chain direct transfer flow">
  <img src="https://mintcdn.com/scanworksorg-e98555c2/Tt4nb1BieZYvSfSG/images/docs/724fc056eb3ea852c2fb5af070bb3d05ac9cb639da70be014e3f08bb140c7701-image.png?fit=max&auto=format&n=Tt4nb1BieZYvSfSG&q=85&s=ae6fd96a365a51b820c6bf3d07288399" width="3840" height="2690" data-path="images/docs/724fc056eb3ea852c2fb5af070bb3d05ac9cb639da70be014e3f08bb140c7701-image.png" />
</Frame>

**Cost Structure:**

* ✅ Network gas fee only
* ✅ No Faraday fees
* ✅ No aggregator fees

**Benefits:**

* Real-time compliance and risk screening
* Complete transaction audit trail
* Historical reporting for regulatory requirements

***

### Scenario 2: Cross-Chain or Token Swap

When Alice wants to swap stablecoin A for stablecoin B (either on the same chain or across chains), Faraday queries multiple aggregators to find optimal routing.

**Transaction Flow:**

1. **Request Quote**: Alice specifies source chain/token, destination chain/token, and amount
2. **Aggregator Query**: Faraday queries 15+ aggregators in parallel for best pricing
3. **Risk Analysis**: Each route is screened for counterparty risk and compliance issues
4. **Return Quotes**: One or more unsigned transaction quotes are returned with pricing details
5. **Sign & Submit**: Alice reviews, selects, signs the optimal quote, and submits to Faraday
6. **Execute**: Faraday broadcasts the transaction exactly as signed by Alice

<Frame caption="Cross-chain or swap transaction flow">
  <img src="https://mintcdn.com/scanworksorg-e98555c2/Tt4nb1BieZYvSfSG/images/docs/f0aaac45c32088153bc9fc372ce3a6d7ffed4ea0708960f0b2eb8d4c47fde2e0-image.png?fit=max&auto=format&n=Tt4nb1BieZYvSfSG&q=85&s=0c8bcb6aae90e58c7c58c16aa0c0ae93" width="3840" height="1883" data-path="images/docs/f0aaac45c32088153bc9fc372ce3a6d7ffed4ea0708960f0b2eb8d4c47fde2e0-image.png" />
</Frame>

**Cost Structure:**

* ✅ Network gas fees
* ✅ Aggregator/bridge fees (included in quote)
* ✅ No additional Faraday fees

**Benefits:**

* Guaranteed best execution across all venues
* Multi-hop route optimization
* Real-time slippage protection
* Complete transparency on all costs

***

## Risk Management Integration

Every transaction passing through Faraday is automatically screened using Range's Machine Learning models:

<AccordionGroup>
  <Accordion title="OFAC Sanctions Screening" icon="shield-check">
    Real-time checks against the Office of Foreign Assets Control (OFAC)
    sanctions list. Transactions involving sanctioned addresses are
    automatically flagged and blocked.
  </Accordion>

  {" "}

  <Accordion title="Address Risk Scoring" icon="gauge-high">
    Machine learning models analyze onchain behavior to identify high-risk
    addresses including: - Known scam addresses - Mixer/tumbler contracts -
    Phishing attack sources - Address poisoning attempts
  </Accordion>

  {" "}

  <Accordion title="Counterparty Analysis" icon="users">
    For swaps and bridges, Faraday analyzes the counterparties and liquidity
    venues in the transaction path to ensure reputable execution.
  </Accordion>

  <Accordion title="Travel Rule Compliance" icon="passport">
    For jurisdictions requiring Travel Rule compliance, Faraday automatically
    collects and reports necessary information for transfers above threshold
    amounts.
  </Accordion>
</AccordionGroup>

***

## Security Model

<CardGroup cols={2}>
  <Card title="Non-Custodial" icon="lock-open">
    Users sign all transactions locally. Faraday never has access to private
    keys or funds.
  </Card>

  {" "}

  <Card title="Transparent Execution" icon="eye">
    All transactions are submitted to the blockchain exactly as signed, no
    modifications.
  </Card>

  {" "}

  <Card title="Immutable Audit Trail" icon="file-lines">
    Every quote, risk assessment, and transaction is logged for complete
    auditability.
  </Card>

  <Card title="Rate Limiting" icon="gauge">
    API rate limits prevent abuse and ensure fair access for all users.
  </Card>
</CardGroup>

***

## Integration Architecture

Faraday offers multiple integration paths:

<Tabs>
  <Tab title="TypeScript SDK">
    **Best for:** Node.js and browser applications

    * Full type safety with TypeScript
    * Automatic request signing and authentication
    * Built-in retry logic and error handling
    * Event listeners for transaction updates

    ```typescript theme={null}
    import { FaradayClient } from '@rangesecurity/faraday-sdk';

    const faraday = new FaradayClient({ 
      apiKey: process.env.RANGE_API_KEY 
    });
    ```
  </Tab>

  <Tab title="REST API">
    **Best for:** Any language or custom integrations

    * OpenAPI 3.0 specification available
    * Generate clients in any language
    * Direct HTTP access for maximum control
    * Webhook support for async notifications

    ```bash theme={null}
    curl -X POST https://api.faraday.range.org/v1/quotes \
      -H "Authorization: Bearer your_api_key" \
      -H "Content-Type: application/json" \
      -d '{"sourceChain": "solana", "amount": "1000"}'
    ```
  </Tab>
</Tabs>

***

## What's Next?

<CardGroup cols={2}>
  <Card title="FAQ" icon="circle-question" href="/faraday-api/architecture/faq">
    Common questions about Faraday's design and features
  </Card>

  {" "}

  <Card title="Integration Guide" icon="code" href="/faraday-api/integration/index">
    Start building with Faraday SDK or REST API
  </Card>

  {" "}

  <Card title="Supported Networks" icon="network-wired" href="/faraday-api/product-info/supported-networks">
    View all supported blockchains and tokens
  </Card>

  <Card title="API Reference" icon="book" href="/faraday-api/api-introduction">
    Complete API documentation with examples
  </Card>
</CardGroup>
