This is a simple Python application that allows you to generate Lightning Network invoices using the Strike API. It displays your account balances (in BTC and USD), generates invoices for deposits, shows a QR code for the invoice, and allows copying the invoice text to your clipboard.
- A Strike API key with the appropriate permissions (scopes). The app requires the
partner.balances.readscope for fetching balances and thepartner.invoice.createscope for creating invoices. See the section below for detailed instructions on how to obtain one. - Python 3.8 or later (the app uses features compatible with modern Python versions).
To use this app, you'll need a Strike API key. Here's how to create one:
- Sign up for a Strike account if you don't already have one at strike.me.
- Log in to your Strike Dashboard at dashboard.strike.me.
- Navigate to the "API Key" section in the dashboard.
- Click to create a new API key. Assign it a name (e.g., "Invoice Generator") and an optional description.
- Select the required scopes:
partner.balances.readfor accessing account balances andpartner.invoice.createfor generating invoices. It's best to assign only the minimum scopes needed. - Click "Create API Key" to generate it.
- Copy and securely store the API key immediately—it will only be shown once. Do not share it publicly or commit it to source code.
- If your key is ever compromised, return to the dashboard to revoke it and create a new one.
For more details, refer to the official Strike API documentation at docs.strike.me/api-keys/overview.
If you don't have Python installed, follow these steps:
- Go to the official Python website: python.org/downloads.
- Download the latest stable release (e.g., Python 3.12.x or higher) for your operating system (Windows, macOS, or Linux).
- Run the installer:
- Windows/macOS: During installation, check the box that says "Add Python to PATH" (this is crucial for running Python from the command line without specifying the full path).
- Linux: Python is often pre-installed, but if not, use your package manager (e.g.,
sudo apt install python3on Ubuntu). Ensurepipis installed (e.g.,sudo apt install python3-pip).
- Verify the installation by opening a terminal/command prompt and running:
It should display the Python version (e.g., "Python 3.12.3"). If it doesn't, you may need to restart your terminal or manually add Python to your PATH (see below).
python --version
If you forgot to check "Add Python to PATH" during installation or encounter issues:
-
Windows:
- Search for "Environment Variables" in the Start menu and open "Edit the system environment variables."
- Click "Environment Variables" > Under "System variables," find and select "Path" > Click "Edit."
- Click "New" and add the path to your Python installation (e.g.,
C:\Python312orC:\Users\YourUsername\AppData\Local\Programs\Python\Python312). - Also add the Scripts folder (e.g.,
C:\Python312\Scripts). - Click OK to save, then restart your command prompt.
-
macOS:
- Open Terminal.
- Edit your shell profile (e.g.,
nano ~/.zshrcfor zsh ornano ~/.bash_profilefor bash). - Add:
export PATH="/Library/Frameworks/Python.framework/Versions/3.12/bin:$PATH"(adjust the version/path as needed). - Save and run
source ~/.zshrc(or equivalent).
-
Linux:
- Open Terminal.
- Edit your shell profile (e.g.,
nano ~/.bashrc). - Add:
export PATH="$HOME/.local/bin:$PATH"(or the path to your Python bin). - Save and run
source ~/.bashrc.
- Clone this repository or download the ZIP file from GitHub.
- Extract the files if needed. The main script is
StrikeAppDepositsV1.0.py.
The app requires a few Python libraries. Open a terminal/command prompt, navigate to the folder containing StrikeAppDepositsV1.0.py (using cd path/to/folder), and run:
pip install requests qrcode pillow
requests: For making API calls to Strike.qrcode: For generating QR codes.pillow: For handling images (used with qrcode and tkinter).
Note: tkinter and json are standard libraries included with Python, so no extra installation is needed for them.
If you encounter permission issues, try:
- Windows/macOS: Run the command prompt/terminal as administrator.
- Or use:
pip install --user requests qrcode pillow
- In the terminal/command prompt, navigate to the folder with the script.
- Run:
(Or
python StrikeAppDepositsV1.0.pypython3 StrikeAppDepositsV1.0.pyon some systems.)
This will launch the GUI window.
- Enter your Strike API key in the "Strike API Key" field and click "Set Key & Refresh." This will load your account balances.
- In the "Generate Lightning Invoice" section:
- Enter the amount (e.g., 0.0001 for BTC or 5 for USD).
- Select the currency (BTC or USD).
- Click "Generate Invoice."
- The QR code will appear, along with a truncated invoice ID and LN invoice text.
- Click "Copy Invoice Text" to copy the full LN invoice to your clipboard.
- Scan the QR code with a Lightning wallet (e.g., Wallet of Satoshi, Muun) to pay the invoice and deposit funds.
- API Errors: Ensure your API key has the correct scopes (
partner.balances.readandpartner.invoice.create). Check Strike's API docs for details: docs.strike.me. - QR Code Not Generating: Make sure Pillow and qrcode are installed correctly (run
pip show pillow qrcodeto verify). - Tkinter Issues: If tkinter is missing (rare on Windows/macOS), install it via your package manager (e.g.,
sudo apt install python3-tkon Ubuntu). - Balances Not Loading: Verify your internet connection and API key validity.
If you run into issues, feel free to open an issue on this GitHub repo!