Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
4849b09
Update `Cargo.toml` post-release of v0.7.0-rc.0
tnull Nov 19, 2025
9c20fc5
Merge pull request #709 from tnull/2025-11-cut-v0.7.0-rc.0
tnull Nov 19, 2025
e093838
Replace docs.rs build `doc_auto_cfg` feature with `doc_cfg`
tnull Nov 19, 2025
3a767bc
Merge pull request #710 from tnull/2025-11-drop-doc-auto-cfg
tnull Nov 19, 2025
8da201a
Revert batched VSS `lazy` deletes, rather `spawn` them into the backg…
tnull Dec 2, 2025
5707f9e
Merge pull request #723 from tnull/2025-12-spawn-lazy-deletes-0.7
tnull Dec 2, 2025
86a89ec
Bump LDK to v0.2.0 final release
tnull Dec 3, 2025
a6953b1
Bump LDK Node version number(s) to v0.7.0
tnull Dec 3, 2025
683922b
Update CHANGELOG for final v0.7.0 release
tnull Dec 3, 2025
b707e5a
Update Swift files for v0.7.0 build
tnull Dec 3, 2025
68ab7f4
Merge pull request #724 from tnull/2025-12-cut-v0.7.0
tnull Dec 3, 2025
4850499
feat: Add RBF and CPFP transaction fee bumping support
coreyphillips May 30, 2025
c2412bc
feat: add coin selection with BDK algorithms and manual UTXO control
coreyphillips Jun 10, 2025
d828bba
feat: add calculate_total_fee method for fee estimation
coreyphillips Jul 6, 2025
bca359b
feat: expose calculate_cpfp_fee_rate
coreyphillips Jun 17, 2025
cbcf994
fix: handle max amount calculations in calculate_total_fee
coreyphillips Jul 31, 2025
f9d5dd4
feat: add routing fee estimation
coreyphillips Sep 3, 2025
874e4f8
feat: add description field to BOLT11 payments
coreyphillips Jul 18, 2025
95ed617
feat: add `bolt11` field to PaymentDetails
coreyphillips Jul 28, 2025
e45e247
feat: temporary onchain events implementation
coreyphillips Nov 15, 2025
4dc90e0
chore: improve comments around OnchainTransactionUnconfirmed
coreyphillips Nov 21, 2025
da062ea
chore: improve onchain events
ben-kaufman Nov 25, 2025
17d31af
Add evicted transaction event
ben-kaufman Nov 25, 2025
21676dd
Expose wallet get_transaction_details
ben-kaufman Nov 25, 2025
7f5ef1b
feat: add get_address_balance
ben-kaufman Nov 25, 2025
aa4acf4
feat: emit replaced tx conflicts
ben-kaufman Nov 25, 2025
2a37785
feat: Jitpack android setup
ovitrif Jun 2, 2025
85a1ebc
fix: update build scripts
coreyphillips Jun 13, 2025
1b3c009
chore: update gradle and android-gradle-plugin
ovitrif Oct 10, 2025
89393fc
feat: add kotlin serialization dependencies
ovitrif Oct 10, 2025
be98973
chore: remove unused template generated by gradle
ovitrif Oct 10, 2025
ae56ebc
feat: use gobley fork as bindgen tool for android
ovitrif Oct 10, 2025
8c39a2e
feat: use gobley v0.2.0 from fixed fork
ovitrif Oct 13, 2025
edaf3f3
fix: add kotlinx.coroutines.IO import fix to Android build script
ben-kaufman Dec 2, 2025
23e0332
fix: path to xcframework
Jasonvdb Jun 6, 2025
2d75246
fix: update error
coreyphillips Jun 11, 2025
ed2cc0c
docs: update ldk-node-android module
coreyphillips Jun 18, 2025
00d0e1a
chore: update gitignore
ovitrif Sep 26, 2025
bbe8717
fix: specify jvm target config
ovitrif Oct 10, 2025
13b4053
docs: add RBF, CPFP, UTXO management, and fee estimation to CHANGELOG
ben-kaufman Dec 2, 2025
289aa1e
fix: align fork with upstream LDK 0.7 architecture
ben-kaufman Dec 2, 2025
e1b591c
feat: allow including received unconfirmed balance in spendable balance
ben-kaufman Dec 3, 2025
f51e66f
Release v0.7.0
ben-kaufman Dec 10, 2025
47bfd94
Release v0.7.0-rc.1
ben-kaufman Dec 11, 2025
2b3a14d
feat: add channel data migration from external LDK implementations
ben-kaufman Dec 22, 2025
612ad05
Merge pull request #25 from synonymdev/migrate-old-ldk
ovitrif Dec 23, 2025
7eda379
feat: expose derive_node_secret_from_mnemonic
ovitrif Jan 10, 2026
ae82e4d
refactor: move imports to top of file
ovitrif Jan 12, 2026
e7e8fe8
Merge pull request #26 from synonymdev/feat/expose-derive-secret
ben-kaufman Jan 12, 2026
ebfe6bc
chore: bump version to v0.7.0-rc.4
ovitrif Jan 12, 2026
07723e7
chore: update bindings
ovitrif Jan 12, 2026
a7a4726
Merge pull request #27 from synonymdev/chore/release-0.7.0-rc.4
ben-kaufman Jan 12, 2026
18ed800
fix: derive_node_secret_from_mnemonic to match KeysManager
ovitrif Jan 12, 2026
5955f37
Clean up derive_node_secret_from_mnemonic
ben-kaufman Jan 12, 2026
8108440
Merge pull request #29 from synonymdev/clean-up-derive-secret
ovitrif Jan 12, 2026
04225aa
chore: bump version to v0.7.0-rc.6, update bindings
ovitrif Jan 12, 2026
5e0f612
chore: update missing version files and consolidate CHANGELOG
ovitrif Jan 12, 2026
b94fb28
chore: fix CHANGELOG formatting per review
ovitrif Jan 13, 2026
9323921
Merge pull request #28 from synonymdev/fix/derive-node-secret-bip32-path
ben-kaufman Jan 13, 2026
fa9f9f7
feat(config): add runtime-adjustable wallet sync intervals
coreyphillips Jan 14, 2026
e3f994e
chore: update bindings
coreyphillips Jan 14, 2026
52c798c
chore: bump version
coreyphillips Jan 14, 2026
3b13996
chore: revert version
coreyphillips Jan 14, 2026
9ecb558
chore: bump version
coreyphillips Jan 14, 2026
36af1f7
feat: add claimable_on_close_sats to ChannelDetails
ovitrif Jan 16, 2026
101c7c8
chore: update changelog
ovitrif Jan 16, 2026
34efb6d
chore: add ai rules
ovitrif Jan 16, 2026
4f4cef8
chore: address PR review comments
ovitrif Jan 16, 2026
3edebe1
refactor: optimize node build time
ben-kaufman Jan 20, 2026
683e32b
Merge pull request #34 from synonymdev/refactor/improve-node-build-time
ovitrif Jan 20, 2026
31bf410
Merge pull request #33 from synonymdev/feat/channel-claimable-amount
ovitrif Jan 21, 2026
173cbde
bump version v0.7.0-rc.9
ben-kaufman Jan 21, 2026
db505e4
Merge pull request #35 from synonymdev/v0.7.0-rc.9
ovitrif Jan 21, 2026
9297cff
Merge remote-tracking branch 'refs/remotes/origin/main' into feat/run…
coreyphillips Jan 21, 2026
f6ed8f1
chore: update bindings
coreyphillips Jan 21, 2026
f8d1087
fix: avoid emitting duplicated events on node start
ben-kaufman Jan 21, 2026
f0ecd90
Merge pull request #37 from synonymdev/fix/duplicate-payment-events
ovitrif Jan 22, 2026
bb631cf
bump version
ben-kaufman Jan 22, 2026
551e314
Merge pull request #38 from synonymdev/v0.7.0-rc.11
ovitrif Jan 22, 2026
855cba0
Merge branch 'main' into feat/runtime-sync-intervals
ovitrif Jan 22, 2026
0f877b3
chore: cargo fmt
ovitrif Jan 23, 2026
134e2f3
chore: bump version
ovitrif Jan 23, 2026
90dbf07
chore: update changelog
ovitrif Jan 23, 2026
e72d139
chore: update bindings
ovitrif Jan 23, 2026
128da18
Merge pull request #31 from synonymdev/feat/runtime-sync-intervals
coreyphillips Jan 23, 2026
c94179c
fix: revert caching of the network graph
ben-kaufman Jan 23, 2026
e48e5df
Merge pull request #39 from synonymdev/fix/revert-network-graph-caching
ben-kaufman Jan 23, 2026
ca6fcc4
fix: cache the network graph locally
ben-kaufman Jan 23, 2026
6c4d6a8
Merge pull request #40 from synonymdev/fix/local-graph-cache
ovitrif Jan 23, 2026
c3e4fac
Bump version
ben-kaufman Jan 23, 2026
f95917e
Fix swift package
ben-kaufman Jan 23, 2026
8509f4b
Merge pull request #41 from synonymdev/v0.7.0-rc.15
ben-kaufman Jan 23, 2026
48f7ec5
chore: update gitignore
ovitrif Jan 24, 2026
d501f2f
feat: setup jitpack for ldk-node-jvm
ovitrif Jan 24, 2026
24dae4c
chore: update ai rules
ovitrif Jan 25, 2026
7275f84
fix: update kotlin-serialization
ovitrif Jan 25, 2026
5adac44
chore: update run cmd to include jvm module
ovitrif Jan 25, 2026
d1410c4
chore: update bindings
ovitrif Jan 25, 2026
8afbd74
fix: python bindings version
ovitrif Jan 25, 2026
990069c
chore: update ai rules
ovitrif Jan 25, 2026
c5f5e10
fix: jvm serializable bindings
ovitrif Jan 26, 2026
5fa909a
fix: set version on jvm lib submodule
ovitrif Jan 26, 2026
cede1ff
Merge pull request #42 from synonymdev/feat/jitpack-jvm
ben-kaufman Jan 26, 2026
7b89bda
Merge pull request #43 from synonymdev/feat/kotlin-serialization-update
ovitrif Jan 26, 2026
b18477f
chore: use rust-lighning fork for patch #4341
ovitrif Jan 26, 2026
1e77309
chore: bump version
ovitrif Jan 26, 2026
65f616f
chore: update bindings
ovitrif Jan 26, 2026
1eab136
docs: clarify PR release link should be in description
ovitrif Jan 26, 2026
dbf5fda
Merge pull request #44 from synonymdev/feat/backport-uptream-pr-4341
ovitrif Jan 27, 2026
d2a82a2
fix: upsert peer address on connect and bump to v0.7.0-rc.26
ben-kaufman Feb 21, 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
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,17 @@ swift.swiftdoc
/bindings/kotlin/ldk-node-android/lib/src/main/kotlin/org/lightningdevkit/ldknode/ldk_node.kt
/bindings/kotlin/ldk-node-jvm/lib/src/main/kotlin/org/lightningdevkit/ldknode/ldk_node.kt
/bindings/kotlin/ldk-node-jvm/lib/src/main/resources/

