Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
grpc-bchrpc-browser
Advanced tools
A bchd rpc client for browsers using grpc/grpc-web
This package provides a simple gRPC client for connecting web applications to a bchd full node.
A mobile friendly version of this project is formatted from markdown by github pages.
For a quick example usage subscribing transactions see the console here, or an experimental example using this module in a web worker.
Detailed RPC Documentation for the rpc protocol is a work in progress.
Client Documentation detailing methods and utility functions.
Mocha browser tests should provide some working examples.
This is slightly more than a stock client generated from protocol buffers. The following utilities have been added:
For Bitcoin Cash and bchd specifically, functions are currently here to validate a transaction and block, as well as other utilities to handle different data types used or sent by bchd.
This project uses Google's grpc/grpc-web library to generate a client, rather than the older and more widely used @improbable-eng/grpc-web.
The client is built from the pb files in advance rather than on-the-fly, a functionality which may be employed with the @improbable library.
The motivation is toward lower maintenance, long-term stability and support by using the google library, not that this thinking played out well with the framework formerly known as angular.
One notable limitation of the official grpc/grpc-web library is a lack of FETCH support.
Alternative implementations of this project are built using the improbable-eng library here:
Note: this project was created in node v12.2.0 (LTS) and used protoc
version 3.11.4; and is open to using features from es2017 although initially targeted at es6.
To build:
npm run build # transpile typescript, browserify and minify use
npm run build:docs # build documentation for the client class
Tests can be run either from console or in a browser. The typescript is loaded via ts-node, in that context.
npm run test # run tests in node
npm run test:browser # run tests in a browser
If for some reason you need to update the gcash proto files yourself to add some future functionality use:
npm run pb-clean # remove old definitions
npm run pb-update # download bchrpc.proto from gcash/bchd/master
npm run pb-build # create client library
npm run pb-doc # generate documentation
Important: an installed version of protoc
is required to run pb-build
.
IN ADDITION you must have protoc-gen-grpc-web
, see grpc-web
To facilitate debugging and development of the client, it may be useful make calls using a webui. The following npm scripts are provided, assuming you have golang installed.
npm run pb-grpcui-install # install grpcui
npm run pb-grpcui # run a local webui against a bchd node
Mainnet:
Testnet:
FAQs
BCHD gRPC client for browsers
The npm package grpc-bchrpc-browser receives a total of 1 weekly downloads. As such, grpc-bchrpc-browser popularity was classified as not popular.
We found that grpc-bchrpc-browser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.