# Implementing a Bitcoin RPC Adapter

This guide explains how to implement a custom RPC adapter for interacting with Bitcoin nodes or services.

## Overview

The `BTCRpcAdapter` provides an abstraction layer for Bitcoin-specific operations like UTXO management, balance queries, and transaction broadcasting. You might want to implement a custom adapter when:

* Using a different Bitcoin API provider
* Implementing specialized UTXO selection strategies

## Base Class

In order to implement a custom adapter, you need to implement the `BTCRpcAdapter` abstract class:

```ts twoslash
// [!include ~/../src/chain-adapters/Bitcoin/BTCRpcAdapter/BTCRpcAdapter.ts]
```

### 2. Example

There is an example implementation of the `BTCRpcAdapter` abstract class in the `Mempool` class:

```ts twoslash
// [!include ~/../src/chain-adapters/Bitcoin/BTCRpcAdapter/Mempool/Mempool.ts]
```