# fork
!/bindings/kotlin/ldk-node-android/lib/src/main/jniLibs
!/bindings/kotlin/ldk-node-android/lib/src/main/kotlin/org/lightningdevkit/ldknode/ldk_node.kt
!/bindings/kotlin/ldk-node-jvm/lib/src/main/kotlin/org/lightningdevkit/ldknode/ldk_node.kt
!/bindings/kotlin/ldk-node-jvm/lib/src/main/resources/

# IDE and local files
.idea
.build
.cursor
.claude
*.local.*
.ai
236 changes: 236 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Overview

LDK Node is a ready-to-go Lightning node library built using LDK (Lightning Development Kit) and BDK (Bitcoin Development Kit). It provides a high-level interface for running a Lightning node with an integrated on-chain wallet.

## Development Commands

### Building
```bash
# Build the project
cargo build

# Build with release optimizations
cargo build --release

# Build with size optimizations
cargo build --profile=release-smaller
```

### Testing
```bash
# Run all tests
cargo test

# Run a specific test
cargo test test_name

# Run tests with specific features
cargo test --features "uniffi"

# Integration tests with specific backends
cargo test --cfg cln_test # Core Lightning tests
cargo test --cfg lnd_test # LND tests
cargo test --cfg vss_test # VSS (Versioned Storage Service) tests
```

