{"id":47993,"library":"grpc-bchrpc-node","title":"grpc-bchrpc-node","description":"A gRPC client for connecting to BCHD, a Bitcoin Cash full node implementation. Version 0.15.2 provides a JavaScript/TypeScript interface to BCHD's gRPC API, supporting transaction queries, blockchain data retrieval, and SLP token metadata (when node has SLP index enabled). This is a lean wrapper over gRPC, with minimal overhead compared to REST APIs. It supports both Node.js and browser (via grpc-bchrpc-web). The library is maintained by SimpleLedger and has a moderate release cadence, with updates tied to BCHD protocol changes.","status":"active","version":"0.15.2","language":"javascript","source_language":"en","source_url":"https://github.com/simpleledgerinc/grpc-bchrpc-node","tags":["javascript","bch","BCHD","rpc","grpc","bitcoin","cash"],"install":[{"cmd":"npm install grpc-bchrpc-node","lang":"bash","label":"npm"},{"cmd":"yarn add grpc-bchrpc-node","lang":"bash","label":"yarn"},{"cmd":"pnpm add grpc-bchrpc-node","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core gRPC implementation for Node.js","package":"@grpc/grpc-js","optional":false},{"reason":"Loads .proto files for gRPC service definition","package":"@grpc/proto-loader","optional":false},{"reason":"Protobuf runtime for generated message classes","package":"google-protobuf","optional":false}],"imports":[{"note":"Default export is a named export; ESM-only since v0.15. Use named import.","wrong":"const GrpcClient = require('grpc-bchrpc-node')","symbol":"GrpcClient","correct":"import { GrpcClient } from 'grpc-bchrpc-node'"},{"note":"Type interfaces are also named exports. Default import is undefined.","wrong":"import GetRawTransactionRequest from 'grpc-bchrpc-node'","symbol":"GetRawTransactionRequest","correct":"import { GetRawTransactionRequest } from 'grpc-bchrpc-node'"},{"note":"TypeScript users: use 'import type' for interface types to avoid runtime overhead.","wrong":"import { GrpcClientOptions } from 'grpc-bchrpc-node'","symbol":"GrpcClientOptions","correct":"import type { GrpcClientOptions } from 'grpc-bchrpc-node'"}],"quickstart":{"code":"import { GrpcClient } from 'grpc-bchrpc-node';\n\nasync function main() {\n  const client = new GrpcClient({\n    url: process.env.BCHD_URL ?? 'bchd.greyh.at:8335',\n    rootCertPath: process.env.BCHD_CERT_PATH ?? undefined\n  });\n  try {\n    const info = await client.getBlockchainInfo();\n    console.log('Block height:', info.getBestHeight());\n    console.log('Chain:', info.getBchd().getUseragent());\n  } catch (err) {\n    console.error('Error:', err.message);\n  } finally {\n    client.close();\n  }\n}\nmain();","lang":"typescript","description":"Creates a gRPC client connecting to a public BCHD instance, fetches blockchain info, and prints height and user agent."},"warnings":[{"fix":"Use import statements or dynamic import() in CommonJS files.","message":"As of v0.15.0, the package is ESM-only. CommonJS require() will fail with ERR_REQUIRE_ESM.","severity":"breaking","affected_versions":">=0.15.0"},{"fix":"Use `sslCredentials: grpc.credentials.createSsl()` or pass a valid cert path via `rootCertPath` until further notice.","message":"Constructor option `rootCertPath` is deprecated in favor of `sslCredentials`.","severity":"deprecated","affected_versions":">=0.14.0"},{"fix":"Always include `reversedHashOrder: true` in request objects for methods like `getRawTransaction`, `getTransaction`, or `getMerkleProof`.","message":"All transaction hashes must be passed with `reversedHashOrder: true` to match BCHD's byte order (little-endian).","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Check node capabilities via `getBlockchainInfo` and verify SLP index is active before calling SLP-specific RPCs.","message":"SLP token methods (e.g., `getSlpTransaction`) will throw an error if the connected BCHD node does not have SLP index enabled.","severity":"gotcha","affected_versions":">=0.10.0"}],"env_vars":null,"search_vec":"'0.15.2':19 'api':28,58 'bch':90 'bchd':11,25,86,91 'bchrpc':3,68 'bitcoin':13,94 'blockchain':32 'browser':64 'cadenc':81 'cash':14,95 'chang':88 'client':7 'compar':55 'connect':9 'data':33 'enabl':44 'full':15 'grpc':2,6,27,51,67,93 'grpc-bchrpc-node':1 'grpc-bchrpc-web':66 'implement':17 'index':43 'interfac':23 'javascript':89 'javascript/typescript':22 'lean':48 'librari':71 'maintain':73 'metadata':38 'minim':53 'moder':79 'node':4,16,40 'node.js':62 'overhead':54 'protocol':87 'provid':20 'queri':31 'releas':80 'rest':57 'retriev':34 'rpc':92 'simpleledg':75 'slp':36,42 'support':29,60 'tie':84 'token':37 'transact':30 'updat':83 'version':18 'via':65 'web':69 'wrapper':49","created_at":"2026-06-07T16:54:23.003827+00:00","updated_at":"2026-06-07T16:54:23.003827+00:00","problems":[{"fix":"Replace `import GrpcClient from 'grpc-bchrpc-node'` with `import { GrpcClient } from 'grpc-bchrpc-node'`.","cause":"Using default import instead of named import for GrpcClient.","error":"TypeError: grpc_bchrpc_node_1.default is not a function"},{"fix":"Verify BCHD version supports the method. For example, SLP methods require BCHD with SLP index enabled.","cause":"Attempting to call an RPC method that is not supported by the connected BCHD version.","error":"Error: 12 UNIMPLEMENTED: The service is not implemented"},{"fix":"Run `npm install @grpc/grpc-js` alongside grpc-bchrpc-node.","cause":"Missing peer dependency @grpc/grpc-js.","error":"Error: Cannot find module '@grpc/grpc-js'"},{"fix":"Update grpc-bchrpc-node to the latest version and ensure BCHD is up to date.","cause":"Proto file mismatch between client and server, often due to using an outdated version of grpc-bchrpc-node.","error":"Error: 13 INTERNAL: Failed to parse server response"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/simpleledgerinc/grpc-bchrpc-node#readme","github":"https://github.com/simpleledgerinc/grpc-bchrpc-node","docs":null,"changelog":null,"pypi":null,"npm":"grpc-bchrpc-node","openapi_spec":null,"status_page":null,"smithery":null,"categories":["blockchain"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}