> For the complete documentation index, see [llms.txt](https://docs.threshold.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.threshold.network/app-development/tbtc-sdk/quickstart.md).

# Quickstart

Here you can find instructions explaining how to use the SDK in your own project.

### Installation

To install the tBTC SDK in your project, run:

{% tabs %}
{% tab title="yarn" %}
{% code fullWidth="false" %}

```bash
yarn add @keep-network/tbtc-v2.ts
```

{% endcode %}
{% endtab %}

{% tab title="npm" %}

```bash
npm i @keep-network/tbtc-v2.ts
```

{% endtab %}
{% endtabs %}

Please note that you will also need to install the [ethers v5](https://docs.ethers.org/v5) library to initialize a signer or provider. To do so, invoke:

{% tabs %}
{% tab title="yarn" %}

```bash
yarn add ethers@legacy-v5
```

{% endtab %}

{% tab title="npm" %}

```bash
npm i ethers@legacy-v5
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}

```
The SDK depends on ethers v5. Proper support for newer ethers versions is 
not guaranteed right now.
```

{% endhint %}

### Usage

Here is a brief example demonstrating the use of the SDK in Ethereum:

```typescript
// Import SDK entrypoint component.
import { TBTC } from "@keep-network/tbtc-v2.ts"

// Create an instance of ethers signer.
const signer = (...)

// Initialize the SDK for Ethereum only.
const sdk = await TBTC.initializeMainnet(signer)

// Access SDK features.
sdk.deposits.(...)
sdk.redemptions.(...)

// Access tBTC smart contracts directly.
sdk.tbtcContracts.(...)

// Access Bitcoin client directly.
sdk.bitcoinClient.(...)
```

#### Crosschain

Here is a brief example demonstrating the use of the SDK in some L2, e.g. Arbitrum:

```typescript
// Import SDK entrypoint component.
import { TBTC } from "@keep-network/tbtc-v2.ts"

// Create an instance of ethers provider.
const ethProvider = (...)

// Create an instance of ethers signer.
const arbitrumSigner = (...)

// Initialize the SDK for Ethereum only.
const sdk = await TBTC.initializeMainnet(ethProvider, true)

// Initialize it for any L2 (E.g., Arbitrum)
await sdk.initializeCrossChain("Arbitrum", arbitrumSigner);

// Access SDK features.
sdk.deposits.(...)
sdk.redemptions.(...)

// Access tBTC smart contracts directly.
sdk.tbtcContracts.(...)

// Access Bitcoin client directly.
sdk.bitcoinClient.(...)
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.threshold.network/app-development/tbtc-sdk/quickstart.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