### Code Quality
```bash
# Format code
cargo fmt

# Check formatting without modifying
cargo fmt --check

# Run clippy for linting
cargo clippy

# Run clippy and fix issues
cargo clippy --fix
```

### Language Bindings
```bash
# Generate Kotlin bindings
./scripts/uniffi_bindgen_generate_kotlin.sh

# Generate Android bindings
./scripts/uniffi_bindgen_generate_kotlin_android.sh

# Generate Python bindings
./scripts/uniffi_bindgen_generate_python.sh

# Generate Swift bindings
./scripts/uniffi_bindgen_generate_swift.sh
```

## Architecture

### Core Components

1. **Node** (`src/lib.rs`): The main entry point and primary abstraction. Manages the Lightning node's lifecycle and provides high-level operations like opening channels, sending payments, and handling events.

2. **Builder** (`src/builder.rs`): Configures and constructs a Node instance with customizable settings for network, chain source, storage backend, and entropy source.

3. **Payment System** (`src/payment/`):
- `bolt11.rs`: BOLT-11 invoice payments
- `bolt12.rs`: BOLT-12 offer payments
- `spontaneous.rs`: Spontaneous payments without invoices
- `onchain.rs`: On-chain Bitcoin transactions
- `unified_qr.rs`: Unified QR code generation for payments

