Overview
The anchor catalog sync process:- Discovers Stellar anchors from various sources
- Validates anchor capabilities via stellar.toml (SEP-1)
- Updates the database with SEP support (SEP-6, SEP-10, SEP-24, SEP-31)
- Marks anchors as operational or inactive based on health checks
- Runs automatically on a schedule via Vercel cron jobs
Discovery modes
PayOnProof supports multiple anchor discovery modes:Directory mode (default)
Uses a curated JSON export of anchors from a directory service..env
Horizon mode (recommended for production)
Discoverers issuers and home domains directly from the Stellar Horizon API..env
Horizon mode is more reliable as it discovers anchors directly from the blockchain, but may take longer to complete.
Automatic sync with Vercel cron
The API service includes a Vercel cron job that runs anchor synchronization automatically.Cron configuration
File:services/api/vercel.json
0 0 * * *- Daily at midnight0 */6 * * *- Every 6 hours*/15 * * * *- Every 15 minutes
Cron endpoint
Endpoint:GET /api/anchors/ops
Query parameters:
secret- Cron secret for authentication (optional but recommended)sourceUrl- Override anchor directory URLrefreshLimit- Max number of anchors to refresh (default: 300)directoryHome- Custom directory home URLmode- Force discovery mode (horizonordirectory)issuerLimit- Max issuers to check in horizon mode (default: 300)assetPages- Number of asset pages to scan (default: 5)horizonUrl- Override Horizon network URL
Testing the cron endpoint locally
Protecting the cron endpoint
Set aCRON_SECRET environment variable:
.env
?secret=YOUR_SECRET query parameter.
Manual sync scripts
For development or one-time imports, use the provided npm scripts.Auto sync
Automatically discovers and syncs anchors:Import from file
Import anchors from a local JSON/CSV file:Bootstrap anchors
Fully automatic bootstrap (import + SEP refresh):Seed import
Import from a curated seed file with anchor definitions:anchor-seeds.json
GitHub Actions for automated exports
PayOnProof includes a GitHub Actions workflow for automated anchor directory exports. File:.github/workflows/anchors-directory-export.yml
- Runs every 30 minutes (or on manual trigger)
- Uses Playwright to scrape the Stellar anchor directory
- Generates
services/api/data/anchors-export.json - Commits changes if the export file changed
.env
Runtime API endpoints
Use these endpoints to manage the catalog in production:List supported countries
Query catalog
country- Filter by country codetype- Filter by type (on-ramporoff-ramp)operationalOnly- Only return operational anchors
Refresh capabilities
Anchor health checks
SEP-1 validation (stellar.toml)
The sync process validates each anchor’sstellar.toml file:
- Checks for HTTP 200 response
- Validates TOML format
- Extracts SEP endpoints
- Marks anchors with 404 errors as inactive after threshold
.env
stellar.toml are automatically disabled.
Operational status
An anchor is marked as operational if:stellar.tomlis accessible (SEP-1)- At least one SEP endpoint is configured (SEP-6, SEP-24, or SEP-31)
- Recent capability check succeeded
Trust and validation settings
Configure anchor trust requirements:.env
ANCHOR_TRUST_REQUIRE_SEP10- Require SEP-10 web authenticationANCHOR_TRUST_REQUIRE_SIGNING_KEY- Require valid signing key in stellar.tomlANCHOR_TRUST_REQUIRE_SEP24_OR_SEP31- Require hosted or direct payment support
Monitoring sync operations
Vercel function logs
- Go to Vercel Dashboard → Your API Project
- Click Deployments → Select a deployment
- Click Functions → Find
/api/anchors/ops - View execution logs and errors
Database diagnostics
Theanchors_catalog table includes a diagnostics JSONB column:
- SEP endpoint discovery results
- HTTP error codes
- Validation failures
Last check timestamp
Production recommendations
Set up alerting
Monitor cron job failures in Vercel dashboard or integrate with monitoring tools.
Troubleshooting
No routes found
If/api/compare-routes returns empty:
-
Check if anchors exist for the corridor:
-
Verify anchors are marked as operational:
-
Manually refresh capabilities:
Sync timeouts
If horizon mode times out:- Reduce
issuerLimitandassetPages - Use
directorymode instead - Upgrade Vercel plan for longer function timeouts
Invalid stellar.toml
If anchors fail validation:- Check
diagnosticsfield in database - Verify anchor domain is accessible
- Test manually:
curl https://anchor.example.com/.well-known/stellar.toml