Usage
Installation, quick start, and usage examples for @tetherto/wdk-wallet-btc
Installation
npm install @tetherto/wdk-wallet-btcQuick Start
Importing from @tetherto/wdk-wallet-btc
@tetherto/wdk-wallet-btcCreating a New Wallet
import WalletManagerBtc, { ElectrumTcp } from '@tetherto/wdk-wallet-btc'
// Use a BIP-39 seed phrase (replace with your own secure phrase)
const seedPhrase = 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about'
// Create Electrum client
const client = new ElectrumTcp({
host: 'electrum.blockstream.info',
port: 50001
})
// Create wallet manager with client
const wallet = new WalletManagerBtc(seedPhrase, {
client,
network: 'bitcoin' // 'bitcoin', 'testnet', or 'regtest'
})
// Get a full access account (uses BIP-84 derivation path by default)
const account = await wallet.getAccount(0)
// Get the account's address (Native SegWit by default)
const address = await account.getAddress()
console.log('Account address:', address)