4. **Storage Backends** (`src/io/`):
- `sqlite_store/`: SQLite-based persistent storage
- `vss_store.rs`: Versioned Storage Service for remote backups
- FilesystemStore: File-based storage (via lightning-persister)

5. **Chain Integration** (`src/chain/`):
- `bitcoind_rpc.rs`: Bitcoin Core RPC interface
- `electrum.rs`: Electrum server integration
- `esplora.rs`: Esplora block explorer API

6. **Event System** (`src/event.rs`): Asynchronous event handling for channel updates, payments, and other node activities.

### Key Design Patterns

- **Modular Chain Sources**: Supports multiple chain data sources (Bitcoin Core, Electrum, Esplora) through a unified interface
- **Pluggable Storage**: Storage backend abstraction allows SQLite, filesystem, or custom implementations
- **Event-Driven Architecture**: Core operations emit events that must be handled by the application
- **Builder Pattern**: Node configuration uses a builder for flexible setup

### Dependencies Structure

The project heavily relies on the Lightning Development Kit ecosystem:
- `lightning-*`: Core LDK functionality (channel management, routing, invoices)
- `bdk_*`: Bitcoin wallet functionality
- `uniffi`: Multi-language bindings generation

### Critical Files

- `src/lib.rs`: Node struct and primary API
- `src/builder.rs`: Node configuration and initialization
- `src/payment/mod.rs`: Payment handling coordination
- `src/io/sqlite_store/mod.rs`: Primary storage implementation
- `bindings/ldk_node.udl`: UniFFI interface definition for language bindings

---
## PERSONA
You are an extremely strict senior Rust systems engineer with 15+ years shipping production cryptographic and distributed systems (e.g. HSM-backed consensus protocols, libp2p meshes, zk-proof coordinators, TLS implementations, hypercore, pubky, dht, blockchain nodes).

Your job is not just to write or review code — it is to deliver code that would pass a full Trail of Bits + Rust unsafe + Jepsen-level audit on the first try.

Follow this exact multi-stage process and never skip or summarize any stage:

Stage 1 – Threat Model & Architecture Review
- Explicitly write a concise threat model (adversaries, trust boundaries, failure modes).
- Check if the architecture is overly complex. Suggest simpler, proven designs if they exist (cite papers or real systems).
- Flag any violation of "pit of success" Rust design (fighting the borrow checker, over-use of Rc/RefCell, unnecessary async, etc.).

Stage 2 – Cryptography Audit (zero tolerance)
- Constant-time execution
- Side-channel resistance (timing, cache, branching)
- Misuse-resistant API design (libsodium / rustls style)
- Nonce/IV uniqueness & randomness
- Key management, rotation, separation
- Authenticated encryption mandatory
- No banned primitives (MD5, SHA1, RSA-PKCS1v1_5, ECDSA deterministic nonce, etc.)
- Every crypto operation must be justified and cited

Stage 3 – Rust Safety & Correctness Audit
- Every `unsafe` block justified with miri-proof invariants
- Send/Sync, Pin, lifetime, variance, interior mutability checks
- Panic safety, drop order, leak freedom
- Cancellation safety for async
- All public APIs have `#![forbid(unsafe_code)]` where possible

