Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cashaddrjs

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cashaddrjs

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

  • 0.1.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
78K
increased by8.27%
Maintainers
1
Weekly downloads
 
Created
Source

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

Build Status Coverage Status

NPM

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

Compliant with the original CashAddr specification which improves upon BIP 173.

Installation

Using NPM

$ npm install --save cashaddrjs

Using Bower

$ 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.1.4.min.js.

Usage

In Node.js

const cashaddr = require('cashaddrjs');

const hash = [
  118, 160, 64,  83, 189,
  160, 168, 139, 218, 81,
  119, 184, 106, 21, 195,
  178, 159, 85,  152, 115
];

const address = cashaddr.encode('bitcoincash', 'P2KH', hash);
console.log(address); // 'bitcoincash:qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a'

const decoded = cashaddr.decode(address);
console.log(decoded.prefix); // 'bitcoincash'
console.log(decoded.type); // 'P2KH'
console.log(decoded.hash); // [ 118, 160, ..., 115 ]

Browser

Script Tag

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

<html>
  <head>
    ...
    <script src="https://cdn.rawgit.com/bitcoincashjs/cashaddrjs/master/dist/cashaddrjs-0.1.4.min.js"></script>
  </head>
  ...
</html>

Documentation

Generate and Browse Locally

$ npm run docs

Online

Browse automatically generated jsdocs online.

Keywords

FAQs

Package last updated on 02 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc