[BREAKGLASS] Lightweight lightning node for React Native
Go to file
2024-03-23 18:17:16 +00:00
.bundle Update example app to use RN 67 2022-02-14 14:46:05 -05:00
.circleci chore: initial commit 2021-02-28 12:20:53 +00:00
android Update gradle.properties 2023-02-24 11:45:30 +00:00
example update RN for Android build 2022-11-07 19:46:01 +00:00
ios Remove trailing whitespace (as per .editorconfig) and improve error logging slightly 2022-10-04 19:22:56 +00:00
scripts chore: initial commit 2021-02-28 12:20:53 +00:00
src Add refactored Util class for improved readability 2024-03-23 18:17:16 +00:00
.editorconfig chore: initial commit 2021-02-28 12:20:53 +00:00
.gitattributes chore: initial commit 2021-02-28 12:20:53 +00:00
.gitignore chore: initial commit 2021-02-28 12:20:53 +00:00
.ruby-version Update example app to use RN 67 2022-02-14 14:46:05 -05:00
.yarnrc chore: initial commit 2021-02-28 12:20:53 +00:00
babel.config.js chore: initial commit 2021-02-28 12:20:53 +00:00
Gemfile Update example app to use RN 67 2022-02-14 14:46:05 -05:00
LICENSE chore: initial commit 2021-02-28 12:20:53 +00:00
package.json update RN for Android build 2022-11-07 19:46:01 +00:00
README.md fix typo 2022-11-21 12:32:54 +00:00
rn-ldk.podspec Remove LDKFramework as vendored_framework 2022-08-23 18:08:46 +01:00
tsconfig.build.json chore: initial commit 2021-02-28 12:20:53 +00:00
tsconfig.json chore: initial commit 2021-02-28 12:20:53 +00:00

rn-ldk

Lightweight lightning node for React Native

Introducing brand-new Lightning implementation running on mobile, both iOS and Android!

Powered by Lightning Dev Kit, a flexible lightning implementation written in Rust.

Some of the features include:

  • Fund your channels straight from your hardware wallet, or wallets (in case of multisig)
  • Encrypted channel backups are stored in cloud. Mnemonic backup phrase is all you need to restore your lightning wallet and all channels on another device and start using it in seconds! Use same channels on several devices, if you wish
  • Synced to blockchain via Electrum, sync takes seconds, even on low-bandwidth connections
  • Routing is provided via API, no graph sync (optional)
  • Create a channel with any node on the Lightning network, no limitations (to keep the network decentralized)

Technicalities

Binaries come from:

A thin wrapper layer is implemented in Kotlin & Swift to provide convenient better-abstracted methods to Javascript. Javascript part itself has zero dependencies, as a drawback some functions have to be provided externally (optional, as rn-ldk is shipped with API-based fallback)

Data is stored on the side of RN, for this purpose we provide AsyncStorage to RnLdk, but anything conforming to AsyncStorage interface will work.

Mainnet only.

Example React Native project is bundled with this repo (as a playground for testing).

Installation

npm install "https://github.com/BlueWallet/rn-ldk" --save

Usage

import RnLdk from "rn-ldk";
import AsyncStorage from '@react-native-async-storage/async-storage';

// start the node!
const entropy = 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'; // change that
RnLdk.setStorage(AsyncStorage);
RnLdk.setRefundAddressScript('76a91419129d53e6319baf19dba059bead166df90ab8f588ac'); // 13HaCAB4jf7FYSZexJxoczyDDnutzZigjS
await RnLdk.start(entropy).then(console.warn);

// lets create a channel

// connect to a peer first:
RnLdk.connectPeer('02e89ca9e8da72b33d896bae51d20e7e6675aa971f7557500b6591b15429e717f1', '165.227.95.104', 9735).then(console.warn); // lnd1.bluewallet.io
// initiate channel opening:
const address = await RnLdk.openChannelStep1('02e89ca9e8da72b33d896bae51d20e7e6675aa971f7557500b6591b15429e717f1', 100000);
// create a PSBT funding this address
// ...
// provide txhex to finalizing method:
RnLdk.openChannelStep2(text).then(console.warn);

// if all goes well, txhex is broadcasted and after tx gets enough confirmations channel will be usable!

// make sure your peer is connected:
RnLdk.listPeers().then(console.warn);
// observe your channel:
RnLdk.listUsableChannels().then(console.warn);

// pay some invoice:
const resultPayment = await RnLdk.sendPayment(text);

// you're awesome!

License

MIT