# rn-electrum-client

> Electrum protocol client for React Native & Node.js

Latest version **0.0.22** (published 2025-03-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install rn-electrum-client
pnpm add rn-electrum-client
yarn add rn-electrum-client
bun add rn-electrum-client
```

## Health

**Score 25/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.22 |
| Published | 2025-03-19 |
| First published | 2023-11-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6 |
| Dependencies | 0 |
| Unpacked size | 66.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | synonymdev |
| Maintainers | limpbrains, coreyphillips, jayvdb, bitcoinerrorlog, miguelmedeirosweb, pwltr, shacollision |
| Keywords | client, electrum, bitcoin, nodejs |

## Links

- npm: https://www.npmjs.com/package/rn-electrum-client
- Repository: https://github.com/synonymdev/react-native-electrum-client
- Homepage: https://github.com/synonymdev/react-native-electrum-client#readme
- Issues: https://github.com/synonymdev/react-native-electrum-client/issues
- npm.io page: https://npm.io/package/rn-electrum-client

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 0.0.22 (latest) — 2025-03-19
- 0.0.21 — 2025-01-12
- 0.0.20 — 2025-01-12
- 0.0.19 — 2024-07-12
- 0.0.18 — 2024-06-20
- 0.0.17 — 2024-06-12
- 0.0.16 — 2024-05-09
- 0.0.15 — 2024-03-05
- 0.0.14 — 2024-03-05
- 0.0.13 — 2024-03-05
- 0.0.12 — 2024-02-22
- 0.0.11 — 2024-02-01
- 0.0.10 — 2023-11-28
- 0.0.9 — 2023-11-28

## README

## Install
 - `yarn add rn-electrum-client`

## Usage & Examples
```js
import {
    start,
    getPeers,
    getAddressScriptHashBalance,
    getAddressScriptHashBalances,
    subscribeHeader,
    subscribeAddress
} from "rn-electrum-client/helpers";

//Connect To A Random Electrum Server
const startResponse = await start({ network: "bitcoinTestnet" });
console.log(startResponse);
if (startResponse.error) return;

//Get Server Peers
const getPeersResponse = await getPeers({ network: "bitcoinTestnet" });
console.log(getPeersResponse);

//Get Address Balance
const getAddressScriptHashBalanceResponse = await getAddressScriptHashBalance({
    network: "bitcoinTestnet",
    scriptHash: "77ca78f9a84b48041ad71f7cc6ff6c33460c25f0cb99f558f9813ed9e63727dd"
});
console.log(getAddressScriptHashBalanceResponse);

//Subscribe To Headers
const subscribeHeaderResponse = await subscribeHeader({
    network: "bitcoinTestnet",
    onReceive: (data) => { console.log("New block!", data); } 
});
console.log(subscribeHeaderResponse);

//Subscribe To An Address
const subscribeAddressResponse = await subscribeAddress({
  network: "bitcoinTestnet",
  scriptHash: "77ca78f9a84b48041ad71f7cc6ff6c33460c25f0cb99f558f9813ed9e63727dd", //tb1qnv5luf8mav8263sxfa4fdr3m6kws74n0yfzzrx
  onReceive: (data) => { console.log("Received some Testnet BTC!", data); }
});
console.log(subscribeAddressResponse);

//Get Address Balances (Batch Method)
const getAddressScriptHashes = [
	"21031994b184684de964e930e9937b1b6d75c9af12bb99ae6ee266a724e12632",
	"9ff2d1500272589aff699e1582dbc2f47a7bbe19f7d3a4d77e1c9e54735d4fc4",
	"bfb2a1c0a45421f908e0b3f63cee65a2dee33ae276bdb82c6f53f6ec1d53093b",
	"ce2b6d0b4ed19ff9b264d1d218220cae85388b6d53a539bd0852404b65d74b1b",
	"4470798cb53a34f8adf763248c90b7b09e6375043a74346d5ad9a1b6c6cc1130"
];
const getAddressScriptHashBalancesResponse = await getAddressScriptHashBalances({
    scriptHashes: getAddressScriptHashes,
  	network: "bitcoinTestnet"
});
console.log(getAddressScriptHashBalancesResponse);

/*
We are also able to get out what we put in using the following patterns.
This works with any batch method.
*/
const getAddressScriptHashes2 = {
    key: "scriptHash",
    data: [
        {
            address: "tb1qnv5luf8mav8263sxfa4fdr3m6kws74n0yfzzrx",
            path: "m/84'/1'/0'/0/0",
            scriptHash: "77ca78f9a84b48041ad71f7cc6ff6c33460c25f0cb99f558f9813ed9e63727dd"
        },
    ]
};
const getAddressScriptHashBalancesResponse2 = await getAddressScriptHashBalances({
    scriptHashes: getAddressScriptHashes2,
  	network: "bitcoinTestnet"
});
console.log(getAddressScriptHashBalancesResponse2);

const getAddressScriptHashes3 = {
    key: "scriptHash",
    data: {
        77ca78f9a84b48041ad71f7cc6ff6c33460c25f0cb99f558f9813ed9e63727dd: {
            address: "tb1qnv5luf8mav8263sxfa4fdr3m6kws74n0yfzzrx",
            path: "m/84'/1'/0'/0/0",
            scriptHash: "77ca78f9a84b48041ad71f7cc6ff6c33460c25f0cb99f558f9813ed9e63727dd"
        },
    }
};
const getAddressScriptHashBalancesResponse3 = await getAddressScriptHashBalances({
    scriptHashes: getAddressScriptHashes3,
  	network: "bitcoinTestnet"
});
console.log(getAddressScriptHashBalancesResponse3);
```

---
_Source: https://npm.io/package/rn-electrum-client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
