RecipesWallets
Wallet Setup Prerequisites
Signer, XPUB, and address-generation prerequisites shared by every wallet type.
Complete Setup and Installation first.
This page assumes:
@blockstream/crypticand@blockstream/ecs-registryare already configured- you have an authenticated user that can create signers and wallets
- you use the request helper described in Making Requests
What every wallet flow needs
Before creating any wallet, make sure you have:
- an authenticated user or service
- permission to create signers and wallets
- a signer
- an XPUB derived for that signer
Create a signer
import { v4 as uuidv4 } from 'uuid'
const signerResult = await broadcastRequest({
action: 'add',
resource: '/signers',
details: {
sid: uuidv4(),
name: 'my-signer',
location: 'hosted',
},
})
const signerId = signerResult.details.sidDerive an XPUB
const xpubResult = await broadcastRequest({
action: 'add',
resource: `/signers/${signerId}/xpubs`,
details: {
id: uuidv4(),
change: 'receive',
},
})
const keyoriginXpub = xpubResult.details.keyorigin_xpubWhy XPUBs matter
XPUBs let the system derive addresses from a signer without exposing the private key material used for actual signing.
Generate addresses after wallet creation
const addressResult = await broadcastRequest({
action: 'add',
resource: `/wallets/${walletId}/addresses`,
details: {
type: 'receive',
index: 1,
},
})
const address = addressResult.details.address