Skip to content

Lightning Development Kit Node library for Flutter

License

MIT, Apache-2.0 licenses found

Licenses found

MIT
LICENSE
Apache-2.0
LICENSE-APACHE
Notifications You must be signed in to change notification settings

LtbLightning/ldk-node-flutter

Repository files navigation

LDK_Node

LDK Node is released under the MIT license. Docs Current pub package version. Issues Stars Forks Demo App

A Flutter library for LDK Node, a ready-to-go Lightning node library built using LDK and BDK.

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.:

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.

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

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:

dependencies:
  ldk_node: ^0.3.0

or add from pub.dev using pub add command

  flutter pub add ldk_node

Examples

Build, Start & Sync the local node

import 'package:ldk_node/ldk_node.dart';

// ....

// Path to a directory where the application may place data that is user-generated
final path = "${directory.path}/alice's_node";

// Your preferred `Esplora` url
final esploraUrl = "https://mempool.space/testnet/api";

// configuration options for the node
final config   = Config(
                        probingLiquidityLimitMultiplier: 3,
                        trustedPeers0Conf: [],
                        storageDirPath: path,
                        network: Network.Testnet,
                        listeningAddresses: [
                         SocketAddress.hostname(addr: "0.0.0.0", port: 3003)
                        ],
                        onchainWalletSyncIntervalSecs: 60,
                        walletSyncIntervalSecs: 20,
                        feeRateCacheUpdateIntervalSecs: 600,
                        logLevel: ldk.LogLevel.Debug,
                        defaultCltvExpiryDelta: 144
                     );
Builder builder = Builder.fromConfig(config);
    final node  = await builder
                                .setEntropyBip39Mnemonic( 
                                     mnemonic: ldk.Mnemonic(
                                                   'certain sense kiss guide crumble hint transfer crime much stereo warm coral'))
                                .setEsploraServer(esploraUrl)
                                .build();

// Starting the node
await node.start();

// Syncing the node
await node.syncWallets();

References:

About

Lightning Development Kit Node library for Flutter

Resources

License

MIT, Apache-2.0 licenses found

Licenses found

MIT
LICENSE
Apache-2.0
LICENSE-APACHE

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •