Project

lighstorm

0.0
No release in over a year
Lighstorm is an opinionated abstraction layer on top of the lnd-client for interacting with a Lightning Node.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 2.8, >= 2.8.1
~> 0.0.9
~> 0.12.0
 Project Readme

Lighstorm Gem Version RSpec Tests Status

⚠️ Warning: Early-stage, breaking changes are expected.

API for interacting with a Lightning Node.

Lighstorm text written stylized with an illustration of a Graph connecting two Nodes.

Lighstorm::Lightning::Channel.mine.first.myself.node.alias

Index

About

Lighstorm is an opinionated abstraction layer on top of the lnd-client.

It brings an object-oriented approach for interacting with a Lightning Node, influenced by the Active Record Pattern and Active Record Models conventions.

However, despite the fluidity of Object Orientation being desired in its public interface, internally, most of its code is structured following the Hexagonal Architecture and Functional Programming principles.

It aims to be intuitive to use while being highly reliable, as it deals with people's money, and easily testable since its tests are the foundation for its reliability.

Although it tries to stay close to Lightning's terminologies, it brings its own vocabulary and data modeling, optimizing for programmer happiness.

Usage

Add to your Gemfile:

gem 'lighstorm', '~> 0.0.16'
require 'lighstorm'

# lndconnect
Lighstorm.connect!(
  'lndconnect://127.0.0.1:10009?cert=MIICJz...JBEERQ&macaroon=AgEDbG...45ukJ4'
)

# File Path
Lighstorm.connect!(
  address: '127.0.0.1:10009',
  certificate_path: '/lnd/tls.cert',
  macaroon_path: '/lnd/data/chain/bitcoin/mainnet/admin.macaroon'
)

puts Lighstorm.version # => 0.0.16

Lighstorm::Lightning::Node.myself.alias # => icebaker/old-stone

Lighstorm::Lightning::Invoice.create(
  description: 'Coffee',
  amount: { millisatoshis: 1_000 },
  payable: 'once'
)

Lighstorm::Lightning::Invoice.decode('lnbc20m1pv...qqdhhwkj').pay

Lighstorm::Lightning::Invoice.decode('lnbc20m1pv...qqdhhwkj').pay(
  fee: { maximum: { millisatoshis: 1000 } }
)

Lighstorm::Satoshis.new(
  millisatoshis: 75_621_650
).satoshis # => 75_621

Check the full documentation.

Tutorials and Articles

Development

Check the development documentation.