This guide walks you through setting up a Spark wallet, depositing Bitcoin, sending funds over Spark and Lightning, and withdrawing back to L1. In under 10 minutes, you’ll experience why Spark is designed to make Bitcoin as easy to use as a modern digital wallet.

Setup: Run the CLI

Clone and launch the Spark CLI, powered by the Spark SDK:

# Clone the Spark SDK repo
git clone https://github.com/buildonspark/spark.git

# Navigate to the JS folder
cd spark/sdks/js

# Install dependencies and build the SDK
yarn && yarn build

# Navigate to the JS CLI folder
cd examples/spark-cli

# Start the CLi
yarn cli:mainnet

Step 1: Initialize Your Wallet

Create your first Spark wallet:

> initwallet

Example output:

Mnemonic: please broccoli hole unfold trigger novel marriage come invest need ostrich never
Network: MAINNET

Important: Secure your mnemonic offline. Anyone with access can control your funds.

To recover an existing wallet:

> initwallet <mnemonic>

Step 2: Deposit Bitcoin

Spark uses single-use deposit addresses. Never reuse them. Heads up: We’re actively working on new deposit options that will eliminate the need for generating new addresses every time. Expect updates soon.

Generate a deposit address:

> getdepositaddress
bc1pz5sxkd4eaycla7av8c9avmdleyertmhkh2zf60vrmn346wwnjayq8phsra

This will print a valid Bitcoin address to which you can send funds.

After sending the transaction, to retrieve the transaction hash, run:

> getlatesttx <deposit address>
# Example:
> getlatesttx bc1pz5sxkd4eaycla7av8c9avmdleyertmhkh2zf60vrmn346wwnjayq8phsra
2c5ccdc5852eb23662344c142970a1d96f2bed539a1be074cbbff65411ba3270

Once the transaction is confirmed on-chain, claim it:

> claimdeposit <transaction hash>
# Example:
> claimdeposit 2c5ccdc5852eb23662344c142970a1d96f2bed539a1be074cbbff65411ba3270

Verify that your balance has increased:

> getbalance
Sats Balance: 30000

Step 3: Transfer Funds via Spark

Create a new wallet and fetch its Spark Address. The Spark Address is a static address that can be shared with payers to receive funds.

# Wallet 2
> initwallet
Mnemonic: repeat entry hazard estate normal relief pledge act online raw pull bean
Network: MAINNET
> getsparkaddress
sprt1pgss9yrf7gljw2yr8fupgw9pevqnffs3qjz6cnnd87hvtt8hkfhsh66mq57r7e

# Wallet 1
> initwallet <wallet 1 mnemonic>
> sendtransfer <amount> <spark address>
# Example:
> sendtransfer 1000 sprt1pgss9yrf7gljw2yr8fupgw9pevqnffs3qjz6cnnd87hvtt8hkfhsh66mq57r7e

That’s it! Your funds moved between the two wallets. Use getbalance on each wallet to make sure it happened as expected.

Step 4: Send and receive a Lightning payment

Spark is fully compatible with Lightning. Let’s test it by send a lightning payment between our 2 wallets.

# Wallet 2
> initwallet <wallet 2 mnemonic>
> createinvoice <amount> <optional memo>
# Example:
> createinvoice 1000 Spark is awesome!

# Wallet 1
> initwallet <wallet 1 mnemonic>
> payinvoice <encoded invoice> <max fees>
# Example:
> payinvoice lnbc10u1p5pqphup[...]cpkql23a 200

The payer will specify the maximum amount of fees they are willing to pay for this invoice (in sats) and the SDK will optimize the payment to find the lower fees but will never go over that value.

Use getbalance on each wallet to make sure it happened as expected.

Step 5: Withdraw funds into a L1 wallet

You can withdraw funds from Spark by sending them to an L1 address.

For this example, we are going to “withdraw” the funds from our wallet 1 into our wallet 2.

# Wallet 2
> initwallet <mnemonic>
> getdepositaddress

# Wallet 1
> initwallet <mnemonic>
> withdrawalfee <amount> <deposit address>
# Example:
withdrawalfee 15000 bc1p6tx52amnr448lv8vyr7fumqt3c2qmlkg4hgvj8swxfcz8cayukvqwk9mu6
# If the fees are acceptable
> withdraw <amount> <deposit address> <SLOW|MEDIUM|FAST>
# Example:
> withdraw 15000 bc1pslvlzmkwz8f42u8vr2fkhdhyzyh2x5cwy8l0lpdnqr4ptsjrefrq0sd0gl FAST

You can follow along in the explorer (coming soon), and after the transaction is confirmed, you need to claim it in Wallet 2

# Wallet 2
> initwallet <mnemonic>
> claimdeposit <transaction hash>

Use getbalance on each wallet to make sure it happened as expected.