# @xchainjs/xchain-utxo

> Genereic UTXO client for XChainJS

Latest version **2.2.10** (published 2026-10-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install @xchainjs/xchain-utxo
pnpm add @xchainjs/xchain-utxo
yarn add @xchainjs/xchain-utxo
bun add @xchainjs/xchain-utxo
```

## 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.

## Facts

| | |
|---|---|
| Version | 2.2.10 |
| Published | 2026-10-06 |
| First published | 2023-12-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 180.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 133 |
| Author | XChainJS |
| Maintainers | xchainjsadmin, thorchain_org, _stu, veado, thatstrangeguy, junkai121, sarawut11, thorswap, hodrthemediocre, polaris_9r, thorianite |
| Keywords | XChain, UTXO |

## Links

- npm: https://www.npmjs.com/package/@xchainjs/xchain-utxo
- Repository: https://github.com/xchainjs/xchainjs-lib
- Issues: https://github.com/xchainjs/xchainjs-lib/issues
- npm.io page: https://npm.io/package/@xchainjs/xchain-utxo

## Dependencies (3)

- [@xchainjs/xchain-util](https://npm.io/package/@xchainjs/xchain-util.md) 2.0.7
- [@xchainjs/xchain-client](https://npm.io/package/@xchainjs/xchain-client.md) 2.0.18
- [@xchainjs/xchain-utxo-providers](https://npm.io/package/@xchainjs/xchain-utxo-providers.md) 2.1.2

## Recent versions

- 2.2.10 (latest) — 2026-10-06
- 2.2.9 — 2026-08-06
- 2.2.8 — 2026-07-20
- 2.2.7 — 2026-06-25
- 2.2.6 — 2026-06-16
- 2.2.5 — 2026-06-03
- 2.2.4 — 2026-05-14
- 2.2.3 — 2026-04-15
- 2.2.2 — 2026-03-12
- 2.2.1 — 2026-02-23
- 2.2.0 — 2026-02-20
- 2.1.0 — 2026-02-17
- 2.0.10 — 2026-02-10
- 2.0.9 — 2025-09-19
- 2.0.8 — 2025-07-28
- … 30 more at https://npm.io/package/@xchainjs/xchain-utxo/versions

## README

# `@xchainjs/xchain-utxo`

## Modules

- `client` - Abstract base client for UTXO-based chains (Bitcoin, Litecoin, Dash, Dogecoin, Bitcoin Cash, etc.)
- `utxo-selector` - UTXO coin selection helpers
- `strategies` - Coin selection strategies (branch-and-bound, accumulative, largest-first, small-first, single-random-draw)
- `validators` - Transaction validation utilities
- `errors` - UTXO-specific error types
- `coininfo` / `toBitcoinJS` - Network parameter helpers for bitcoinjs-lib compatible coins

## Installation

```
yarn add @xchainjs/xchain-utxo
```

Following peer dependencies have to be installed into your project. These are not included in `@xchainjs/xchain-utxo`.

```
yarn add @xchainjs/xchain-client @xchainjs/xchain-util @xchainjs/xchain-utxo-providers
```

## Overview

This package provides the shared abstract `Client` used by UTXO chain packages in XChainJS. Chain-specific packages (for example `@xchainjs/xchain-bitcoin` or `@xchainjs/xchain-dash`) extend this base class and supply network constants, address formats, transaction building, and data providers.

Typical responsibilities of the base UTXO client:

- Explorer URL helpers
- Balance and UTXO fetching via pluggable `UtxoOnlineDataProviders`
- Transaction history and fee estimation wiring
- UTXO selection strategies for building inputs
- Shared types (`UTXO`, `UtxoClientParams`, `PreparedTx`, etc.)

You generally do **not** instantiate this package directly in application code. Use a concrete chain client instead:

```typescript
import { Client, defaultBTCParams } from '@xchainjs/xchain-bitcoin'
// or
import { Client, defaultDashParams } from '@xchainjs/xchain-dash'
```

## Usage (library / package authors)

When implementing a new UTXO chain client, extend the abstract `Client` and provide chain-specific logic:

```typescript
import { Client as UTXOClient, UtxoClientParams } from '@xchainjs/xchain-utxo'
import { Network } from '@xchainjs/xchain-client'

class Client extends UTXOClient {
  constructor(params: UtxoClientParams) {
    super('MYCHAIN', params)
  }

  // Implement abstract methods: address derivation, tx building, signing, etc.
}
```

### Coin selection strategies

```typescript
import {
  UtxoSelector,
  // strategies are re-exported from the package
} from '@xchainjs/xchain-utxo'
```

Strategies can be used when preparing transactions to control how inputs are chosen (fee efficiency, privacy, consolidating small UTXOs, etc.).

## Related packages

| Package | Role |
| ------- | ---- |
| [`@xchainjs/xchain-utxo-providers`](https://github.com/xchainjs/xchainjs-lib/tree/master/packages/xchain-utxo-providers) | Online data providers (BlockCypher, Sochain, BitGo, Haskoin, etc.) |
| [`@xchainjs/xchain-client`](https://github.com/xchainjs/xchainjs-lib/tree/master/packages/xchain-client) | Base XChain client interface |
| [`@xchainjs/xchain-bitcoin`](https://github.com/xchainjs/xchainjs-lib/tree/master/packages/xchain-bitcoin) | Example concrete UTXO client |

## Documentation

More information about XChainJS can be found on [documentation](https://xchainjs.gitbook.io/xchainjs)

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