Home

Awesome

<a href="https://nbd.wtf"><img align="right" height="196" src="https://user-images.githubusercontent.com/1653275/194609043-0add674b-dd40-41ed-986c-ab4a2e053092.png" /></a>

IMMORTAN

Immortan is a minimal, privacy-focused, opinionated LN protocol implementation aimed to specifically power lite LN nodes which are mostly to be found on mobile phones or desktop computers and only run private channels.

Immortan is not based on Éclair and is not an Éclair fork. It's a standalone implementation, much smaller, written from scratch with standalone and independent logic. However it does use codecs and type definitions carefully copied and pasted from the Éclair codebase.

Raison d'etre

Existing implementations are of general purpose, that is, they neither address specific complications of running LN nodes on constrained devices nor explore various advantages unique to these setups. Here are some highlights:

Usage

Installation

Install it by adding to your build.sbt:

libraryDependencies += "com.fiatjaf" %% "immortan" % "0.7.8"

Very dense and confusing guide

Then you must

  1. Import the LNParams object which will be the main interface between your code and Immortan.
  2. Implement some database traits (or copy the implementation from SBW as it was done in Cliché by Ilya -- see also Cliché's DB.scala for the final touch).
  3. Instantiate a PathFinder, which will take care of syncing Lightning gossip data and later sending out payments.
  4. Fill in .connectionProvider, .logBag, .chainHash, .ourInit, .syncParams, .secret, .feeRates, .fiatRates, .cm and .chainWallets;
  5. Instantiate ElectrumClientPool, ElectrumChainSync, ElectrumWatcher and WalletEventsCatcher;

See Cliché's Main.scala for a mostly clean implementation of all of the above.

After that you should be able to easily

  1. Load onchain wallets, listen for transactions and make transactions.
  2. Open normal channels;
  3. Open hosted channels;
  4. Listen for outgoing Lightning payments status changes;
  5. Listen for incoming Lightning payments status changes;
  6. Create Lightning invoices;
  7. Send Lightning payments.

Again, Cliché's Commands.scala has some implementations you might be able to understand and copy (the listeners are in Main.scala).

API Documentation (Scaladoc)

Or maybe start here at LNParams.

Library users