// WalletAccountBtc is created by the WalletManagerBtc// It takes the same configuration as the managerconstaccount=awaitwallet.getAccount(0) // Get account at index 0constcustomAccount=awaitwallet.getAccountByPath("0'/0/5") // Custom path
Configuration Options
Client
The client option specifies an Electrum client instance to use for blockchain data. When provided, the host, port, and protocol options are ignored.
Type:IElectrumClient
Default: None (falls back to host/port/protocol configuration)
Example:
Built-in Transport Clients
The package provides four built-in transport clients:
Custom Electrum Client
You can implement your own client by extending IElectrumClient:
Host
The host option specifies the Electrum server hostname to connect to for blockchain data. Ignored if client is provided.
Type:string
Default:"electrum.blockstream.info"
Recommended: Configure your own Electrum server for production use. Public servers can be 10-300x slower and may fail for addresses with many transactions.
Example:
Port
The port option specifies the Electrum server port to connect to. Ignored if client is provided.
Type:number
Default:50001
Common Ports:
50001 - TCP (default)
50002 - TLS/SSL
50003 - WebSocket
Example:
Protocol
The protocol option specifies the transport protocol to use. Ignored if client is provided.
Type:string
Values:
"tcp" - TCP transport (default)
"tls" - TLS transport
"ssl" - SSL transport
Default:"tcp"
Example:
Network
The network option specifies which Bitcoin network to use.
The bip option specifies the address type derivation standard to use.
Type:number
Values:
84 - BIP-84 (P2WPKH / Native SegWit) - addresses start with bc1 (mainnet) or tb1 (testnet)
44 - BIP-44 (P2PKH / Legacy) - addresses start with 1 (mainnet) or m/n (testnet)
Default:84
Example:
Electrum Server Configuration
Important: While the package defaults to electrum.blockstream.info:50001 for convenience, we strongly recommend configuring your own Electrum server for production use.
Recommended Approach
For Production:
Set up your own Fulcrum server for optimal performance and reliability
Use recent Fulcrum versions that support pagination for high-transaction addresses
For Development/Testing:
fulcrum.frznode.com:50001 - Generally faster than default
Current path (v1.0.0-beta.4+): m/84'/0'/0'/0/{index} (Native SegWit addresses)
If you're upgrading from an earlier version, existing wallets created with the old path will generate different addresses. Make sure to migrate any existing wallets or use the old path explicitly if needed for compatibility.
Use getAccountByPath to supply an explicit derivation path when importing or recreating legacy wallets.
Complete Configuration Example
Performance Considerations
Electrum Server Performance:
Public servers like Blockstream's can be significantly slower
Addresses with many transactions may cause timeouts
Custom Fulcrum servers provide better performance and reliability
Consider server location and network latency
Configuration Tips:
Use fulcrum.frznode.com for better development performance
Set up your own Fulcrum server for production
Monitor connection stability and implement retry logic
Consider using multiple backup servers
Node.js Quickstart
Get started with WDK in a Node.js environment
React Native Quickstart
Build mobile wallets with React Native Expo
WDK BTC Wallet Usage
Get started with WDK's BTC Wallet Usage
WDK BTC Wallet API
Get started with WDK's BTC Wallet API
Need Help?
Discord Community
Connect with developers, ask questions, share your projects
import { ElectrumTcp, ElectrumTls } from '@tetherto/wdk-wallet-btc'
// Production with custom Fulcrum server
const productionClient = new ElectrumTls({
host: 'your-fulcrum-server.com',
port: 50002
})
const productionWallet = new WalletManagerBtc(seedPhrase, {
client: productionClient,
network: 'bitcoin'
})
// Development with alternative public server
const developmentClient = new ElectrumTcp({
host: 'fulcrum.frznode.com',
port: 50001
})
const developmentWallet = new WalletManagerBtc(seedPhrase, {
client: developmentClient,
network: 'bitcoin'
})
import { ElectrumTcp } from '@tetherto/wdk-wallet-btc'
const client = new ElectrumTcp({
host: 'electrum.blockstream.info', // Or your own server
port: 50001
})
const wallet = new WalletManagerBtc(seedPhrase, {
client,
network: 'bitcoin'
})
import { ElectrumTcp } from '@tetherto/wdk-wallet-btc'
const client = new ElectrumTcp({
host: 'testnet.hsmiths.com', // Example testnet server
port: 53011
})
const wallet = new WalletManagerBtc(seedPhrase, {
client,
network: 'testnet'
})
import { ElectrumTcp } from '@tetherto/wdk-wallet-btc'
const client = new ElectrumTcp({
host: 'localhost', // Local regtest node
port: 50001
})
const wallet = new WalletManagerBtc(seedPhrase, {
client,
network: 'regtest'
})
import WalletManagerBtc, { ElectrumTls } from '@tetherto/wdk-wallet-btc'
// Create Electrum client
const client = new ElectrumTls({
host: 'your-electrum-server.com', // Replace with your server
port: 50002
})
// Create wallet manager with configuration
const wallet = new WalletManagerBtc(seedPhrase, {
client,
network: 'bitcoin',
bip: 84 // Native SegWit (default)
})
// Get accounts (inherit configuration from manager)
const account0 = await wallet.getAccount(0)
const account1 = await wallet.getAccount(1)
const customAccount = await wallet.getAccountByPath("0'/0/5")
// Clean up when done
wallet.dispose()