boltz-core
v5.0.0
Published
Core library of Boltz
Downloads
11,241
Readme
boltz-core
Boltz Reference Client & Library in TypeScript, used by e.g. https://github.com/BoltzExchange/boltz-web-app.
The library exposes building blocks for Boltz-style submarine and reverse swaps: swap scripts and Taproot swap trees, claim/refund transaction construction, MuSig2 helpers, preimage/swap detection, and the Solidity EtherSwap/ERC20Swap ABIs.
Installation
npm install boltz-coreThe package is ESM only and requires Node.js >=20.10.
Optional peer dependencies
Liquid support is opt-in. The two peer dependencies are declared as optional, so installing boltz-core on its own pulls no Liquid code:
Install them only if you import from boltz-core/liquid:
npm install liquidjs-lib @vulpemventures/secp256k1-zkpThe main boltz-core entry point never imports either package, so Bitcoin-only consumers will not see them in their bundle or dependency tree.
Usage
Bitcoin
import {
Networks,
OutputType,
constructClaimTransaction,
swapTree,
} from 'boltz-core';Liquid
boltz-core/liquid requires a one-time init call with a loaded secp256k1-zkp instance before any swap helpers are used:
import zkpInit from '@vulpemventures/secp256k1-zkp';
import {
Networks,
constructClaimTransaction,
init,
reverseSwapTree,
} from 'boltz-core/liquid';
const zkp = await zkpInit();
init(zkp);Development
npm install
npm run compile
npm testIntegration tests need local Bitcoin and Elements regtest nodes:
npm run docker:start
npm run test:int
npm run docker:stop