Bitcoin Wallets
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.
Checking if a wallet is a Bitcoin wallet
You can use the isBitcoinWallet
helper method to check if a wallet is a Bitcoin wallet. That way, TypeScript will know which methods are available to you.
Bitcoin Wallet
Method | Description |
---|---|
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(transaction: BitcoinTransaction): Promise<string | undefined> | A method to send an amount of satoshis to a recipient bitcoin address |
signMessageWithAddress(messageToSign: string, addressType: WalletAddressType): Promise<string\ | undefined> | Signs a message with a specific bitcoin address type (ordinals or payment) |
signPsbt(request: BitcoinSignPsbtRequest): Promise<BitcoinSignPsbtResponse | undefined> | Signs a PSBT and returns an object with the signed PSBT |
signPsbts(request: BitcoinSignPsbtRequest[]): Promise<string[] | undefined> | Signs a list of PSBTs and returns an array of signed PSBTs in base64 |
Type Definitions
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.
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:
Was this page helpful?