Replies: 9 comments 26 replies
-
While it would substantially complexify the bindings, I do wonder if we can return futures for a few of these methods. open_channel generally ~always succeeds, and then fails later when the peer responds saying "no, i want a bigger balance" or whatever. Same goes for sending payments - we kick it off but it can take some time to complete (or fail). Sadly a simple future class that supports anything other than only polling may be too complicated for uniffi, but it does have some basic trait support so maybe its doable?
Dont we need a channel_id here?
payment history. In "full LDK" we don't track this and expect users to, but I imagine "simplifed API" users where we're handling the on-chain wallet as well really ideally just want us to keep history and everything for them. It wouldn't be too hard to include sqlite and just keep payment history in it, no? |
Beta Was this translation helpful? Give feedback.
-
Hi there. I think a simplified API is a really interesting idea. As a dev fairly new to lightning, I did struggle with getting my node working (currently building in Kotlin). I did get awesome help in the Discord server however, so that's been really helpful. When I think of the lightning-related "tasks" I want to perform as a developer of some simple app or bot or whatever, here is what I have in mind:
Looking at your mock code above this seems to fit the bill fairly well. The only things I'm curious about are (a) is the on-chain wallet handled completely internally in this ldk-simple-api, and (b) it appears I won't be able to connect to peers without opening channels with them; that probably makes things simpler, but is there a downside to that? (just wondering). |
Beta Was this translation helpful? Give feedback.
-
Nit, Proposed name: LdkLite 🍺 , it implies there is more extensible lib available not just a more complex one :) Api'sDo we support batch operations ?
Query Api'sDo payment_info() and channel_info() need any identifiers to query upon ? Safe out of the boxI think one of the goals apart from making it very easy to use, should be to make it safe and secure to use.
ConfigurableWhile we provide default modules, will they still be injectable ? Supported Platforms and Language BindingsNot applicable to desktop, iOS, and android, but does it make sense to support server-mode along with bindings support? |
Beta Was this translation helpful? Give feedback.
-
Will this force close the channel if it cannot be closed cooperatively? Relatedly, once we have anchors support, channel closing will require onchain funds to be present. The commitment/HTLC fee bumping should all be abstracted away from the user of course, but the requirement still holds. |
Beta Was this translation helpful? Give feedback.
-
Will there be a safe shutdown procedure? Presumably, RAII would handle it?
I'd imagine a user may want to know their own
Is there any configuration parameters we may want to expose? Or will v1 use a default
May have touched on this offline, but how will inbound
When would a user need to call this if
Do these take parameters in order to return a single instance of a payment/channel or do they return a
Just thought, we could make this a bit more object-oriented. For instance, have: pub channels(&self) -> Vec<Channel>; where Otherwise, it seems like having |
Beta Was this translation helpful? Give feedback.
-
As I said on Discord, something like this would be very useful for the project I'm working on. The idea is to deploy LDK in Android and iOS using native dev, and I would love to avoid having 2 separate code bases for the LDK and BDK integration logic. I have some specific needs regarding pathfinding and persistence, so allowing customisation from the get-go would be awesome if possible :) |
Beta Was this translation helpful? Give feedback.
-
Even if we get Ruby "for free" I do not think we should claim support for it, as I've never heard of a single developer demanding it. Whereas Flutter/Dart should absolutely be part of the plan (as opposed to "potentially") given the known demand for it. |
Beta Was this translation helpful? Give feedback.
-
Just noting that depending on a single Electrum server is a bigger security deal with Lightning than it is with Bitcoin wallets. |
Beta Was this translation helpful? Give feedback.
-
Pretty sure I've commented on this elsewhere, but I don't see a comment in this discussion. I feel strongly there needs to be a version of this Lite API which uses the forthcoming LSP spec and completely hides all channel management details from the user of this API. An app should be able to use the API to send and receive bitcoin and have no idea about under the hood the opening and closing of channels and rebalancing of channels. It just magically happens for the app. Do we agree? If so, are we imagining once the LSP API is available, we'll write the code that glues this API to that API, obviating the need for a user to call open or close channel? And in the dev docs really being clear that open/close channel are "power user portions of the simplified API"? |
Beta Was this translation helpful? Give feedback.
-
The Lightning Dev Kit is a collection of modules implementing the Lightning protocol that can be used in many different ways. While this allows for a very flexible adoption depending on the user's needs, the number of steps currently required to make use of LDK is pretty high. Hooking up LDK's modules in the right way requires the user not only to have a good understanding of Lightning Network fundamentals, but also to read up and get familiar with LDK quite a bit. Even though we try to provide great resources for that (documentation, tutorials, etc.) and to reduce the potential for error as far as possible, getting everything right is still non-trivial, in particular for a first-time user.
Towards a Simpler API for LDK
In order to make LDK adoption easier and less error prone for users—and in particular for first-time users—we plan to create a new project that wraps LDK's API and provides a reduced and simplified API to get the user started with LDK.
To this end, the
ldk-simple-api
(name subject to change) project will include a number of opinionated module choices that should allow the user to get started with in very few steps. However, we envision to make these modules somewhat configurable and also aim to provide a smooth transition path for users that eventually outgrow the limited feature set of the simplified API and that therefore want to migrate to the full LDK experience.As the simplified API neither wants to become the new main API for LDK, nor aims to be a full Lightning node implementation, we're still discussing what sane default functionalities and modules should be included to get the user started and what should be considered out-of-scope for this project.
Currently, we plan to include the following default modules in the initial version:
estimate fees, etc. via an Electrum server (e.g. Blockstream)
Supported Platforms and Language Bindings
We aim to initially provide support for Desktop, iOS, and Android build targets, and to enable running in browsers eventually. Furthermore, we plan to provide bindings for a broad range of languages. To this end, we'll explore using Mozilla's UniFFI which should help us support Kotlin, Swift, Python and Ruby to get us started. From there, we will see how we can create support for JavaScript, ReactNative, and potentially also Flutter/Dart.
Initial API Design
The API we envision aims to be as simple and as minimal as possible for two main reasons:
methods allows us to potentially write and update some of the bindings by hand.
To this end, the initial API design will likely look something like the following mock-up:
Request for Comments
As all this is not only work in progress, but it's main purpose is to make users' lives easier, we'd love to get feedback from the LDK community. In particular, but in no particular order:
I'm really looking forward to your feedback and comments. After a first round of general feedback I'll advance this process and will open a corresponding repository with a PR in which we can focus on the specifics and technical details of the initial API.
Beta Was this translation helpful? Give feedback.
All reactions