Registry / blockchain / grpc-bchrpc-browser

grpc-bchrpc-browser

JSON →
library0.16.5-v2jsnpmunverified

A gRPC-web client for connecting browser applications to a bchd (Bitcoin Cash full node) server. Version 0.16.5-v2 is current. Built by Google's grpc/grpc-web library (not the older @improbable-eng/grpc-web) for long-term stability. Ships TypeScript definitions. Includes utilities for hex/base64/Uint8Array conversion, merkle proof validation, and compact filter matching. Notable limitation: lacks FETCH support (only XHR). Alternative: grpc-bchrpc-web (improbable-eng) for Node.js or web.

npm install grpc-bchrpc-browser
INSTALL
IMPORT
SIG · GRPC-BCHRPC-BROWSE
G
grpc-bchrpc-browser
blockchainjavascriptv0.16.5-v2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

GrpcClient
import { GrpcClient } from 'grpc-bchrpc-browser'
const GrpcClient = require('grpc-bchrpc-browser')
ESM only; TypeScript types are included.
GetMempoolInfoRequest
import { GetMempoolInfoRequest } from 'grpc-bchrpc-browser'
import GetMempoolInfoRequest from 'grpc-bchrpc-browser'
Named export, not default.
GrpcClient (default import)
import GrpcClient from 'grpc-bchrpc-browser'
import { GrpcClient } from 'grpc-bchrpc-browser'
GrpcClient is also exported as default. Both work.

Creates a gRPC client, sends a GetMempoolInfo request, and logs the mempool size.

import { GrpcClient } from 'grpc-bchrpc-browser'; import { GetMempoolInfoRequest } from 'grpc-bchrpc-browser'; const client = new GrpcClient('https://your-bchd-server:443', { withCredentials: false }); const request = new GetMempoolInfoRequest(); client.getMempoolInfo(request, {}, (err, response) => { if (err) { console.error('Error:', err); } else { console.log('Mempool size:', response.getSize()); } });
Debug
Known issues
gotchaOnly supports XHR transport; no Fetch support. Ensure your Content Security Policy allows XHR.
fix
Use XHR-compatible endpoints or switch to improbable-eng grpc-web for Fetch support.
affects: all
breakinggrpc-web library changes may break this package. Check compatibility with grpc-web versions.
fix
Pin 'grpc-web' to a known compatible version (e.g., 1.x) in package.json.
affects: >=0.16.0
deprecatedThe import path may change in future versions. Always import from the package root.
fix
Import from 'grpc-bchrpc-browser' directly; avoid deep imports like 'grpc-bchrpc-browser/lib/...'.
affects: all
Errors
Common errors & fixes
Module not found: Error: Can't resolve 'grpc-bchrpc-browser' in ...
Missing npm install or incorrect package.json configuration.
fix
Run 'npm install grpc-bchrpc-browser' and ensure your bundler resolves node_modules.
GrpcClient is not a constructor
Importing incorrectly (e.g., default import when using named export) or using CommonJS require in ESM context.
fix
Use 'import { GrpcClient } from 'grpc-bchrpc-browser'' instead of 'const GrpcClient = require(...)'.
XMLHttpRequest cannot load https://... due to access control checks.
CORS or missing Access-Control-Allow-Origin header on the bchd server.
fix
Ensure the gRPC-web proxy (e.g., Envoy) is set up to allow CORS and forward to bchd.
Upgrade
Version history
0.16.5-v2latest on npm
Audit
Dependencies
google-protobufrequiredRequired by grpc-web for protobuf serialization
grpc-webrequiredCore gRPC-web transport library
Agent activity
27 hits · last 30 days
node
22
OpenAI (training)
1
Resources
grpc-bchrpc-browser — npm install grpc-bchrpc-browser · libregistry