The package `electrum-client` (npm: `electrum-client`, GitHub: `you21979/node-electrum-client`) provides a Node.js client for interacting with ElectrumX servers using the Electrum protocol. It supports core functionalities like TCP/TLS connections, JSON-RPC method calls for querying blockchain data (e.g., server version), and EventEmitter for handling real-time subscription messages (e.g., blockchain headers). As of its latest version, 0.0.6, the package has not seen updates since its last publish date approximately eight years ago (February 2018), indicating an abandoned state. A key differentiator initially was its explicit lack of external dependencies. However, due to its age, developers should be aware that more actively maintained and feature-rich alternatives exist under similar names, such as `@samouraiwallet/electrum-client`, `@bitcoinerlab/electrum-client`, and `@mempool/electrum-client`, many of which offer ES Module compatibility and TypeScript support. The original `electrum-client` is strictly a CommonJS module.
npm install electrum-clientVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to connect to an ElectrumX server, subscribe to new block headers, and make a basic JSON-RPC call to fetch the server's version.
Migrate to a more actively maintained Electrum client library, such as `@samouraiwallet/electrum-client`, `@mempool/electrum-client`, or `@bilthon/electrum-client-ts`, which offer ongoing support and modern features.
Thoroughly test compatibility with your specific Node.js runtime and ElectrumX server version. For production use, migrating to a modern, maintained client is strongly recommended.
Always use `const ElectrumCli = require('electrum-client')` to import the library. For projects requiring full ESM compatibility, consider alternative modern Electrum client libraries that provide native ES module support.Consider migrating to a modern Electrum client library that offers first-party TypeScript support for improved type safety and maintainability.
Always connect to well-known, trusted ElectrumX servers and verify server hostnames. For sensitive applications, consider running your own ElectrumX server or using a client that offers advanced security features like strong certificate pinning and server authenticity checks. Exercise extreme caution with TLS connections if the certificate chain cannot be fully verified.
Change the import statement to `const ElectrumCli = require('electrum-client')`.Verify the server's IP address and port, ensure the server is running, check any local or network firewalls, and confirm you are using the correct protocol ('tcp' or 'tls') as specified by the server. Try connecting to a different known good public Electrum server to rule out client-side issues.Ensure the Electrum server you are connecting to supports the protocol version used by this client (likely an older version). Consult the server's documentation or try a different server. Consider updating to a more modern Electrum client library that supports current protocol versions.
No dependency data recorded yet.