1. Create a Spark wallet
Create a Spark wallet by calling the wallet creation endpoint withchain_type: 'spark'
. Learn more about creating wallets here.
sprt1pgss...
).
Spark supports both mainnet and testnet environments:
MAINNET
: Production Bitcoin networkREGTEST
: Test network for development
MAINNET
address is automatically returned. To get the REGTEST
address, you can use the returned public key and the encodeSparkAddress
method from the Spark SDK.On subsequent wallet requests, your request will need to include the network you want to take the operation on.2. Transfer BTC
Transfer Bitcoin to another Spark address using thetransfer
endpoint. The amount is specified in satoshis.
Most Spark wallet operations (transferring BTC and checking balances) require authorization
signatures using user keys. Only wallet creation can be done without authorization signatures.
Learn more about signing requests with user
keys.
3. Check balance and claim transfers
Use thegetBalance
endpoint to retrieve your wallet balance and automatically claim any pending transfers.
- Your native Spark balance in satoshis
- Any token balances with metadata
- Automatically claims pending incoming transfers
4. Execute more wallet requests
This guide demonstrates how to usetransfer
and getBalance
, but Privy supports many Spark wallet methods including:
transfer
- Transfer satoshis from a Spark wallet to another Spark addressgetBalance
- Retrieve wallet balance and token holdings, automatically claims pending transferstransferTokens
- Transfer Spark tokens to another Spark addresscreateLightningInvoice
- Create a Lightning invoice to receive funds via Lightning NetworkpayLightningInvoice
- Pay a Lightning Network invoicegetStaticDepositAddress
- Get a static Bitcoin address for depositsgetClaimStaticDepositQuote
- Get a quote for claiming a static depositclaimStaticDeposit
- Claim funds from a static Bitcoin depositsignMessageWithIdentityKey
- Sign a message using the wallet’s identity key