# cashaddrjs

> Bitcoin Cash cashaddr address format support for Node.js and web browsers.

Latest version **0.4.4** (published 2020-12-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install cashaddrjs
pnpm add cashaddrjs
yarn add cashaddrjs
bun add cashaddrjs
```

## Health

**Score 33/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.4.4 |
| Published | 2020-12-26 |
| First published | 2018-01-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/cashaddrjs) |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 107.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 38 |
| Author | Emilio Almansi |
| Maintainers | ealmansi |
| Keywords | bitcoin, cash, cashaddr, address, format, node, browser |

## Links

- npm: https://www.npmjs.com/package/cashaddrjs
- Repository: https://github.com/ealmansi/cashaddrjs
- Homepage: https://github.com/ealmansi/cashaddrjs#readme
- Issues: https://github.com/ealmansi/cashaddrjs/issues
- npm.io page: https://npm.io/package/cashaddrjs

## Dependencies (1)

- [big-integer](https://npm.io/package/big-integer.md) 1.6.36

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.4.4 (latest) — 2020-12-26
- 0.4.1 (0.4.1) — 2020-12-26
- 0.4.0 (0.4.0) — 2020-12-26
- 0.4.3 — 2020-12-26
- 0.4.2 — 2020-12-26
- 0.3.12 — 2020-06-18
- 0.3.11 — 2020-04-04
- 0.3.10 — 2020-03-15
- 0.3.9 — 2019-12-30
- 0.3.8 — 2019-08-27
- 0.3.7 — 2019-08-27
- 0.3.6 — 2019-07-16
- 0.3.5 — 2019-06-24
- 0.3.4 — 2019-06-24
- 0.3.3 — 2019-03-06
- … 21 more at https://npm.io/package/cashaddrjs/versions

## README

# CashAddr.js: The new Bitcoin Cash address format for Node.js and web browsers.

[![Build Status](https://travis-ci.org/ealmansi/cashaddrjs.svg?branch=master)](https://travis-ci.org/ealmansi/cashaddrjs) [![Coverage Status](https://coveralls.io/repos/github/ealmansi/cashaddrjs/badge.svg?branch=master)](https://coveralls.io/github/ealmansi/cashaddrjs?branch=master)

[![NPM](https://nodei.co/npm/cashaddrjs.png?downloads=true)](https://nodei.co/npm/cashaddrjs/)

JavaScript implementation for the new CashAddr address format for Bitcoin Cash.

Compliant with the original CashAddr [specification](https://github.com/bitcoincashorg/bitcoincash.org/blob/master/spec/cashaddr.md) which improves upon [BIP 173](https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki).

*Note:* This is a JavaScript implementation of the CashAddr format specification. If you are looking for a general purpose Bitcoin Cash address translation library, check out the easy-to-use and well-tested [BchAddr.js](https://github.com/ealmansi/bchaddrjs).

## Installation

### Using NPM

```bsh
$ npm install --save cashaddrjs
```

### Using Bower

```bsh
$ bower install --save cashaddrjs
```

### Manually

You may also download the distribution file manually and place it within your third-party scripts directory: [dist/cashaddrjs-0.4.4.min.js](https://unpkg.com/cashaddrjs@0.4.4/dist/cashaddrjs-0.4.4.min.js).

## Usage

### In Node.js

```javascript
const cashaddr = require('cashaddrjs');
const address = 'bitcoincash:qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a';
const { prefix, type, hash } = cashaddr.decode(address);
console.log(prefix); // 'bitcoincash'
console.log(type); // 'P2PKH'
console.log(hash); // Uint8Array [ 118, 160, ..., 115 ]
console.log(cashaddr.encode(prefix, type, hash)); // 'bitcoincash:qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a'
```

*Note:* This is a JavaScript implementation of the CashAddr format specification. If you are looking for an easy-to-use and well-tested library to translate between different formats, check out [BchAddr.js](https://github.com/ealmansi/bchaddrjs).

### Browser

#### Script Tag

You may include a script tag in your HTML and the `cashaddr` module will be defined globally on subsequent scripts.

```html
<html>
  <head>
    ...
    <script src="https://unpkg.com/cashaddrjs@0.4.4/dist/cashaddrjs-0.4.4.min.js"></script>
  </head>
  ...
</html>
```

## Documentation

### Generate and Browse Locally

```bsh
$ npm run docs
```

### Online

Browse automatically generated jsdocs [online](https://emilio.almansi.me/cashaddrjs/module-cashaddr.html).

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