# bip21

> A BIP21 compatible URL encoding utility library

Latest version **3.0.0** (published 2024-07-20) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2024-07-20 |
| First published | 2014-10-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 58 |
| Author | Daniel Cousens |
| Maintainers | fanatid, jprichardson, junderw |
| Keywords | bip21, bitcoin |

## Links

- npm: https://www.npmjs.com/package/bip21
- Repository: https://github.com/bitcoinjs/bip21
- Issues: https://github.com/bitcoinjs/bip21/issues
- npm.io page: https://npm.io/package/bip21

## Dependencies (1)

- [query-string](https://npm.io/package/query-string.md) ^9.0.0

## Recent versions

- 3.0.0 (latest) — 2024-07-20
- 2.0.3 — 2020-04-29
- 2.0.2 — 2018-04-29
- 2.0.1 — 2016-12-18
- 2.0.0 — 2016-12-18
- 1.1.2 — 2016-02-26
- 1.1.0 — 2016-02-26
- 1.0.1 — 2015-08-06
- 1.0.0 — 2015-02-27
- 0.1.0 — 2015-02-27
- 0.0.7 — 2014-12-14
- 0.0.6 — 2014-12-14
- 0.0.5 — 2014-11-20
- 0.0.4 — 2014-11-20
- 0.0.3 — 2014-11-20
- … 1 more at https://npm.io/package/bip21/versions

## README

# bip21

[![build status](https://secure.travis-ci.org/bitcoinjs/bip21.png)](http://travis-ci.org/bitcoinjs/bip21)
[![Version](http://img.shields.io/npm/v/bip21.svg)](https://www.npmjs.org/package/bip21)

A [BIP21](https://github.com/bitcoin/bips/blob/master/bip-0021.mediawiki) compatible URL encoding library.


## Example

``` javascript
var bip21 = require('bip21')

var decoded = bip21.decode('bitcoin:1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH?amount=20.3&label=Foobar')

console.log(decoded)
// { address: '1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH',
//   options: {
//     amount: 20.3,
//     label: 'Foobar' }
// }
//
// WARNING: Remember to error check the `.address`!

console.log(bip21.encode('1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH'))
// => bitcoin:1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH

console.log(bip21.encode('1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH', {
	amount: 20.3,
	label: 'Foobar'
}))
// => bitcoin:1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH?amount=20.3&label=Foobar
```


## License [MIT](LICENSE)

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