Skip to main content
The window.phantom.bitcoin provider has been deprecated.

Methods

requestAccounts

Description

Connects to the user’s Phantom account.

Parameters

None

Response

array
Array of the connected user’s BtcAccount objects.

BtcAccount response object properties

string
The Bitcoin address owned by the user.
p2tr, p2wpkh, p2sh, p2pkh
The address’s format. For details, see Bitcoin Design Glossary.
string
A hex string representing the bytes of the public key of the account.
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.

signMessage

Description

Signs a message with the user’s Phantom account.

Parameters

Uint8array
The message to be signed.
string
One of the user’s addresses that should be used to sign the message.

Response

object
Object containing the signature.

signPSBT

Description

Signs a Partially-Signed Bitcoin Transaction (PSBT).

Parameters

Uint8Array
A serialized PSBT.
object
Configuration options for signing the PSBT.

options parameters

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

Response

string
A serialized PSBT where the inputs belonging to the user’s account have been signed.

Events

accountsChanged

Description

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

Properties

BtcAccount[]
The array of BtcAccount objects of the newly connected Phantom account.

BtcAccount response object properties

string
The Bitcoin address owned by the user.
p2tr, p2wpkh, p2sh, p2pkh
The address’s format. For details, see Bitcoin Design Glossary.
string
A hex string representing the bytes of the public key of the account.
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.