> ## Documentation Index
> Fetch the complete documentation index at: https://docs.phantom.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Provider API reference

> Complete API reference for Phantom's Bitcoin provider, including methods for connecting, signing, and sending.

<Warning>
  **The `window.phantom.bitcoin` provider has been deprecated.**
</Warning>

## Methods

### requestAccounts

#### Description

Connects to the user's Phantom account.

#### Parameters

None

#### Response

<ResponseField name="Promise<BtcAccount[]>" type="array">
  Array of the connected user's `BtcAccount` objects.
</ResponseField>

#### BtcAccount response object properties

<ResponseField name="address" type="string">
  The Bitcoin address owned by the user.
</ResponseField>

<ResponseField name="addressType" type="p2tr, p2wpkh, p2sh, p2pkh">
  The address's format. For details, see [Bitcoin Design Glossary](https://bitcoin.design/guide/glossary/address/).
</ResponseField>

<ResponseField name="publicKey" type="string">
  A hex string representing the bytes of the public key of the account.
</ResponseField>

<ResponseField name="purpose" type="payment, ordinals">
  The general purpose of the address. If `ordinals`, the user prefers to store Ordinals on this address. If `payment`, the user prefers to store Bitcoin on this address.
</ResponseField>

### signMessage

#### Description

Signs a message with the user's Phantom account.

#### Parameters

<ParamField path="message" type="Uint8array">
  The message to be signed.
</ParamField>

<ParamField path="address" type="string">
  One of the user's addresses that should be used to sign the message.
</ParamField>

#### Response

<ResponseField name="Promise<{ signature: Uint8Array; }>" type="object">
  Object containing the signature.
</ResponseField>

### signPSBT

#### Description

Signs a Partially-Signed Bitcoin Transaction (PSBT).

#### Parameters

<ParamField path="psbtHex" type="Uint8Array">
  A serialized PSBT.
</ParamField>

<ParamField path="options" type="object">
  Configuration options for signing the PSBT.
</ParamField>

#### options parameters

An array containing the indexes of which transaction inputs to sign, and how to sign them.

#### Response

<ResponseField name="Promise<string>" type="string">
  A serialized PSBT where the inputs belonging to the user's account have been signed.
</ResponseField>

## Events

### accountsChanged

#### Description

The event that is emitted when a user changes their connected Phantom account.

```typescript theme={null}
type AccountsChangedEvent = (accounts: BtcAccount[]) => void;
```

#### Properties

<ResponseField name="accounts" type="BtcAccount[]">
  The array of `BtcAccount` objects of the newly connected Phantom account.
</ResponseField>

#### BtcAccount response object properties

<ResponseField name="address" type="string">
  The Bitcoin address owned by the user.
</ResponseField>

<ResponseField name="addressType" type="p2tr, p2wpkh, p2sh, p2pkh">
  The address's format. For details, see [Bitcoin Design Glossary](https://bitcoin.design/guide/glossary/address/).
</ResponseField>

<ResponseField name="publicKey" type="string">
  A hex string representing the bytes of the public key of the account.
</ResponseField>

<ResponseField name="purpose" type="payment, ordinals">
  The general purpose of the address. If `ordinals`, the user prefers to store Ordinals on this address. If `payment`, the user prefers to store Bitcoin on this address.
</ResponseField>
