Get Started
Install and create your first Bitcoin wallet.
This guide explains how to install the package, create a wallet, get your first account, and optionally convert to read-only.
1. Install the Package
Prerequisites
npm install @tetherto/wdk-wallet-btc2. Create a Wallet
You can create a new wallet instance using the WalletManagerBtc constructor with a BIP-39 seed phrase and an Electrum client:
import WalletManagerBtc, { ElectrumTcp } from '@tetherto/wdk-wallet-btc'
const seedPhrase = 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about'
const client = new ElectrumTcp({
host: 'electrum.blockstream.info',
port: 50001
})
const wallet = new WalletManagerBtc(seedPhrase, {
client,
network: 'bitcoin'
})Secure the Seed Phrase: You must securely store this seed phrase immediately. If it is lost, the user will permanently lose access to their funds.
Electrum Server Performance: Public servers like Blockstream's can be 10-300x slower than private servers. For production use, set up your own Fulcrum server. For development, consider fulcrum.frznode.com as a faster alternative.
3. Get Your First Account
You can retrieve an account at a given index using wallet.getAccount():
const account = await wallet.getAccount(0)
const address = await account.getAddress()
console.log('Wallet address:', address)This implementation uses BIP-84 derivation paths and generates Native SegWit (bech32) addresses by default. Addresses start with bc1 on mainnet. Set bip: 44 in config for legacy (P2PKH) addresses.
4. (optional) Convert to Read-Only
You can convert an owned account to a read-only account using account.toReadOnlyAccount():
const readOnlyAccount = await account.toReadOnlyAccount()Next Steps
With your wallet ready, learn how to manage multiple accounts.