# bolt09

> BOLT 09 helper methods

Latest version **3.0.0** (published 2026-08-22) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

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

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2026-08-22 |
| First published | 2019-12-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=22 |
| Dependencies | 0 |
| Unpacked size | 20.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Alex Bosworth |
| Maintainers | alexbosworth |
| Keywords | bolt, feature-bits, lightning, lightning-network |

## Links

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

## Recent versions

- 3.0.0 (latest) — 2026-08-22
- 2.2.0 — 2025-07-19
- 2.1.0 — 2024-05-02
- 2.0.0 — 2023-10-11
- 1.0.0 — 2023-06-26
- 0.2.5 — 2023-01-06
- 0.2.4 — 2022-10-19
- 0.2.3 — 2022-04-03
- 0.2.2 — 2022-02-14
- 0.2.1 — 2022-01-13
- 0.2.0 — 2021-09-21
- 0.1.5 — 2021-05-27
- 0.1.4 — 2021-04-01
- 0.1.3 — 2021-01-19
- 0.1.2 — 2020-09-23
- … 4 more at https://npm.io/package/bolt09/versions

## README

# Bolt 09

[![npm version](https://badge.fury.io/js/bolt09.svg)](https://badge.fury.io/js/bolt09)
[![Coverage Status](https://coveralls.io/repos/github/alexbosworth/bolt09/badge.svg?branch=master)](https://coveralls.io/github/alexbosworth/bolt09?branch=master)
[![Build Status](https://travis-ci.org/alexbosworth/bolt09.svg?branch=master)](https://travis-ci.org/alexbosworth/bolt09)

Utility methods for working with [BOLT 09](https://github.com/lightningnetwork/lightning-rfc/blob/master/09-features.md)

## Methods

### featureFlagDetails

Feature flag details for feature flag bit

    {
      bit: <Feature Flag Bit Number>
    }

    @throws
    <Error>

    @returns
    {
      [type]: <Feature Flag Type String>
    }

Example:

```node
const {featureFlagDetails} = require('bolt09');

const {type} = featureFlagDetails({bit: 0});
// Type is string descriptor of feature bit
```

### featureFlagsAsHex

Encode feature flags into hex serialized bytes

    {
      features: [<Feature Bit Number>]
    }

    @throws
    <Error>

    @returns
    {
      encoded: <Serialized Feature Bits Hex Encoded String>
    }

Example:

```node
const {featureFlagsAsHex} = require('bolt09');

const {encoded} = featureFlagsAsHex({features: [0]});
// Encoded is hex encoded string with a length uint16 prefix
```

### featureFlagsAsWords

Encode feature flags into a serialized data buffer

    {
      features: [<Feature Bit Number>]
    }

    @throws
    <Error>

    @returns
    {
      words: [<Bech32 Word Number>]
    }

Example:

```node
const {featureFlagsAsWords} = require('bolt09');

const {words} = featureFlagsAsWords({features: [0]});
// Words are word numbers that can be used for encoding in a bolt11 payment req
```

### featureFlagsFromHex

Feature flags from hex serialized feature flags

    {
      [hex]: <Data Length Prefixed Hex Encoded String>
    }

    @throws
    <Error>

    @returns
    {
      features: [{
        bit: <Feature Bit Number>
        is_required: <Feature Bit is Required Bool>
        type: <Feature Bit Type String>
      }]
    }

Example:

```node
const {featureFlagsFromHex} = require('bolt09');

const {features} = featureFlagsFromHex({hex: '00018C'});
// Features is an array of supported features
```

### featureFlagsFromWords

Feature flags from BOLT 11 tag words

    {
      words: [<BOLT11 Tag Word Number>]
    }

    @throws
    <Error>

    @returns
    {
      features: [{
        bit: <Feature Bit Number>
        is_required: <Feature Bit is Required Bool>
        type: <Feature Bit Type String>
      }]
    }

Example:

```node
const {featureFlagsFromWords} = require('bolt09');

const {features} = featureFlagsFromWords({words: [16, 0]});
// Features is an array of supported features
```

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