# fake-bolt11

> Generate fake but spec-compliant BOLT11 Lightning invoices for testing

Latest version **0.1.1** (published 2026-11-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install fake-bolt11
pnpm add fake-bolt11
yarn add fake-bolt11
bun add fake-bolt11
```

## Health

**Score 70/100 (B)** — status: active.

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

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2026-11-25 |
| First published | 2025-11-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 47.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Egge |
| Maintainers | egge21m |
| Keywords | bolt11, lightning, invoice, bitcoin, testing, mock, fake |

## Links

- npm: https://www.npmjs.com/package/fake-bolt11
- npm.io page: https://npm.io/package/fake-bolt11

## Dependencies (2)

- [@noble/curves](https://npm.io/package/@noble/curves.md) ^2.0.1
- [@noble/hashes](https://npm.io/package/@noble/hashes.md) ^2.0.1

## Alternatives

- [pagerjs](https://npm.io/package/pagerjs.md) — 60 weekly downloads
- [whistle.savefor-mock](https://npm.io/package/whistle.savefor-mock.md) — 4 weekly downloads
- [@sgedda/mockifyer-generator](https://npm.io/package/@sgedda/mockifyer-generator.md) — 0 weekly downloads
- [@sgedda/mockifyer-mcp](https://npm.io/package/@sgedda/mockifyer-mcp.md) — 0 weekly downloads
- [@xesam/cloud-core](https://npm.io/package/@xesam/cloud-core.md) — 0 weekly downloads

## Recent versions

- 0.1.1 (latest) — 2026-11-25
- 0.1.0 — 2025-11-25

## README

# fake-bolt11

Generate fake but spec-compliant [BOLT11](https://github.com/lightning/bolts/blob/master/11-payment-encoding.md) Lightning invoices for testing purposes.

## Installation

```bash
npm install fake-bolt11
# or
bun add fake-bolt11
# or
pnpm add fake-bolt11
```

## Usage

```typescript
import { createFakeInvoice } from "fake-bolt11";

// Create a simple invoice for 100 sats
const invoice = createFakeInvoice(100);
console.log(invoice);
// lnbc1u1p5j...

// With options
const customInvoice = createFakeInvoice(1000, {
  network: "tb", // 'bc' (mainnet), 'tb' (testnet), 'bcrt' (regtest), 'tbs' (signet)
  description: "Coffee",
  expiry: 600, // 10 minutes
  timestamp: 1234567890, // Custom timestamp
});
```

## API

### `createFakeInvoice(amountSats, options?)`

Creates a fake but spec-compliant BOLT11 invoice.

#### Parameters

- `amountSats` (number): Amount in satoshis
- `options` (optional):
  - `network`: Network prefix - `'bc'` (mainnet), `'tb'` (testnet), `'bcrt'` (regtest), `'tbs'` (signet). Default: `'bc'`
  - `description`: Invoice description. Default: `'Test invoice'`
  - `expiry`: Expiry in whole seconds from `0` through `Number.MAX_SAFE_INTEGER`. Default: `3600` (1 hour)
  - `paymentHash`: 32-byte payment hash as hex string. Default: random
  - `paymentSecret`: 32-byte payment secret as hex string. Default: random
  - `timestamp`: Unix timestamp in seconds. Default: current time
  - `privateKey`: 32-byte private key for signing as hex string. Default: random

#### Returns

A BOLT11 encoded invoice string.

## Notes

- Generated invoices have valid cryptographic signatures
- They **cannot** be paid on a real Lightning Network since the destination node doesn't exist
- Useful for testing melt quote creation, invoice parsing, and payment flows

## License

MIT

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