How route comparison works
When you initiate a transfer, PayOnProof searches for available routes between your origin and destination countries:- Query anchor catalog - The system queries active anchors from the database that support your corridor
- Fetch capabilities - For each anchor, PayOnProof validates SEP-24, SEP-6, and SEP-31 support via their
stellar.toml - Calculate routes - The engine pairs on-ramp anchors (origin) with off-ramp anchors (destination)
- Score and rank - Routes are scored based on fees, speed, and operational status
Routes are generated dynamically based on real anchor availability. If no anchors support your corridor, the API will return an empty routes array with a diagnostic reason.
Route scoring algorithm
PayOnProof uses a multi-factor scoring system to recommend the best route:Scoring factors
- Fee percentage (50% weight) - Routes with lower fees score higher
- Speed (30% weight) - Faster estimated settlement times increase score
- Availability (20% weight) - Operational anchors with valid SEP endpoints get a bonus
Real code example
Here’s how the route comparison API works under the hood:services/api/api/compare-routes.ts
services/api/lib/remittances/compare/service.ts
The comparison service runs capability checks in parallel to minimize latency. Anchor capabilities are cached for 10 minutes to reduce redundant SEP-1 lookups.
UI flow
Users interact with route comparison through a three-step interface:Step 1: Search form
Users select origin country, destination country, and amount:Country selection
Countries are populated from
/api/anchors/countries, which returns only countries with active anchors in the catalog.Amount input
Asset codes (USDC, XLM) vary per route. The form shows “Varies” to indicate this.
Step 2: Route cards
After search, you see all available routes with:- Origin and destination anchors - Clear provider names
- Fee breakdown - On-ramp fee + bridge fee (0.2%) + off-ramp fee
- Exchange rate - Real-time FX rate for the corridor
- Estimated time - Settlement time in minutes
- Received amount - Exact amount recipient gets after all fees
services/web/components/route-card.tsx
Step 3: Sort and filter
You can sort routes by:- Best (recommended) - Highest scored route based on the algorithm
- Cheapest - Lowest fee percentage
- Fastest - Shortest estimated settlement time
Fee transparency
Every route shows a complete fee breakdown:- You send: 500 USDC
- On-ramp fee: 0.8% (4 USDC)
- Bridge fee: 0.2% (1 USDC)
- Off-ramp fee: 1.2% (6 USDC)
- Total fee: 2.2% (11 USDC)
- Recipient gets: 489 USDC
If an anchor doesn’t publish fee information in their SEP-24/SEP-6
/info endpoint, PayOnProof uses a fallback estimated fee (default 1.5%) and marks it as “estimated” in diagnostics.API request/response
Request
Response
Edge cases
No routes available
If no anchors support your corridor:Partial anchor outages
If some anchors are offline, you’ll still see available routes. TheanchorDiagnostics array shows why certain anchors were excluded:
Route comparison is designed to degrade gracefully. Even if half the anchors are down, you’ll see the best available options.
Performance optimizations
- Parallel capability resolution - All anchor SEP checks run concurrently
- 10-minute capability cache - Reduces redundant
stellar.tomlfetches - Route limit - Maximum 12 routes returned (configurable via
MAX_COMPARE_ROUTES) - Database fallback - If Supabase is unreachable, falls back to local
anchors-export.json
Next steps
Execute a transfer
Learn how to execute a selected route using SEP-10 + SEP-24
Anchor management
Understand how anchors are discovered, validated, and synced