Skip to content

Route Silent Payment indexer connections through Tor #68

Description

@theanmolsharma

Problem

The SilentPaymentIndexer currently connects to the indexer over clearnet via IndexerHttpClient, which uses a basic fetch wrapper (util/fetch.ts) with no proxy support. The indexer is available as a Tor hidden service, but there is no mechanism to route requests through Tor.

This leaks metadata — the user's IP address is exposed to the indexer server on every call to /transactions/height/:height, /silent-block/latest-height, and /health.

Current Architecture

  • SilentPaymentIndexer (blue_modules/SilentPaymentIndexer.ts) creates an IndexerHttpClient with a plain baseUrl
  • IndexerHttpClient (helpers/silent-payments/IndexerHttpClient.ts) calls fetch() directly with no proxy/agent configuration
  • SilentPaymentIndexerConfig (helpers/silent-payments/types.ts) has no fields for Tor/proxy settings
  • The codebase already has passive .onion awareness in BlueElectrum.ts (extended timeouts for onion peers) and class/lnurl.ts (onion URL detection), but no active SOCKS proxy integration

Requirements

  • Route IndexerHttpClient HTTP requests through a SOCKS5 proxy to reach the indexer's .onion address
  • Extend SilentPaymentIndexerConfig to accept Tor/proxy configuration (e.g., SOCKS5 host/port, .onion base URL)
  • Handle longer latency inherent to Tor (adjust default timeouts for onion connections)
  • Fail gracefully if the Tor proxy is unavailable (with a clear error, optionally falling back to clearnet based on user preference)
  • Ensure compatibility with React Native's networking layer (react-native-tcp-socket is already a dependency)

Relevant Files

  • blue_modules/SilentPaymentIndexer.ts — indexer wrapper
  • helpers/silent-payments/IndexerHttpClient.ts — HTTP client (needs proxy support)
  • helpers/silent-payments/types.ts — config type definitions
  • util/fetch.ts — fetch wrapper (may need SOCKS agent support)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions