paritytech / paritytech/polkadot-cli
feat: support multiple RPC providers per chain with fallback
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 10
- Forks
- 2
- Avg merge
- 12h 35m
- Merged PRs (30d)
- 4
Description
Problem
Each chain has a single rpc: string endpoint. If that endpoint is unreachable, the CLI fails with no automatic recovery. This is especially problematic for public RPC endpoints which can have downtime.
Proposal
Allow configuring multiple RPC endpoints per chain with automatic fallback.
Type change (src/config/types.ts)
export interface ChainConfig {
rpc: string | string[]; // single URL or ordered list (first = primary)
lightClient?: boolean;
}
Fallback behavior
- Try endpoints in order; on connection failure or timeout, try the next
- Log which endpoint was selected
- The
--rpcCLI flag overrides all configured endpoints with the given URL
CLI changes
dot chain add <name> --rpc wss://a --rpc wss://b— add chain with multiple RPCs- Consider
dot chain rpc add/remove/list <name>subcommands for managing endpoints on existing chains
Example built-in config with multiple providers
polkadot: {
rpc: [
"wss://rpc.polkadot.io",
"wss://polkadot-rpc.dwellir.com",
"wss://rpc.ibp.network/polkadot",
],
}
Files to modify
src/config/types.ts— changerpctype tostring | string[]src/core/client.ts— implement fallback logic increateChainClientsrc/commands/chain.ts— support multiple--rpcflagssrc/config/store.ts— ensure config read/write handles arrays
Considerations
- Backward compatible: existing configs with
rpc: "wss://..."still work - Investigate if
polkadot-api'sgetWsProvideralready supports multiple URLs before building custom fallback - Keep it simple: only fail over on connection error, no proactive health checks
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/config/types.ts and investigate whether polkadot-api's getWsProvider already accepts multiple URLs. Trace createChainClient in src/core/client.ts, then review src/commands/chain.ts and src/config/store.ts for CLI parsing and config persistence. Done means ordered fallback works for connection failures and timeouts, logging identifies the selected endpoint, and a single --rpc override remains supported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100