We covered what a wallet in general looks like in the Accessing Wallets section and then what a wallet connector looks like in the Interacting With Wallets section. However, the wallet connector for Bitcoin wallets is a bit different from the EVM wallets, so we will cover that seperately here.

This is because Bitcoin wallets have different capabilities and requirements. For example, Bitcoin wallets can have multiple addresses associated with them, like payment and ordinal addresses.

FieldDescription
getBalance(): Promise<string | undefined>A method to fetch the balance for the connected address
getConnectedAccounts(): Promise<string[]>A method to retrieve the current connected address
getAdditionalAddresses(mainAddress: string): Promise<WalletAdditionalAddress[]>A method to return the payment and ordinals address (if applicable) as an array of objects
name: stringThe wallet name
signMessage(messageToSign: string): Promise<string | undefined>A method to sign a message
sendRawTransaction(rawTransactionHex: string): Promise<string | undefined>This method submits a raw transaction to the bitcoin blockchain and returns the transaction ID as the response
sendBitcoin(BitcoinTransaction): Promise<string | undefined>A method to send an amount of satoshis to a recipient bitcoin address
signPsbt(request: BitcoinSignPsbtRequest):A method to get the smart wallet provider for more advanced usage
isLedgerAddress(address: string): booleanA method for determining if the connected address is a ledger wallet

Type Definitions

type BitcoinSignPsbtRequest = {
  allowedSighash: number[];
  unsignedPsbtBase64: string;
  signature?: {
    address: string;
    signingIndexes: number[] | undefined;
    disableAddressValidation?: boolean; // helpful for multi-sig
  }[];
};

type BitcoinTransaction = {
  amount: bigint;
  recipientAddress: string;
}

type WalletAdditionalAddress {
  address: string;
  publicKey?: string;
  type: 'payment' | 'ordinal';
}

type BitcoinSignPsbtResponse = {
  signedPsbt: Psbt; // see reference below for what a PSBT is
};

What is a satoshi?

This smallest unit allows for transactions involving very small amounts of bitcoin, facilitating microtransactions and improving the granularity of payments in the Bitcoin network.

1 Bitcoin = 100,000,000 Satoshis

What is a PSBT?

A partially signed bitcoin transaction (PSBT) is a standard for transactions that have not fully signed. This allows different participants with different keys/signers to sign a transaction without revealing their private keys to others. Multi-sig wallets utilize these. This allows for a multi-step transaction process which is both safer and more efficient.

Examples

We’ve included a few examples of how to use the Bitcoin wallet connector in this section:

Send a transaction Send a raw transaction Sign a message