@samouraiwallet/electrum-client
Electrum Protocol client for Node.js.
This library uses ESModules, Node.js v14 or higher is required.
Based on
Features
- Persistence (ping strategy and reconnection)
- Batch requests
- Promise API
- Fully typed (Typescript)
Protocol spec
Usage
import {ElectrumClient} from "@samouraiwallet/electrum-client";
const run = async () => {
const tcpClient = new ElectrumClient(60001, 'btc.electroncash.dk', 'tcp');
await tcpClient.initElectrum({client: 'electrum-client-js', version: ['1.2', '1.4']}, {
retryPeriod: 5000,
maxRetry: 10,
pingPeriod: 5000,
});
const rawTx = await tcpClient.blockchainTransaction_get('b270b8a113c048ed0024e470e3c7794565c2b3e18c600d20410ec8f454b7d25a');
return rawTx;
}