# cltv-vaults

> Vaults for utxo coins using CLTV

Latest version **1.1.1** (published 2025-08-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install cltv-vaults
pnpm add cltv-vaults
yarn add cltv-vaults
bun add cltv-vaults
```

## Health

**Score 25/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities.

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

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2025-08-22 |
| First published | 2022-05-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 17.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Liberate, Inc. |
| Maintainers | plodder |

## Links

- npm: https://www.npmjs.com/package/cltv-vaults
- Repository: https://github.com/liberateinc/cltv-vaults
- Homepage: https://github.com/liberateinc/cltv-vaults#readme
- Issues: https://github.com/liberateinc/cltv-vaults/issues
- npm.io page: https://npm.io/package/cltv-vaults

## Dependencies (4)

- [ecpair](https://npm.io/package/ecpair.md) ^2.1.0
- [uint39](https://npm.io/package/uint39.md) ^1.0.0
- [bitcoinjs-lib](https://npm.io/package/bitcoinjs-lib.md) ^6.1.7
- [tiny-secp256k1](https://npm.io/package/tiny-secp256k1.md) ^2.2.3

## Recent versions

- 1.1.1 (latest) — 2025-08-22
- 1.1.0 — 2025-05-22
- 1.0.0 — 2022-05-17

## README

cltv-vaults
------------

Javascript library to create and spend from CLTV vaults.

### SimpleVault

A Simple Vault is a plain CLTV vault that checks the locktime and then does a
p2pk validation. This is optimized for transaction size and is useful for
vaults that are private and do not need the Vault Script to be shared with
anyone.

**p2sh script template:**
```
<height> OP_CHECKLOCKTIMEVERIFY OP_DROP <pubkey> OP_CHECKSIG
```

**scriptSig template:**
```
<signature> <p2sh script>
```

This script protocol is used by, for example,
[coinb.in](https://coinb.in/#newTimeLocked).

### HashVault

A Hash Vault is a CLTV vault that checks locktime and then turns into a p2pkh
transaction. This is useful when the Vault Script needs to be shared to proof
that the funds are really locked, as this does not expose the public key.
Transactions that redeem from a HashVault are larger than those that redeem a
SimpleVault because the full public key needs to be included on the scriptSig
stack.

This script protocol was originally proposed by Peter Todd in the
[BIP-65 spec](https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki#freezing-funds).

**p2sh script template:**
```
<height> OP_CHECKLOCKTIMEVERIFY OP_DROP OP_DUP OP_HASH160 <pubkeyhash> OP_EQUALVERIFY OP_CHECKSIG
```

**scriptSig template:**
```
<signature> <pubkey> <p2sh script>
```

### VaultTransactionFactory

Generates transactions to empty a vault after expiry, based on the Vault Script
provided. Callers are expected to bring their own utxos.

Note that for all vault types, it is recommended to empty these completely after
the timelock expires.

### Usage
See the `examples` directory.

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