Registry / blockchain / pactus-grpc

pactus-grpc

JSON →
library1.13.0jsnpmunverified

JavaScript client for interacting with the Pactus blockchain via gRPC. Current stable version is 1.13.0. The package provides protobuf-generated classes and gRPC service stubs for blockchain, transaction, wallet, and network operations. Key differentiator: direct gRPC interface to Pactus nodes without REST intermediaries. Supports both Node.js and browser environments. Published with moderate release cadence aligned with Pactus network updates.

npm install pactus-grpc
INSTALL
IMPORT
SIG · PACTUS-GRPC
P
pactus-grpc
blockchainjavascriptv1.13.0
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.

BlockchainClient
import { BlockchainClient } from 'pactus-grpc/blockchain_grpc_pb';
import { BlockchainClient } from 'pactus-grpc';
Must import from specific service file, not package root. Module exports protobuf-generated classes per service.
GetBlockchainInfoRequest
import { GetBlockchainInfoRequest } from 'pactus-grpc/blockchain_pb';
const GetBlockchainInfoRequest = require('pactus-grpc/blockchain_pb').GetBlockchainInfoRequest;
ESM-only package; require() will fail. Use named import from message proto file.
TransactionClient
import { TransactionClient } from 'pactus-grpc/transaction_grpc_pb';
import { TransactionClient } from 'pactus-grpc';
Similar to BlockchainClient, must specify the correct grpc_pb file for the service.

Demonstrates creating a gRPC client to query blockchain info from a local Pactus node.

import grpc from '@grpc/grpc-js'; import { GetBlockchainInfoRequest } from 'pactus-grpc/blockchain_pb'; import { BlockchainClient } from 'pactus-grpc/blockchain_grpc_pb'; const client = new BlockchainClient( "127.0.0.1:50051", grpc.credentials.createInsecure() ); const request = new GetBlockchainInfoRequest(); client.getBlockchainInfo(request, (err, response) => { if (err) { console.error(err); } else { console.log(response.toObject()); } });
Debug
Known issues
breakingPackage is ESM-only. CommonJS require() will throw an error.
fix
Use ES module import syntax or set \"type\": \"module\" in package.json.
affects: >=1.0
gotchaImport must come from specific proto files (e.g., blockchain_grpc_pb), not package root.
fix
Always import classes from their respective *_pb.js or *_grpc_pb.js files.
affects: *
gotchagRPC port defaults to 50051; ensure the Pactus node is running and not firewalled.
fix
Verify Pactus node configuration and network connectivity.
affects: *
deprecatedOlder versions used @grpc/proto-loader; current version uses precompiled protobuf classes.
fix
Upgrade to 1.x and switch to direct imports from generated files.
affects: <1.0
Errors
Common errors & fixes
Cannot find module 'pactus-grpc/blockchain_grpc_pb'
Incorrect path or missing dependency after installation.
fix
Run 'npm install pactus-grpc' and verify node_modules contains the package files.
TypeError: BlockchainClient is not a constructor
Importing from wrong path or using default import instead of named.
fix
Use import { BlockchainClient } from 'pactus-grpc/blockchain_grpc_pb';
Error: 14 UNAVAILABLE: failed to connect to all addresses
Pactus node not running or firewall blocking gRPC port.
fix
Start the Pactus node and ensure port 50051 is accessible.
Upgrade
Version history
1.13.0latest on npm
Audit
Dependencies
@grpc/grpc-jsrequiredCore gRPC runtime required for client creation and connection management
Agent activity
36 hits · last 30 days
node
32
OpenAI (training)
1
Resources
pactus-grpc — npm install pactus-grpc · libregistry