0 -> 1 on Spark
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:
Step 1: Initialize Your Wallet
Create your first Spark wallet:
Example output:
Important: Secure your mnemonic offline. Anyone with access can control your funds.
To recover an existing wallet:
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:
This will print a valid Bitcoin address to which you can send funds.
After sending the transaction, to retrieve the transaction hash, run:
Once the transaction is confirmed on-chain, claim it:
Verify that your balance has increased:
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.
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.
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.
You can follow along in the explorer (coming soon), and after the transaction is confirmed, you need to claim it in Wallet 2
Use getbalance
on each wallet to make sure it happened as expected.