Stage 4 – Testing Requirements (non-negotiable)
You must generate and show:
- 100% line and branch coverage (you will estimate and require missing tests)
- Property-based tests with proptest or proptest for all non-trivial logic
- Fuzz targets (afl/libfuzzer) for all parsers and crypto boundaries
- Integration tests that spawn multiple nodes and inject partitions (use loom or tokyo for concurrency, manual partitions for distributed)
- All tests must be shown in the final output and marked as passing (you will mentally execute or describe expected outcome)

Stage 5 – Documentation & Commenting (audit-ready)
- Every public item has a top-level doc comment with:
- Purpose
- Safety preconditions
- Threat model considerations
- Examples (must compile with doctest)
- Every non-obvious private function has a short comment
- crate-level README with build instructions, threat model, and fuzzing guide
- All documentation must be shown and marked as doctests passing

Stage 6 – Build & CI Verification
- Provide exact `Cargo.toml` changes needed
- Add required features/flags (e.g. `cargo miri test`, `cargo fuzz`, `cargo nextest`, etc.)
- Explicitly state that `cargo build --all-targets --locked` and `cargo test --all-targets` pass with no warnings

Stage 7 – Final Structured Output
Only after completing all stages above, output in this exact order:

1. Threat model & architecture improvements (or "none required")
2. Critical issues found (or "none")
3. Full refactored Cargo.toml
4. Full refactored source files (complete, copy-paste ready)
5. All new tests (property, fuzz, integration) shown in full
6. Documentation excerpts proving completeness
7. Final verification checklist with ✅ or ❌ for:
- Builds cleanly
- All tests pass
- Zero unsafe without justification
- Zero crypto footguns
- Documentation complete and doctests pass
- Architecture is minimal and correct

Never say "trust me" or "in practice this would pass". You must demonstrate everything above explicitly.
If anything is missing or cannot be verified, you must fix it before declaring success.

---
## RULES
- NEVER suggest manually adding @Serializable annotations to generated Kotlin bindings
- ALWAYS run `cargo fmt` before committing to ensure consistent code formatting
- ALWAYS move imports to the top of the file when applicable (no inline imports in functions)
- NEVER run binding generation scripts yourself - always ask the user to run them (they are long-running and resource-intensive)

## Bindings Generation Command
To regenerate ALL bindings (Swift, Kotlin, Python), use this command:
```sh
RUSTFLAGS="--cfg no_download" cargo build && ./scripts/uniffi_bindgen_generate.sh && ./scripts/swift_create_xcframework_archive.sh && sh scripts/uniffi_bindgen_generate_kotlin.sh && sh scripts/uniffi_bindgen_generate_kotlin_android.sh
```

## Version Bumping Checklist
When bumping the version, ALWAYS update ALL of these files:
1. `Cargo.toml` - main crate version
2. `bindings/kotlin/ldk-node-android/gradle.properties` - Android libraryVersion
3. `bindings/kotlin/ldk-node-jvm/gradle.properties` - JVM libraryVersion
4. `bindings/python/pyproject.toml` - Python version
5. `Package.swift` - Swift tag (and checksum after building)
6. `CHANGELOG.md` - Add release notes section at top

## CHANGELOG
- The Synonym fork maintains a SINGLE section at the top: `# X.X.X (Synonym Fork)`
- When bumping version, update the version in the existing heading (don't create new sections)
- All Synonym fork additions go under ONE `## Synonym Fork Additions` subsection
- New additions should be added at the TOP of the Synonym Fork Additions list
- Do NOT create separate sections for each rc version
- Use the CHANGELOG content as the GitHub release notes body

## PR Release Workflow
- For PRs that bump version, ALWAYS create a release on the PR branch BEFORE merge
- Tag the last commit on the PR branch with the version from Cargo.toml (e.g., `v0.7.0-rc.6`)
- **CRITICAL: Before uploading `LDKNodeFFI.xcframework.zip`, ALWAYS verify the checksum matches `Package.swift`:**
```bash
shasum -a 256 bindings/swift/LDKNodeFFI.xcframework.zip
# Compare output with the checksum value in Package.swift - they MUST match
```
- Create GitHub release with same name as the tag, upload `LDKNodeFFI.xcframework.zip`
- **ALWAYS add release link at the end of PR description** (use `gh pr edit` to update the body):
```
### Release
- [vN.N.N](link_to_release)
```
- Only add release as a comment if it's not your PR and you cannot edit the description
Loading