Skip to main content
bitcoinPortalStream() reads Bitcoin blocks from SQD Portal and applies one or more query outputs.

Options

When portal is an object, it accepts url, finalized, http, maxBytes, maxIdleTimeMs, maxWaitTimeMs, and headPollIntervalMs. Use for await to consume batches, .pipe() to add a whole-stream transformer, or .pipeTo() to connect a target.

RPC latency watcher

bitcoinRpcLatencyWatcher() compares the latest Portal block with one or more Bitcoin Core JSON-RPC endpoints. Bitcoin Core does not expose a block WebSocket, so the watcher polls getbestblockhash and getblockheader.
Each non-null output contains the Portal block number and timestamp, portal.receivedAt, and an rpc array with each sanitized url, optional block hash and receivedAt, and portalDelayMs. For an authenticated node, put the credentials in the URL, for example http://user:[email protected]:8332. The watcher sends them with HTTP Basic authentication and removes them from emitted URLs, logs, and metrics. See the query builder reference for typed fields and filters.