morphit/node_modules/@beblurt/dblurt/guide/failover.md

2.2 KiB

RPC failover

Client accepts a single endpoint or an ordered endpoint list.

const client = new Client(rpcList, {
    timeout: 10_000,
    failoverThreshold: 3,
    consoleOnFailover: true,
    userAgent: 'Morphit/1.7.5'
});

Behavior covered by contract tests

  • The first healthy endpoint remains sticky across repeated successful calls.
  • Timeout failures can move the client to the next endpoint.
  • client.currentAddress is updated when the active endpoint changes.
  • timeout: 0 remains a no-immediate-timeout success path on healthy local endpoints.
  • FC-style JSON-RPC application errors are mapped to the public RPCError shape.
  • JSON-RPC responses with mismatched ids are rejected.

Options

Option Default Meaning
timeout 60000 Milliseconds before an RPC request is aborted. Current behavior around explicit 0 should be treated as compatibility-sensitive and validated in your target path.
failoverThreshold 3 Number of retry/failover rounds. Infinite-retry semantics are compatibility-sensitive; avoid unbounded retries in request/response services unless deliberately tested.
consoleOnFailover false Log failover events to console.log on the default transport.
userAgent dblurt/<version> Application-specific HTTP User-Agent sent by Node.js RPC requests. Browsers forbid scripts from setting this header.
backoff internal default Function returning retry delay in milliseconds.
chainId Blurt mainnet chain id Override for non-mainnet usage.
addressPrefix BLT Override address prefix for non-mainnet usage.
const rpcList = [
    'https://rpc.blurt.blog',
    'https://blurt-rpc.saboin.com',
    'https://rpc.beblurt.com',
    'https://blurtrpc.dagobert.uk',
    'https://rpc.drakernoise.com'
];

Node health

For operational node monitoring, see the Blurt node checker:

https://gitlab.com/beblurt/blurt-nodes-checker

Security notes

RPC endpoints are not automatically trusted. Server-side applications should not accept arbitrary user-provided RPC URLs without allowlisting and network egress controls. Prefer trusted HTTPS endpoints for production. See Security guide.