Skip to content

feat: add settings to enable/disable worker proxy for AI and RPC calls #340

@AugustoL

Description

@AugustoL

Summary

A clear and concise description of the feature you'd like to see.

Add a new section in the Settings page that allows users to enable or disable the OpenScan worker proxy independently for AI analysis and RPC calls (EVM, Bitcoin, Beacon).

Motivation

Why is this feature needed? What problem does it solve?

Currently the worker proxy is always used when available, with no user control. Users may want to:

  • Disable AI analysis entirely (privacy, data concerns)
  • Use their own RPC endpoints directly instead of the shared proxy (custom API keys, private nodes, lower latency)
  • Disable only one category while keeping the other (e.g., use proxy for RPC but not AI)

Giving users control over this aligns with OpenScan's trustless, open-source philosophy.

Proposed Solution

Describe how you envision this feature working.

Settings Page Section

Add a "Worker Proxy" section in the Settings page with two toggles:

  1. AI Analysis — Enable/disable the /ai/analyze worker proxy

    • When disabled: hide or disable the AI analysis button in transaction/block/address pages
    • Default: enabled
  2. RPC Proxy — Enable/disable the /evm/*, /btc/*, /beacon/* worker proxy routes

    • When disabled: the app uses only user-configured RPC endpoints directly
    • Default: enabled

Implementation

  • Add workerAiEnabled and workerRpcEnabled flags to SettingsContext
  • Persist in localStorage (consistent with existing settings pattern)
  • Conditionally include worker RPC URLs in the provider list based on the setting
  • Conditionally show/hide AI analysis UI based on the setting
  • Add i18n keys for the new section in all 5 locales (en, es, ja, pt-BR, zh)

Alternatives Considered

Any alternative solutions or features you've considered.

  • Single toggle for all worker usage: Simpler, but less flexible — users may want AI without proxy RPC or vice versa
  • Per-provider granularity (Alchemy proxy, Infura proxy, etc.): Too granular, adds complexity without clear benefit

Additional Context

Add any other context, mockups, or screenshots about the feature request.

The worker proxy is configured in src/config/workerConfig.ts and used by:

  • AI analysis: src/routes/analyze.ts
  • EVM RPC: provider URLs built from the worker base URL
  • Bitcoin RPC: provider URLs built from the worker base URL
  • Beacon API: src/hooks/useBeaconBlobs.ts
  • Etherscan verification: src/hooks/useEtherscan.ts / src/hooks/useContractVerification.ts

Acceptance Criteria

  • New "Worker Proxy" section visible in Settings page
  • Toggle for AI analysis (enable/disable)
  • Toggle for RPC proxy (enable/disable)
  • Settings persisted in localStorage
  • AI UI hidden/disabled when AI toggle is off
  • RPC calls bypass worker proxy when RPC toggle is off
  • i18n translations added for all 5 supported languages
  • Settings respected across page navigation and refresh

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions