Coder Social home page Coder Social logo

telelvis / ldk-node Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lightningdevkit/ldk-node

0.0 0.0 0.0 199 KB

A ready-to-go node implementation built using LDK.

License: Other

Shell 3.51% Objective-C 0.23% Rust 88.21% Kotlin 7.28% Swift 0.77%

ldk-node's Introduction

LDK Node

A ready-to-go Lightning node library built using LDK and BDK.

LDK Node is a non-custodial Lightning node in library form. 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.

Getting Started

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, connect_open_channel, send_payment, etc.:

use ldk_node::Builder;
use ldk_node::lightning_invoice::Invoice;
use ldk_node::bitcoin::secp256k1::PublicKey;
use std::str::FromStr;

fn main() {
	let node = Builder::new()
		.set_network("testnet")
		.set_esplora_server_url("https://blockstream.info/testnet/api".to_string())
		.build();

	node.start().unwrap();

	let _funding_address = node.new_funding_address();

	// .. fund address ..

	node.sync_wallets().unwrap();

	let node_id = PublicKey::from_str("NODE_ID").unwrap();
	let node_addr = "IP_ADDR:PORT".parse().unwrap();
	node.connect_open_channel(node_id, node_addr, 10000, None, false).unwrap();

	let invoice = Invoice::from_str("INVOICE_STR").unwrap();
	node.send_payment(&invoice).unwrap();

	node.stop().unwrap();
}

Modularity

LDK Node currently comes with a decidedly opionated set of design choices:

  • On-chain data is handled by the integrated BDK wallet
  • Chain data is accessed via Esplora (support for Electrum and bitcoind RPC will follow)
  • Wallet and channel state is persisted to file system (support for SQLite will follow)
  • Gossip data is sourced via Lightnings peer-to-peer network (support for Rapid Gossip Sync will follow)
  • Entropy for the Lightning and on-chain wallets may be generated and persisted for or provided by the user (as raw bytes or BIP39 mnemonic)

Language Support

LDK Node is written in Rust and may therefore be natively included in any std Rust program. Beyond its Rust API it also offers language bindings for Swift, Kotlin, and Python based on UniFFI.

ldk-node's People

Contributors

tnull avatar jurvis avatar notmandatory avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.