Get Started
Install the Spark wallet package and create your first account.
This guide explains how to install the package, create a wallet, get your first account, and optionally convert the account to read-only.
1. Install the Package
Prerequisites
Install @tetherto/wdk-wallet-spark:
npm install @tetherto/wdk-wallet-sparkThe WDK Spark wallet module uses ES Modules (import / export). Set "type": "module" in package.json, or run in an environment that supports ESM.
2. Create a Wallet
You can create a wallet manager using the WalletManagerSpark constructor with a BIP-39 seed phrase:
import WalletManagerSpark from '@tetherto/wdk-wallet-spark'
const seedPhrase = 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about'
const wallet = new WalletManagerSpark(seedPhrase)
const walletRegtest = new WalletManagerSpark(seedPhrase, {
network: 'REGTEST'
})Secure the seed phrase: Store this seed phrase securely. If it is lost, the user will permanently lose access to their funds.
For development on REGTEST, you can request test funds from the Lightspark Regtest Faucet.
The Spark wallet uses @buildonspark/spark-sdk. Network options are MAINNET, SIGNET, or REGTEST. There is no custom RPC provider option.
3. Get Your First Account
- Call
wallet.getAccount()with index0. - Call
account.getAddress()to read the Spark address.
You can retrieve the first account using wallet.getAccount():
const account = await wallet.getAccount(0)
const address = await account.getAddress()
console.log('Account address:', address)4. (optional) Convert to Read-Only
You can create a read-only view of the account using account.toReadOnlyAccount():
const readOnlyAccount = await account.toReadOnlyAccount()Next Steps
With your wallet ready, learn how to manage multiple accounts.