Problem:
- Koinly marks lightning channel opens/closes as sends/receives (you are being TRIPLE-TAXED on these!)
- Koinly ignores all lightning transactions when importing Electrum data from CSV since they have "zero" BTC balance change. This means these are not reported as they should be
- If you use auto-sync/import, Koinly only sees on-chain transactions
Solution (short-term):
- This script takes your original CSV export from Electrum and makes a new one without the lightning channel opens/closes. It marks lightning transactions as on-chain transactions so they are included as normal.
- Lighting channel open/close transactions are set to zero BTC amount except network fees which remain in-tact.
- This script runs on Windows, MacOS, and Linux
- 100% open source, lightweight and fast, look at the code yourself it's very small!
- 100% local only & private, your data is never sent anywhere
🚨 Note: The IRS has not issued guidance (as of Jan 1, 2026) as to how lightning channels are taxed for the purposes of gains/losses. This script is assuming that channel opens/closes are equivalent to transfers between your own wallets and that LN transactions are equivalent to normal on-chain sends/receives. Please consult a tax professional for advice.
Solution (long-term):
😤 Tired of discriminatory tax treatment of BTC? You don't have to do this gains tracking nonsense with other international currencies. Satoshi Action makes it easy to contact your legislators to lobby for pro-BTC legislation. Consider donating 10% of your tax prep costs to them. Let's put an END to this gains-tracking nonsense!
- Delete any existing electrum imports in Koinly
- In your electrum wallet, go to History -> Configure icon -> Export, save your CSV file
- Place your CSV file in the same directory as this python script (or exe file)
- Run the python script
- Your new CSV is created, import it to Koinly
- Make a donation if this script has been useful (see below for more information)
EXE file (easiest)
- Download electrum_to_koinly.exe
Run as Python:
- Download the latest version of python from python.org. Enable the "install to system path" option while installing.
- Double-click main.py or in powershell, run
python C:\users\username\Downloads\electrum_to_koinly\main.pyor wherever you saved the tool. Powershell method is best as it will display any errors.
- In terminal go to the folder you downloaded this tool into using
cd '/home/user/Downloads/electrum_to_koinly'or wherever you put it - Run
python3 main.pyin the terminal
- In terminal go to the folder you downloaded this tool into using
cd '/home/user/Downloads/electrum_to_koinly'or wherever you put it - Run
python3 main.py
To import your Electrum wallet data to Koinly with Bitcoin lightning support, this script will work!
Did this software save you an hour or more of your time? Consider a BTC donation Thank you :).
⛓️ On-chain: bc1qunr36gpgkhlpezry88qjwl7p5jzljp23thety3
⚡ Lightning: cascadiarecovery@strike.me
Feel free to open PRs if you have any fixes or enhancements to add
This software is produced AS IS without ANY WARRANTY. This may produce wrong numbers, double-check everything carefully. This software is released into the public domain.