Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
27375c9
Merge pull request #50 from LtbLightning/v0.4.3
BitcoinZavior Nov 10, 2025
a5dee12
Update precompile_binaries.yml
BitcoinZavior Nov 10, 2025
6f10419
chore: update frb version feat: add script to makefile for easier dev…
BitcoinZavior Nov 12, 2025
6ea0823
chore: update type.rs file, todo: Logger Stuff not implemented chore:…
BitcoinZavior Nov 12, 2025
7e50676
feat: migrate existing code to ldk_node 0.5.0 both in rust and dart
BitcoinZavior Nov 12, 2025
2df24ac
feat: implement remaining features added, logging excluded
BitcoinZavior Nov 13, 2025
518575e
feat: impl logging
BitcoinZavior Nov 13, 2025
df0f2e7
feat: frb dont ignore types feat: migrate example
BitcoinZavior Nov 14, 2025
671daaa
update
BitcoinZavior Nov 15, 2025
877af39
chore: move fee rate definition to Dart
BitcoinZavior Nov 18, 2025
d0eeddd
chore: update freezed version to 3
BitcoinZavior Nov 21, 2025
799f97e
fix: PaymentDetails being opaque
BitcoinZavior Nov 23, 2025
137c52b
feat: update changelog and version
BitcoinZavior Nov 24, 2025
31300ba
chore: update tests
BitcoinZavior Nov 25, 2025
a84d24d
feat: comment out vss to make node run
BitcoinZavior Nov 30, 2025
0b62a27
lib update
BitcoinZavior Dec 1, 2025
3961311
Merge branch 'main' of https://github.com/LtbLightning/ldk_node_flutter
BitcoinZavior Dec 2, 2025
31096ff
fix: comflict resolution
BitcoinZavior Dec 2, 2025
b647fbe
fix: flutter version upgrade
BitcoinZavior Dec 4, 2025
5dcf591
test: ldk v5.0.0 regression test
BitcoinZavior Dec 6, 2025
83069df
feat: bump version
BitcoinZavior Dec 7, 2025
7cb1c27
chore: update changelog.
BitcoinZavior Dec 9, 2025
1e18db1
Merge pull request #53 from LtbLightning/feat/upgrade-ldk-node-0.5.0-UI
BitcoinZavior Dec 13, 2025
3f18562
Merge remote-tracking branch 'origin/feat/upgrade-ldk-node-0.5.0' int…
BitcoinZavior Dec 17, 2025
54e6d1b
chore: update Rust dependencies to ldk-node 0.7.0
BitcoinZavior Jan 3, 2026
66ffcf7
feat: update Rust API for bolt11 and bolt12 payments
BitcoinZavior Jan 4, 2026
dfa5591
feat: update Rust API for builder and spontaneous payments
BitcoinZavior Jan 5, 2026
7d2edad
feat: update Rust API types for ldk-node 0.7.0
BitcoinZavior Jan 6, 2026
921ec58
feat: update Rust API unified_qr and error utils, regenerate FFI bind…
BitcoinZavior Jan 7, 2026
abd395a
feat: update Dart generated code for bolt11, bolt12, builder, and spo…
BitcoinZavior Jan 8, 2026
5721f7c
feat: update Dart generated types for ldk-node 0.7.0
BitcoinZavior Jan 9, 2026
e157be9
feat: update remaining Dart generated code and FFI bindings
BitcoinZavior Jan 10, 2026
d0d526e
feat: update iOS/macOS native bindings and example app
BitcoinZavior Jan 11, 2026
bc411c7
docs: update documentation for ldk-node 0.7.0 release
BitcoinZavior Jan 12, 2026
7a80676
change pubspec version to 0.7
BitcoinZavior Jan 13, 2026
88bfbe0
Bump version to 0.7.0
BitcoinZavior Jan 13, 2026
d620275
Rename graph API methods to unsafe variants
BitcoinZavior Jan 13, 2026
c637703
Update CI workflow for precompile binaries
BitcoinZavior Jan 14, 2026
b9c0db8
Update podspec email addresses
BitcoinZavior Jan 14, 2026
c4c9257
Misc fixes and improvements
BitcoinZavior Jan 15, 2026
5212292
bump 0.6.2 to 0.7.0
BitcoinZavior Jan 16, 2026
5a312e2
use correct repository url
BitcoinZavior Jan 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .fvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"flutter": "3.32.7"
}
31 changes: 30 additions & 1 deletion .github/workflows/precompile_binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,52 @@ jobs:
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
architecture: x64
- name: Set up Java
if: (matrix.os == 'ubuntu-latest')
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Set up Android SDK
if: (matrix.os == 'ubuntu-latest')
uses: android-actions/setup-android@v2
- name: Install Specific NDK
if: (matrix.os == 'ubuntu-latest')
run: sdkmanager --install "ndk;25.1.8937393"
run: sdkmanager --install "ndk;25.1.8937393"
- name: Install bindgen-cli
run: cargo install --force --locked bindgen-cli
- name: Set iOS SDK environment
if: matrix.os == 'macOS-latest'
run: |
IPHONEOS_SDK=$(xcrun --sdk iphoneos --show-sdk-path)
IPHONESIMULATOR_SDK=$(xcrun --sdk iphonesimulator --show-sdk-path)
echo "IPHONEOS_SDK=$IPHONEOS_SDK" >> $GITHUB_ENV
echo "IPHONESIMULATOR_SDK=$IPHONESIMULATOR_SDK" >> $GITHUB_ENV
- name: Precompile (with iOS)
if: matrix.os == 'macOS-latest'
run: dart run build_tool precompile-binaries -v --manifest-dir=../../rust --repository=LtbLightning/ldk-node-flutter
working-directory: cargokit/build_tool
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
PRIVATE_KEY: ${{ secrets.CARGOKIT_PRIVATE_KEY }}
BINDGEN_EXTRA_CLANG_ARGS: "--sysroot=${{ env.IPHONEOS_SDK }} -I${{ env.IPHONEOS_SDK }}/usr/include"
CFLAGS: "--sysroot=${{ env.IPHONEOS_SDK }}"
- name: Set Android NDK environment
if: matrix.os == 'ubuntu-latest'
run: |
NDK_HOME=/usr/local/lib/android/sdk/ndk/25.1.8937393
SYSROOT=$NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/sysroot
echo "ANDROID_NDK_HOME=$NDK_HOME" >> $GITHUB_ENV
echo "ANDROID_NDK_SYSROOT=$SYSROOT" >> $GITHUB_ENV
- name: Precompile (with Android)
if: matrix.os == 'ubuntu-latest'
run: dart run build_tool precompile-binaries -v --target=aarch64-linux-android,armv7-linux-androideabi,x86_64-linux-android --manifest-dir=../../rust --repository=LtbLightning/ldk-node-flutter --android-sdk-location=/usr/local/lib/android/sdk --android-ndk-version=25.1.8937393 --android-min-sdk-version=23
working-directory: cargokit/build_tool
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
PRIVATE_KEY: ${{ secrets.CARGOKIT_PRIVATE_KEY }}
BINDGEN_EXTRA_CLANG_ARGS_aarch64_linux_android: "--sysroot=${{ env.ANDROID_NDK_SYSROOT }} -I${{ env.ANDROID_NDK_SYSROOT }}/usr/include -I${{ env.ANDROID_NDK_SYSROOT }}/usr/include/aarch64-linux-android"
BINDGEN_EXTRA_CLANG_ARGS_armv7_linux_androideabi: "--sysroot=${{ env.ANDROID_NDK_SYSROOT }} -I${{ env.ANDROID_NDK_SYSROOT }}/usr/include -I${{ env.ANDROID_NDK_SYSROOT }}/usr/include/arm-linux-androideabi"
BINDGEN_EXTRA_CLANG_ARGS_x86_64_linux_android: "--sysroot=${{ env.ANDROID_NDK_SYSROOT }} -I${{ env.ANDROID_NDK_SYSROOT }}/usr/include -I${{ env.ANDROID_NDK_SYSROOT }}/usr/include/x86_64-linux-android"
CFLAGS: "--sysroot=${{ env.ANDROID_NDK_SYSROOT }}"
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ migrate_working_dir/
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
.vscode/
temp/

# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
Expand All @@ -31,3 +32,7 @@ build/
rust/target/
rust/wallets/
rust/ldk.0.2.1/
reference/

# FVM Version Cache
.fvm/
87 changes: 87 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,90 @@
## [0.7.0]
Updated `ldk-node` to `0.7.0`.

### APIs added

- **Channel Splicing**: Experimental support for channel splicing via `spliceIn()` and `spliceOut()` methods
- **Async Payments**: Static invoice support with `receiveStaticInvoice()` and `sendStaticInvoice()` methods
- **Bitcoin Core REST**: New chain data source via `ChainDataSourceConfig.bitcoindRest()`
- **Esplora with Headers**: `ChainDataSourceConfig.esploraWithHeaders()` for custom HTTP headers
- **Pathfinding Scores**: `importPathfindingScores()` and `mergePathfindingScores()` methods
- **Custom Preimage**: `sendWithPreimage()` for spontaneous payments with custom preimage
- **Route Parameters**: `RouteParametersConfig` support for BOLT12 payments and refunds
- **Mnemonic Word Count**: `Mnemonic.generateWithWordCount()` for configurable entropy

### Notes
- Splicing-related transactions may still get misclassified in the payment store
- Liquidity service data is now persisted across restarts
- Improved shutdown robustness and reduced IO load via differential channel monitor updates

