Comment on page

Get Address

import { getAddress } from 'sats-connect'
To retrieve the user's Bitcoin address, we can use the getAddress() function. We provide a purpose in the request so the correct address is returned by the wallet. Additionally, choose a message to be displayed to the user in the request prompt. You can use this to explain to the user why your app is requesting access to their Bitcoin address.
const getAddressOptions = {
payload: {
purposes: ['ordinals', 'payment'],
message: 'Address for receiving Ordinals and payments',
network: {
onFinish: (response) => {
onCancel: () => alert('Request canceled'),
await getAddress(getAddressOptions);
The user will see an address request prompt in the wallet. Xverse browser extension UI shown for example:
Currently, you can retrieve two types of addresses, the user's Bitcoin payment address and the Ordinals address which is a taproot address.
An example response:
addresses: [
address: "tb1pzwa68q3udj0f7g5xtdakgecvf45dvssu66ry7y3at22w7vus20vq3sgw62",
publicKey: "b9907521ddb85e0e6a37622b7c685efbdc8ae53a334928adbd12cf204ad4e717",
purpose: "ordinals",
address: "2NBfRKCUpafbatj5gV9T82uau3igdSf9BXJ",
publicKey: "02818b7ff740a40f311d002123087053d5d9e0e1546674aedb10e15a5b57fd3985",
purpose: "payment",
The public keys for each address is also included in the response. You can use this to construct partially signed Bitcoin transactions (PSBT).