# @utxorpc/sdk

> A client library to interact with UTxO RPC compliant endpoints

Latest version **0.9.0** (published 2026-08-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install @utxorpc/sdk
pnpm add @utxorpc/sdk
yarn add @utxorpc/sdk
bun add @utxorpc/sdk
```

## Health

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

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

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.9.0 |
| Published | 2026-08-27 |
| First published | 2024-01-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 832.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 8 |
| Author | scarmuega |
| Maintainers | avatxus, scarmuega, rawriclark |
| Keywords | utxorpc, blockchain |

## Links

- npm: https://www.npmjs.com/package/@utxorpc/sdk
- Repository: https://github.com/utxorpc/node-sdk
- Homepage: https://github.com/utxorpc/node-sdk#readme
- Issues: https://github.com/utxorpc/node-sdk/issues
- npm.io page: https://npm.io/package/@utxorpc/sdk

## Dependencies (5)

- [buffer](https://npm.io/package/buffer.md) ^6.0.3
- [@utxorpc/spec](https://npm.io/package/@utxorpc/spec.md) ^0.19.2
- [@connectrpc/connect](https://npm.io/package/@connectrpc/connect.md) 1.4
- [@connectrpc/connect-web](https://npm.io/package/@connectrpc/connect-web.md) 1.4
- [@connectrpc/connect-node](https://npm.io/package/@connectrpc/connect-node.md) 1.4

## Recent versions

- 0.9.0 (latest) — 2026-08-27
- 0.8.2 — 2026-02-28
- 0.8.1 — 2026-02-28
- 0.8.0 — 2026-01-26
- 0.7.0 — 2025-07-21
- 0.6.8 — 2025-07-04
- 0.6.7 — 2025-01-24
- 0.6.6 — 2025-01-03
- 0.6.5 — 2024-12-30
- 0.6.4 — 2024-11-14
- 0.6.3 — 2024-10-05
- 0.6.2 — 2024-09-25
- 0.6.1 — 2024-09-13
- 0.6.0 — 2024-09-08
- 0.5.0 — 2024-09-07
- … 6 more at https://npm.io/package/@utxorpc/sdk/versions

## README

<div align="center">
  <h1 style="font-size: 3em;">UTxORPC SDK | Node.js 🚀</h1>
  <h4>A gRPC interface for UTxO Blockchains in Node.js</h4>
</div>

<div align="center">

  ![Forks](https://img.shields.io/github/forks/utxorpc/node-sdk.svg?style=social) 
  ![Stars](https://img.shields.io/github/stars/utxorpc/node-sdk.svg?style=social) 
  ![Contributors](https://img.shields.io/github/contributors/utxorpc/node-sdk.svg) 
  ![Issues](https://img.shields.io/github/issues/utxorpc/node-sdk.svg) 
  ![Issues Closed](https://img.shields.io/github/issues-closed/utxorpc/node-sdk.svg) 
  <a href="https://www.npmjs.com/package/@utxorpc/sdk">
    <img src="https://img.shields.io/npm/v/@utxorpc/sdk.svg" alt="NPM Package">
  </a>
</div>

The `@utxorpc/sdk` provides a Node.js interface for interacting with UTxO-based blockchains via gRPC, making it easy to fetch blocks, follow chain tips, and more. This library is designed to help developers integrate blockchain data into their applications efficiently.

### ✨ Features

- **gRPC Communication**: Utilizes **gRPC** for efficient, low-latency communication with blockchain nodes.
- **SyncClient**: Stream real-time updates as new blocks are applied, undone, or when the chain resets.
- **QueryClient**: Retrieve UTxOs and other on-chain data.
- **SubmitClient**: Submit and monitor transactions.
- **WatchClient**: Watch for specific transactions or events related to addresses, assets, and more.

### 📦 Installation

To install the SDK, use the following command in your project:

```bash
npm i @utxorpc/sdk
```

### 💻 Usage

#### `CardanoSyncClient` Example

The following example demonstrates using `CardanoSyncClient` to connect to a UTxO RPC service, fetch block data, and follow chain tips in real-time.

```javascript
import { CardanoSyncClient } from "@utxorpc/sdk";

async function test() {
  let syncClient = new CardanoSyncClient({
    uri: "http://localhost:50051", // Replace with your UTxO RPC service URL
  });

  // Follow chain tips by fetching real-time block updates
  let tip = syncClient.followTip([
    {
      slot: 54131816, // Example slot number
      hash: "34c65aba4b299113a488b74e2efe3a3dd272d25b470d25f374b2c693d4386535", // Example block hash
    },
  ]);

  for await (const event of tip) {
    console.log(event); // handle each event however you want
  }
}

test().catch(console.error);
```

### Available Clients

The SDK includes multiple clients to perform various operations:

#### 1. SyncClient

- `followTip(intersect)`: Stream blockchain updates in real-time.
- `fetchBlock(point)`: Fetch a specific block using a slot and hash.
- `fetchHistory(start, maxItems)`: Fetch historical blocks up to `maxItems`.

#### 2. QueryClient

- `readParams()`: Retrieve blockchain parameters.
- `readUtxosByOutputRef(refs)`: Get UTxOs based on specific transaction references.
- `searchUtxosByAddress(address)`: Search UTxOs by address. This also has variants like Search Utxos by Assets and more.

#### 3. SubmitClient

- `submitTx(tx)`: Submit a transaction to the blockchain.
- `waitForTx(txHash)`: Wait for a transaction’s confirmation.
- `watchMempool()`: Watch the mempool. This also has variants like Watch Mempool for Address and more.

#### 4. WatchClient

- `watchTx(intersect)`: Watch specific transactions by chain points. This also has variants like Watch Tx for Address.


### 🤝 Contributing

Contributions are welcome! To contribute, please fork the repository and submit a pull request. For major changes, open an issue first to discuss your ideas.

### 💬 Join the Community

Want to discuss UTxO RPC or get involved with the community? Join the **TxPipe Discord**! There’s a dedicated channel for UTxO RPC where you can connect with other developers, share ideas, and get support.

👉 [Join the TxPipe Discord here!](https://discord.gg/nbkJdPnKHm) 💬

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