Skip to main content
TypeScript SDK for building Bitcoin wallet applications on Node.js and browsers. Requires Node.js v18+.
TypeScript SDK

Getting Started

To get started, follow the steps below.
Want to skip the manual setup? Scaffold a new project instantly:
Supports React (Vite), Next.js, React Native, Expo, Express, and more.
1

Install SDK

Install the Spark SDK packages using your package manager of choice.
2

Setup Wallet

Create a wallet instance that will be used to interact with the Spark network.
wallet.ts
3

Start Building

You’re ready to start building.
app.ts

TypeScript Configuration

tsconfig.json

Create a tsconfig.json file in your project root:
tsconfig.json

Package.json Scripts

Add TypeScript build scripts to your package.json:
package.json

Core Wallet Operations

Initialize a Wallet

A wallet requires either a mnemonic or raw seed for initialization. The initialize() function accepts both. If no input is given, it will auto-generate a mnemonic and return it.

Mnemonic Phrases

A mnemonic is a human-readable encoding of your wallet’s seed. It’s a 12- or 24-word phrase from the BIP-39 wordlist, used to derive the cryptographic keys that control your wallet.

TypeScript Features

Type Safety

The Spark TypeScript SDK provides full type safety for all wallet operations:

Interface Definitions

All wallet methods return properly typed interfaces: