Testing Guide
Learn how to test your wallet operations on Spark
Setting Up Your Test Environment
Prerequisites
- Node.js 16+ or Rust installed
- Spark Wallet SDK
Testing on Regtest
You can test your wallet operations in the Regtest environment.
For testing on Regtest, you can visit Spark Regtest Faucet to obtain funds and interact with spark.
-
Username:
hackathon
-
Password:
MakeBitcoinMoneyAgain
Keep your balance on Spark below 100,000 sats otherwise you may run into issues.
Paying an invoice directly from regtest
You can pay invoices using the Lightning Command Line tool in the spark repo. Below are the set up instructions:
Git clone the repo:
Go to the tools folder:
Install dependencies:
Verify rust is installed:
Run the Tool:
The first time you run the tool it will download additional dependencies. and then will process the lightning invoice payment. Second time you run it, it will process the payment faster.
Testing on Mainnet
You can test your wallet operations in the mainnet environment.
In mainnet, we recommend you maintain the balance below 1000 sats.
You can test send/receive Lightning payments to/from any Lightning-compatible wallet or exchange. Here are some popular options:
Using our Spark CLI tool
We have a CLI tool that allows you to test your wallet operations on Spark. No coding is required!
To install the CLI tool, you can run:
Go to the examples folder:
Install dependencies:
Start the CLI tool: Pick network as mainnet or regtest
This will start the CLI tool and you will be able to interact with the wallet. Run help
to see the available commands.
Command Reference
Command | How to Run |
---|---|
initwallet | initwallet <mnemonic/seed> - Creates a new wallet instance. If no mnemonic provided, generates one |
getbalance | getbalance - Gets the current wallet balance as well the token balance |
getdepositaddress | getdepositaddress - Generates a Bitcoin deposit address |
getsparkaddress | getsparkaddress - Gets a new Spark address for receiving transfers |
sendtransfer | sendtransfer <amount> <receiverSparkAddress> - Sends a Spark transfer |
createinvoice | createinvoice <amount> <memo> - Creates a new Lightning invoice |
payinvoice | payinvoice <invoice> - Pays a Lightning invoice |
tokentransfer | tokentransfer <tokenPubKey> <amount> <receiverSparkAddress> - Sends a token transfer to given receiver spark address |
withdraw | withdraw <onchainAddress> <amount> - Withdraws funds to a Bitcoin address |
help | help - Shows the help menu |
exit | exit or quit - Exits the CLI tool |
Demp application
The Demo Application presented at the Hackation is available Here