Vultisig SDK

⚠️ Alpha Release: This SDK is currently in alpha development. APIs may change without notice. Use in production at your own risk.

Table of Contents


Installation & Setup

Install the Package

Platform Requirements

  • Node.js: Version 20 or higher

  • Browser: Modern browsers with WebAssembly support (Chrome, Firefox, Safari, Edge)

  • TypeScript: Optional but recommended

Browser Setup: WASM Files

For browser environments, you need to serve the WASM files from your public directory:

  1. Copy WASM files to your public directory:

  2. The SDK will automatically load these files from the root path (/)

Basic Initialization

The SDK automatically uses the appropriate storage for your platform:

  • Node.js: FileStorage (stores in ~/.vultisig by default)

  • Browser: BrowserStorage (uses IndexedDB with localStorage fallback)

Custom Storage (optional):


Quick Start Tutorial

Here's a complete example showing vault creation, address derivation, and balance checking with password management:


Core Concepts

Vault Types

The SDK supports two types of vaults:

  • FastVault: 2-of-2 MPC with VultiServer assistance. Always encrypted with password. Best for quick setup and individual use.

  • SecureVault (Coming Soon): Multi-device MPC without server. Optionally encrypted. Best for maximum security and multi-device scenarios.

Supported Chains

The SDK supports 40+ blockchains across multiple ecosystems:

  • EVM: Ethereum, Polygon, BSC, Arbitrum, Optimism, Base, Avalanche, Blast, Cronos, ZkSync

  • UTXO: Bitcoin, Litecoin, Dogecoin, Bitcoin Cash, Dash

  • Cosmos: Cosmos Hub, THORChain, MayaChain, Osmosis, Dydx, Kujira, Terra

  • Other: Solana, Polkadot, Sui, TON, Ripple, Tron, Cardano

See the Quick Reference section for the complete list.

Storage Layer

By default, the SDK uses in-memory storage (data is lost on restart). For persistence:

  • Browser: Use IndexedDB storage (see examples/browser)

  • Node.js: Implement file-based storage or use a database

  • Custom: Implement the Storage interface

Stateless Usage

For scenarios where you don't need persistent storage—such as one-off operations, testing, or serverless functions—use MemoryStorage to create ephemeral vault instances:

Use cases for stateless usage:

  • One-off signing: Sign a transaction without persisting vault state

  • Address derivation: Generate addresses without storing vault data

  • Testing: Unit and integration tests without filesystem side effects

  • Serverless functions: Lambda/Cloud Functions that load vault per-request

  • CLI tools: Command-line utilities that operate on vault files

What works in stateless mode:

  • ✅ Address derivation

  • ✅ Balance checking

  • ✅ Transaction signing (FastVault)

  • ✅ Gas estimation

  • ✅ Swap quotes and execution

  • ✅ Token/chain management (in-memory only)

What doesn't persist:

  • ❌ Vault preferences (chains, tokens, currency)

  • ❌ Cached balances/addresses (recreated each session)

  • ❌ Password cache (must provide password each time)

Note: The vault file (.vult) itself is never modified by the SDK—it's read-only. Persistence is about SDK metadata and cached data, not the vault file contents.


Password Management

Password management is a critical aspect of the SDK. FastVaults are always encrypted, and proper password handling ensures both security and good user experience.

When Passwords Are Required

  • FastVault: Always encrypted, password required for all operations

  • SecureVault: Optional encryption, password only required if encrypted

  • Import: Password required if the vault file is encrypted

  • Export: Password optional, encrypts the backup file

Setting Up Password Callback

Configure a password callback when creating your SDK instance to automatically prompt users when needed:

Browser Example (with Modal)

Node.js Example (Command Line)

Retrieve from Secure Storage

Password Caching

Cache passwords to avoid repeated prompts during a session:

Common TTL configurations:

Manual Lock/Unlock

Control password cache manually for sensitive operations:

Example: Auto-lock on Inactivity

Checking Encryption Status

Before importing a vault, check if it requires a password:

Export with Password

Create encrypted backups with a password (can be different from vault password):