## [0.6.2]
Updated `ldk-node` to `0.6.2`.

### Notes
- No breaking changes and no new functions exposed.
- Bug fixes.
- Fix node going into a unrecoverable state when previously generated transaction accepted first, fixed on `rust bdk_wallet 2.0.0`
- refer to [ldk-node rust](https://github.com/lightningdevkit/ldk-node/releases) for misc fixes (rust, uniffi, etc).


## [0.5.0]

Updated `flutter_rust_bridge` to `2.11.1`.
Updated `ldk-node` to `0.5.0`.
Updated `freezed` to `3.2.0`
Updated `freezed-anotation` to `3.1.0`

### APIs added

- **FeeRate Class**: Added comprehensive Dart-native `FeeRate` class with utilities for fee rate conversion and common constants
- Constants: `zero`, `min`, `max`, `broadcastMin`, `dust`
- Constructors: `fromSatPerKwu()`, `fromSatPerVb()`, `fromSatPerVbUnchecked()`
- Converters: `toSatPerVbFloor()`, `toSatPerVbCeil()`, `toSatPerKwu()`
- Enhanced `OnChainPayment` methods to support `FeeRate` parameter

- **Chain Data Sources**: Added Electrum backend support as alternative to Esplora for chain and fee rate data
- `ChainDataSourceConfig.electrum()` constructor with `ElectrumSyncConfig` support
- Full FFI integration for Electrum chain data source configuration
- Background sync configuration options with customizable sync intervals

- **Enhanced Payment Events**:
- Added `payment_preimage` field to `PaymentSuccessful` events for better payment verification and tracking
- Added `PaymentForwarded` events for tracking payment forwarding through the node with detailed fee and routing information
- Custom TLV (Type-Length-Value) record support in payment events (`PaymentClaimable`, `PaymentReceived`) allowing additional metadata to be received with payments

- **LSP Integration**: Enhanced Lightning Service Provider support
- LSPS2 service integration with `receiveViaJitChannel()` and `receiveVariableAmountViaJitChannel()` methods
- `Bolt11Jit` payment variant with LSP fee limits and counterparty skimmed fee tracking
- Enhanced JIT channel support for improved liquidity management

- **Payment Store Integration**: On-chain transactions now included in internal payment store and exposed via payment APIs

### Breaking Changes

- **flutter_rust_bridge**: Updated from `2.6.0` to `2.11.1` - this major update may require code changes in applications using low-level FFI bindings
- **freezed**: Updated from previous version to `3.2.0` - may affect generated code and require regeneration of freezed classes
- **ldk-node**: Updated to `0.5.0` with significant internal changes that may affect behavior in edge cases
- **Event Structure Changes**: Payment events now include additional fields (`preimage`, `customRecords`) which may affect existing event handling code
- **Chain Data Source Configuration**: Applications using manual chain source configuration may need to update to new `ChainDataSourceConfig.electrum()` syntax

### API changed

- Enhanced on-chain payment methods to optionally accept `FeeRate` parameters for custom fee control
- `ChainDataSourceConfig` now supports Electrum as a chain data source option alongside Esplora and Bitcoin Core RPC via `ChainDataSourceConfig.electrum()`
- Payment events enhanced with preimage information in `PaymentSuccessful` events for better payment tracking and verification
- Payment events (`PaymentClaimable`, `PaymentReceived`) now include `customRecords` field for Custom TLV record support
- Added `PaymentForwarded` event type for tracking payment forwarding through the node

### Fixed

- Resolved FeeRate FFI type conflicts by implementing native Dart solution
- Improved type safety and developer experience for fee rate handling
- Enhanced payment tracking with better event handling and preimage support

### Notes

- Custom TLV support is available for receiving payments via event `customRecords`, but `sendWithCustomTlvs` for spontaneous payments is not yet exposed in the public API

## [0.4.3]

Updated `flutter_rust_bridge` to `2.6.0`.
Expand Down
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,28 @@ A Flutter library for [LDK Node](https://github.com/lightningdevkit/ldk-node), a

LDK Node is a non-custodial Lightning node. Its central goal is to provide a small, simple, and straightforward interface that enables users to easily set up and run a Lightning node with an integrated on-chain wallet. While minimalism is at its core, LDK Node aims to be sufficiently modular and configurable to be useful for a variety of use cases.

The primary abstraction of the library is the Node, which can be retrieved by setting up and configuring a Builder to your liking and calling build(). Node can then be controlled via commands such as start, stop, connectOpenChannel, sendPayment, etc.:
The primary abstraction of the library is the Node, which can be retrieved by setting up and configuring a Builder to your liking and calling build(). Node can then be controlled via commands such as start, stop, openChannel, sendPayment, etc.

This release covers the same API from LDK Node 0.1.0 Rust. It has support for sourcing chain data via an Esplora server, filesystem persistence, gossip sourcing via the Lightning peer-to-peer network, and configurable entropy sources for the integrated LDK and BDK-based wallets.
This release covers the API from LDK Node 0.7.0 Rust. It has support for sourcing chain data via Esplora, Electrum, or Bitcoin Core RPC/REST backends, filesystem persistence, gossip sourcing via the Lightning peer-to-peer network, and configurable entropy sources for the integrated LDK and BDK-based wallets.

Please note: This release is considered experimental, and should not be run in production
### Key Features

- **Multiple Chain Data Sources**: Esplora, Electrum, and Bitcoin Core (RPC & REST) backends
- **Channel Splicing**: Experimental support via `spliceIn()` and `spliceOut()` methods
- **Async Payments**: Static invoice support with `receiveStaticInvoice()` and `sendStaticInvoice()`
- **BOLT11 & BOLT12**: Full support for Lightning invoices, offers, and refunds
- **LSP Integration**: LSPS2 just-in-time (JIT) channel support for inbound liquidity
- **Unified QR Payments**: Generate and pay unified QR codes
- **Custom Fee Rates**: Comprehensive `FeeRate` class for fine-grained fee control
- **Pathfinding Scores**: Import and merge pathfinding scores for optimized routing
### How to use ldk_node

To use the `ldk_node` package in your project, add it as a dependency in your project's pubspec.yaml:


```dart
dependencies:
ldk_node: ^0.4.2
ldk_node: ^0.7.0
```
or add from pub.dev using `pub add` command

Expand Down
25 changes: 21 additions & 4 deletions cargokit/gradle/plugin.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class CargoKitPlugin implements Plugin<Project> {
private Plugin _findFlutterPlugin(Map projects) {
for (project in projects) {
for (plugin in project.value.getPlugins()) {
if (plugin.class.name == "FlutterPlugin") {
if (plugin.class.name == "com.flutter.gradle.FlutterPlugin") {
return plugin;
}
}
Expand Down Expand Up @@ -119,12 +119,29 @@ class CargoKitPlugin implements Plugin<Project> {
def jniLibs = project.android.sourceSets.maybeCreate(buildType).jniLibs;
jniLibs.srcDir(new File(cargoOutputDir))

def platforms = plugin.getTargetPlatforms().collect()
def platforms = ["android-arm", "android-arm64", "android-x64"]

// Respect NDK ABI filters if set
def abiFilters = plugin.project.android.defaultConfig.ndk?.abiFilters
if (abiFilters != null && !abiFilters.isEmpty()) {
// Filter platforms based on ABI filters
platforms = platforms.findAll { platform ->
if (platform == "android-arm" && abiFilters.contains("armeabi-v7a")) return true
if (platform == "android-arm64" && abiFilters.contains("arm64-v8a")) return true
// if (platform == "android-x86" && abiFilters.contains("x86")) return true
if (platform == "android-x64" && abiFilters.contains("x86_64")) return true
return false
}
}

// Same thing addFlutterDependencies does in flutter.gradle
if (buildType == "debug") {
// platforms.add("android-x86")
platforms.add("android-x64")
// Only add x64 if it's in ABI filters or no filters are set
if (abiFilters == null || abiFilters.isEmpty() || abiFilters.contains("x86_64")) {
if (!platforms.contains("android-x64")) {
platforms.add("android-x64")
}
}
}

// The task name depends on plugin properties, which are not available
Expand Down
1 change: 1 addition & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release
/android/app/.cxx/
103 changes: 103 additions & 0 deletions example/README_CONFIGURATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Lightning Wallet Configuration System

This app now supports user-configurable node settings with persistent storage.

## Features

### 🔐 **User-Generated Mnemonics**
- Users can generate their own secure mnemonics
- Mnemonics are stored securely using SharedPreferences
- Option to generate new mnemonics (creates new wallet)

### 🏷️ **Custom Node Names**
- Users can set their own node name
- Node name is displayed in the app title
- Stored persistently for future sessions

### 🔌 **Configurable Ports**
- Users can choose from available ports (9735-9740)
- Prevents port conflicts when running multiple emulators
- Port selection is stored and remembered

### 💾 **Persistent Storage**
- All settings are saved using SharedPreferences
- Settings persist across app restarts
- No hardcoded values for production use

## First Run Experience

When users first launch the app, they'll see a beautiful onboarding flow:

1. **Step 1: Generate Mnemonic**
- Tap "Generate Mnemonic" to create a new wallet
- Copy the mnemonic to clipboard
- Warning about keeping it safe

2. **Step 2: Set Node Name**
- Enter a custom node name
- This will be visible to other Lightning Network participants

3. **Step 3: Choose Port**
- Select from available ports (9735-9740)
- Different ports allow multiple emulators on same machine

## Settings Management

Users can access settings via the settings icon in the app bar:

- **View Current Settings**: See current mnemonic, node name, and port
- **Update Settings**: Change node name or port
- **Generate New Mnemonic**: Create a new wallet (warning about data loss)
- **Copy Mnemonic**: Copy current mnemonic to clipboard

## Multiple Emulator Support

To run multiple emulators on the same machine:

1. **First Emulator**: Use default settings (port 9735)
2. **Second Emulator**: Go to Settings → Change Port to 9736
3. **Additional Emulators**: Use ports 9737, 9738, etc.

Each emulator will have its own:
- Unique port
- Separate storage directory
- Independent wallet

## Technical Implementation

### Files Created/Modified:

- `lib/services/settings_service.dart` - Persistent storage service
- `lib/screens/onboarding_screen.dart` - First-run setup flow
- `lib/screens/settings_screen.dart` - Settings management UI
- `lib/config/node_config.dart` - Updated to use user settings
- `lib/main.dart` - Added startup flow and routing
- `lib/screens/dashboard_screen.dart` - Added settings button

### Dependencies:
- `shared_preferences: ^2.2.3` - For persistent storage
- `google_fonts: ^6.2.1` - For beautiful typography
- `qr_flutter: ^4.1.0` - For QR code display

## Security Notes

- Mnemonics are stored in SharedPreferences (device storage)
- Consider implementing encryption for production use
- Users are warned about keeping mnemonics safe
- Option to generate new mnemonics creates completely new wallets

## Testing Multiple Emulators

1. Start first emulator with default settings
2. Start second emulator and go through onboarding
3. Choose different port (e.g., 9736)
4. Both emulators can run simultaneously without conflicts
5. Each has its own wallet and can connect to each other

## Future Enhancements

- [ ] Encrypt stored mnemonics
- [ ] Add mnemonic validation
- [ ] Support for custom port ranges
- [ ] Backup/restore settings
- [ ] Import existing mnemonics
7 changes: 6 additions & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {

android {
compileSdk = flutter.compileSdkVersion
ndkVersion = "25.1.8937393"
ndkVersion = "26.3.11579264"
namespace = "io.ldk.f.ldk_node_example"
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
Expand All @@ -28,6 +28,11 @@ android {
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName

ndk {
// Filter out 32-bit architectures to avoid lightning crate compilation issues
abiFilters 'arm64-v8a', 'x86_64'
}
}

buildTypes {
Expand Down
4 changes: 2 additions & 2 deletions example/cargokit_options.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
verbose_logging: false
use_precompiled_binaries: true
verbose_logging: true
use_precompiled_binaries: false
Loading
Loading