All Projects → bitromortac → lnregtest

bitromortac / lnregtest

Licence: other
Regtest Lightning Networks for (python) integration testing

Programming Languages

python
139335 projects - #7 most used programming language
Dockerfile
14818 projects
shell
77523 projects

Projects that are alternatives of or similar to lnregtest

shango-lightning-wallet
Shango Lightning Wallet
Stars: ✭ 65 (+282.35%)
Mutual labels:  lightning, lightning-network, lnd
umbrel-middleware
RESTful Bitcoin and Lightning API for Umbrel
Stars: ✭ 21 (+23.53%)
Mutual labels:  lightning, lightning-network, lnd
lightningtip
Get tips via the Lightning Network
Stars: ✭ 91 (+435.29%)
Mutual labels:  lightning, lightning-network, lnd
lightning-jet
Lightning Jet is a fully automated rebalancer for Lightning nodes. Jet optimizes channel liquidity allocation based on routing volume, missed routing opportunities (htlcs), and other variables.
Stars: ✭ 33 (+94.12%)
Mutual labels:  lightning, lightning-network, lnd
lightningj
Core implementation of the lightningj API implementations.
Stars: ✭ 41 (+141.18%)
Mutual labels:  lightning, lightning-network, lnd
Ln Service
Node.js interface to LND
Stars: ✭ 191 (+1023.53%)
Mutual labels:  lightning, lightning-network
Lndhub
Wrapper for Lightning Network Daemon. It provides separate accounts and trust minimization for end users
Stars: ✭ 203 (+1094.12%)
Mutual labels:  lightning, lightning-network
Spark Wallet
⚡️ A minimalistic wallet GUI for c-lightning, accessible over the web or through mobile and desktop apps.
Stars: ✭ 215 (+1164.71%)
Mutual labels:  lightning, lightning-network
lightninggem
⚡💎 A game of speculation using bitcoin and the lightning network
Stars: ✭ 13 (-23.53%)
Mutual labels:  lightning, lnd
Webln
Spec and client library for WebLN apps and providers
Stars: ✭ 165 (+870.59%)
Mutual labels:  lightning, lightning-network
Eclair Mobile
An Android wallet for the Lightning Network
Stars: ✭ 231 (+1258.82%)
Mutual labels:  lightning, lightning-network
zapread.com
Website for zapread.com
Stars: ✭ 19 (+11.76%)
Mutual labels:  lightning, lightning-network
perfectly-balanced
Script to make your LND node pefectly balanced as all things should be
Stars: ✭ 26 (+52.94%)
Mutual labels:  lightning-network, lnd
Lncli Web
Light-weight web client for the lnd daemon written in NodeJS / Angular.
Stars: ✭ 181 (+964.71%)
Mutual labels:  lightning, lightning-network
Zeus
A mobile Bitcoin/Lightning app for lnd, c-lightning, and Eclair node operators ⚡️
Stars: ✭ 175 (+929.41%)
Mutual labels:  lightning, lightning-network
balanceofsatoshis
Tool for working with the balance of your satoshis on LND
Stars: ✭ 447 (+2529.41%)
Mutual labels:  lightning-network, lnd
lightning-qt
bitcoin-qt for lightningd
Stars: ✭ 36 (+111.76%)
Mutual labels:  lightning, lightning-network
Umbrel Os
Run Umbrel Bitcoin and Lightning node on a Raspberry Pi in one click
Stars: ✭ 132 (+676.47%)
Mutual labels:  lightning, lightning-network
Paper
Lightning Network Paper
Stars: ✭ 136 (+700%)
Mutual labels:  lightning, lightning-network
lntop
⚡ LN terminal dashboard 📊
Stars: ✭ 170 (+900%)
Mutual labels:  lightning, lightning-network

lnregtest - Lightning Networks on Bitcoin regtest

Implements functioning lightning networks for (Python) integration testing operating on a Bitcoin regtest network by running several lightning node instances.

The simulated lightning networks can have different shapes as defined in the network_definitions folder.

An example of a graph (star_ring) with 7 nodes and 12 channels is shown here (for initial channel balance details, have a look at network_definitions/star_ring.py):

Star-like component with channels (where A is the master node):
A -> B, A -> C, A -> D, A -> E, A -> F, A -> G,
Ring-like component with channels (which surrounds the master node):
B -> C, C -> D, D -> E, E -> F, F -> G, G -> B

This star and ring-like lightning network can then be used to test interactions with the network from the master node's perspective, like rebalancing channels, routing payments, sending payments and so on.

Features

  • No external python dependencies
  • Arbitrary lightning network graphs with up to number of nodes on the order of 10 (depends on your resources)
  • LND support
  • Electrum support
  • Lightning graph state comparison
  • Restarting from already created networks
  • Abstraction of random identifiers (public keys, channel ids) to human readable identifiers
  • Library and command-line execution
  • Automatic sanity check of user defined networks

Planned features

  • Arbitrary lightning daemon binary detection (lnd, clightning, ...)
  • Time-dependent transaction series

Creating your own network topology

Networks of arbitrary shape can be defined as a python dictionary in the network_definitions folder. See the examples for a general structure.

The requirements are:

  • Node A is the master node
  • Nodes are uniquely named by subsequent characters A, B, C, ...
  • Channels are uniquely numbered by integers 1, 2, 3, ...
  • Ports must be set uniquely

Testing other (python) projects

Test examples can be found in the test folder and more information on how lnregtest is used for lightning network integration testing can be found in TEST.

This package is also used in production in lndmanage.

Setup

The binaries bitcoind (v22.0), bitcoin-cli, lnd (v0.14), and lncli are expected to be found in $PATH, e.g., put these binaries into your ~/bin folder.

You can use the tool in two different standalone modes:

Git repository mode:

$ git clone https://github.com/bitromortac/lnregtest
$ cd lnregtest

Run network:

$ python3 lnregtest.py -h

Package mode:

$ python3 -m venv venv
$ source venv/bin/activate
$ python3 -m pip install lnregtest

Run network:

$ lnregtest -h

Test if lnregest works

To run all tests, run python3 -m unittest discover test from the root folder.

Running under Docker

$ docker build -t lnregtest:local .
$ docker run --rm -it lnregtest:local python3 -m unittest discover test

Troubleshooting

  • all SubConns are in TransientFailure: Typically, here it happens that lnd is not given enough time to start. The simulation of a lightning network is memory and CPU intensive. Each LN node needs some time to get up and running and consumes resources. Currently, the startup of each lnd node is delayed to distribute CPU load. The settings were tested on a quadcore processor and 8 GB of RAM.
  • bitcoind and lnd processes are not terminated: Sometimes it happens that the processes are not terminated correctly, so before you start new tests, make sure to do so manually.

Related Projects

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].