Password Security Best Practices

  1. Never store passwords in plain text

  2. Use password caching with reasonable TTLs (5-15 minutes recommended)

  3. Lock vaults after sensitive operations

  4. Use different passwords for backups

  5. Implement auto-lock on inactivity

  6. Clear password cache on logout

  7. Use secure password input (type="password" in forms)


Vault Management

Creating Fast Vaults

Create a new vault with server assistance:

Importing Vaults

Import an existing vault from a .vult backup file:

Exporting Vaults

Create a backup of your vault:

Listing Vaults

Get all stored vaults:

Switching Vaults

Set the active vault:

Deleting Vaults

Remove a vault from storage:

Renaming Vaults


Essential Operations

Address Derivation

Get addresses for different blockchains:

Addresses are cached automatically for performance.

Balance Checking

Check balances for your assets:

Preparing & Sending Transactions

Send transactions on any supported chain:

Gas Estimation

Get gas information for transactions:

Token Management

Add and manage custom tokens:

Chain Management

Manage which chains are active for the vault:

Portfolio Value

Get total portfolio value in fiat:


Token Swaps

The SDK supports token swaps across multiple chains and protocols, including cross-chain swaps via THORChain and same-chain DEX aggregation via 1inch.

Supported Swap Routes

Route Type
Provider
Example

Cross-chain (BTC, ETH, Cosmos)

THORChain

BTC → ETH, ETH → ATOM

Same-chain EVM

1inch

ETH → USDC on Ethereum

Cross-chain EVM

LiFi

Polygon → Arbitrum

Checking Swap Support

Getting a Swap Quote

Get a quote before executing a swap:

Swapping with ERC-20 Tokens

For ERC-20 tokens, specify the token contract address:

Executing a Swap

Complete swap flow with signing and broadcasting:

Checking Token Allowance

Check if ERC-20 approval is needed before swapping:

Swap Events

Subscribe to swap-related events:

Error Handling

Handle common swap errors gracefully:


Configuration

SDK Instance Configuration

All configuration is passed to the Vultisig constructor. The SDK uses instance-scoped configuration (no global state):

Multiple SDK Instances

You can create multiple isolated SDK instances, each with its own storage and configuration:

Custom Storage Implementation

Implement the Storage interface for custom persistence:


Caching System

The SDK uses a multi-level caching system for optimal performance:

Address Caching

Addresses are cached indefinitely by default (they never change):

Addresses are cached permanently (they never change for a vault) and persisted to storage.

Balance Caching

Balances are cached to avoid excessive API calls:

Configure cache TTLs:

Password Caching

Passwords are cached to avoid repeated prompts (see Password Management):

Portfolio Value

Total portfolio value is calculated from cached balances and prices:

Cache Invalidation

Caches are automatically invalidated when:

  • Balance updated from transaction

  • Token added/removed

  • Chain added/removed

  • Currency changed

Manual cache clearing:


Event System

Subscribe to vault events for reactive UIs:

Available Events

Event Patterns

React Example:

Unsubscribe from Events:


Quick Reference

Vultisig Class Methods

VaultBase Methods

Vault Creation Methods

Fast vaults and secure vaults are created through the Vultisig class:

Supported Chains

Common Configuration Options


Platform Notes

Browser

WASM Files: Must be served from the root path:

IndexedDB Storage: For persistent storage, use IndexedDB (see examples/browser for implementation).

Import:

Security Considerations:

  • Use type="password" for password inputs

  • Consider using Web Crypto API for sensitive data

  • Implement Content Security Policy (CSP)

Node.js

Import:

Custom Storage: For custom persistence needs, implement the Storage interface (see Custom Storage Implementation for a full example).

Password Input: Use libraries like inquirer or prompts for CLI password input.

React Native

Status: Coming soon

Electron

Status: Coming soon


Additional Resources

  • Examples:

    • Browser Example - Full React app with UI

    • CLI - Command-line wallet with interactive shell mode

  • GitHub: vultisig-sdk

  • Issues: Report bugs and request features on GitHub


Questions or feedback? Open an issue on GitHub or check the example projects for more detailed implementations.

Last updated

Was this helpful?