terminal

package module
v0.12.4-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 88 Imported by: 0

README

Lightning Terminal (LiT)

CI

Lightning Terminal (LiT) is a browser-based interface for managing channel liquidity.

screenshot

Features

  • Visualize your channels and balances
  • Perform submarine swaps via the Lightning Loop service
  • Classify channels according to your node's operating mode
  • Run a single binary that integrates loopd, poold and faraday daemons all in one
  • Access a preview release of the Pool UI
  • Use Pool to earn sats by opening channels to those needing inbound liquidity

Installation

Download the latest binaries from the releases page.

Additionally, you can find detailed instructions on the docs.lightning.engineering page.

Execution

Run Lightning Terminal with a local lnd instance:

⛰  ./litd --uipassword=UP48lm4Vjqxy<change_this_or_you_will_get_robbed>

Visit https://localhost:8443 to access Terminal.

Note that a password with a minimum of 8 characters is required to run Lightning Terminal. In a production environment, it's recommended that you store this password as an environment variable to avoid it being recorded in the command history.

To use LiT with a remote lnd instance please follow these instructions. If you would like to replace your existing LND instance with the one integrated within LiT please see configuring Terminal.

LND

Note that LiT requires lnd to be built with all of its subservers and requires running at least v0.11.0. Download the latest official release binary or build lnd from source by following the installation instructions. If you choose to build lnd from source, use the following command to enable all the relevant subservers:

⛰  make install tags="signrpc walletrpc chainrpc invoicesrpc"

Interaction

If you plan to run LiT on a remote machine but access the web-interface from your computer you may not want to deal with self-signed certificate browser warnings. To avoid these warnings configure the HTTP server to use a certificate from Let's Encrypt. View the Let's Encrypt Configuration doc for instructions on how to configure this.

Upgrading

If you used command line arguments with previous versions then you don't need to change anything when upgrading.

To upgrade from v0.1.1-alpha or earlier simply create a lit.conf file in your LiT directory. The default location LiT uses depends on your operating system:

  • MacOS: ~/Library/Application Support/Lit/lit.conf
  • Linux: ~/.lit/lit.conf
  • Windows: ~/AppData/Roaming/Lit/lit.conf

Move all the configuration settings specific to LiT from lnd.conf to lit.conf and remove any previous LiT-specific customizations from the configuration settings in lnd.conf. Note that any section headers ([ Example ]) in lit.conf should be removed or changed to comments (# Example).

Usage

Read the walkthrough document to learn more about how to use LiT.

Troubleshooting

If you encounter any issues please see our troubleshooting guide.

Build from source

If you’d prefer to compile from source code please follow these instructions.

Compatibility

Full Lightning Terminal functionality can be dependent on running a certain version of lnd. View the table below to ensure that you run the correct version of lnd with the relevant litd release.

This version compatibility dependency is only relevant for running remote mode litd. The bundled version will always come with the correct, compatible versioning.

LiT LND
v0.12.4-alpha v0.17.0-beta
v0.12.3-alpha v0.16.0-beta
v0.12.2-alpha v0.16.0-beta
v0.12.1-alpha v0.16.0-beta
v0.12.0-alpha v0.16.0-beta
v0.11.0-alpha v0.16.0-beta
v0.10.5-alpha v0.16.0-beta
v0.10.4-alpha v0.16.0-beta
v0.10.2-alpha v0.16.0-beta
v0.10.1-alpha v0.16.0-beta
v0.10.0-alpha v0.16.0-beta
v0.9.2-alpha v0.16.0-beta
v0.9.1-alpha v0.16.0-beta
v0.9.0-alpha v0.16.0-beta
v0.8.6-alpha v0.15.4-beta
v0.8.5-alpha v0.15.4-beta
v0.8.4-alpha v0.15.1-beta
v0.8.3-alpha v0.15.1-beta
v0.8.2-alpha v0.15.1-beta
v0.8.1-alpha v0.15.1-beta
v0.8.0-alpha v0.15.1-beta
v0.7.1-alpha v0.14.3-beta
v0.7.0-alpha v0.14.3-beta
v0.6.7-alpha v0.13.3-beta
v0.6.6-alpha v0.13.3-beta
v0.6.5-alpha v0.13.3-beta
v0.6.4-alpha v0.13.3-beta
v0.6.3-alpha v0.13.3-beta
v0.6.2-alpha v0.13.3-beta
v0.6.1-alpha v0.13.3-beta
v0.6.0-alpha v0.13.3-beta
v0.5.2-alpha v0.12.0-beta
v0.5.1-alpha v0.12.0-beta
v0.5.0-alpha v0.12.0-beta
v0.4.1-alpha v0.11.1-beta
v0.4.0-alpha v0.11.1-beta
v0.3.4-alpha v0.11.1-beta
v0.3.3-alpha v0.11.1-beta
v0.3.2-alpha v0.11.1-beta
v0.3.1-alpha v0.11.1-beta
v0.3.0-alpha v0.11.1-beta
v0.2.0-alpha v0.11.0-beta

LiT offers two main operating modes, one in which lnd is running inside the LiT process (called "lnd integrated mode", set by lnd-mode=integrated config option) and one in which lnd is running in a standalone process on the same or remote machine (called "lnd remote mode", set by lnd-mode=remote config option).

In addition to those main modes, the individual bundled daemons (Faraday, Loop and Pool) can be toggled to be integrated or remote as well, or as disabled. This offers a large number of possible configuration combinations, of which not all are fully supported due to technical reasons.

The following table shows the supported combinations:

lnd-mode=integrated lnd-mode=remote
faraday-mode=integrated X X
loop-mode=integrated X X
pool-mode=integrated X X
taprootassets-mode=integrated X X
faraday-mode=remote X
loop-mode=remote X
pool-mode=remote X
taprootassets-mode=remote X
faraday-mode=disable X X
loop-mode=disable X X
pool-mode=disable X X
taprootassets-mode=disable X X
lnd running in "stateless init" mode X

Daemon Versions packaged with LiT

LiT LND Loop Faraday Pool Taproot Assets
v0.12.4-alpha v0.17.4-beta v0.28.0-beta v0.2.13-alpha v0.6.4-beta v0.3.3-alpha
v0.12.3-alpha v0.17.4-beta v0.27.0-beta v0.2.11-alpha v0.6.4-beta v0.3.3-alpha
v0.12.2-alpha v0.17.3-beta v0.26.6-beta v0.2.11-alpha v0.6.4-beta v0.3.2-alpha
v0.12.1-alpha v0.17.1-beta v0.26.5-beta v0.2.11-alpha v0.6.4-beta v0.3.1-alpha
v0.12.0-alpha v0.17.0-beta v0.26.4-beta v0.2.11-alpha v0.6.4-beta v0.3.0-alpha
v0.11.0-alpha v0.17.0-beta v0.26.3-beta v0.2.11-alpha v0.6.4-beta v0.2.3-alpha
v0.10.5-alpha v0.16.4-beta v0.26.2-beta v0.2.11-alpha v0.6.4-beta v0.2.3-alpha
v0.10.4-alpha v0.16.4-beta v0.25.2-beta v0.2.11-alpha v0.6.4-beta v0.2.3-alpha
v0.10.2-alpha v0.16.4-beta v0.25.2-beta v0.2.11-alpha v0.6.4-beta v0.2.2-alpha
v0.10.1-alpha v0.16.3-beta v0.24.1-beta v0.2.11-alpha v0.6.4-beta v0.2.0-alpha
v0.10.0-alpha v0.16.2-beta v0.23.0-beta v0.2.11-alpha v0.6.2-beta v0.2.0-alpha
v0.9.2-alpha v0.16.2-beta v0.23.0-beta v0.2.11-alpha v0.6.2-beta n/a
v0.9.1-alpha v0.16.1-beta v0.23.0-beta v0.2.11-alpha v0.6.2-beta n/a
v0.9.0-alpha v0.16.0-beta v0.22.0-beta v0.2.10-alpha v0.6.2-beta n/a
v0.8.6-alpha v0.15.5-beta v0.21.0-beta v0.2.9-alpha v0.6.1-beta n/a
v0.8.5-alpha v0.15.5-beta v0.20.2-beta v0.2.9-alpha v0.6.1-beta n/a
v0.8.4-alpha v0.15.5-beta v0.20.1-beta v0.2.9-alpha v0.5.8-alpha n/a
v0.8.3-alpha v0.15.4-beta v0.20.1-beta v0.2.8-alpha v0.5.8-alpha n/a
v0.8.2-alpha v0.15.3-beta v0.20.1-beta v0.2.8-alpha v0.5.8-alpha n/a
v0.8.1-alpha v0.15.2-beta v0.20.1-beta v0.2.8-alpha v0.5.8-alpha n/a
v0.8.0-alpha v0.15.1-beta v0.20.1-beta v0.2.8-alpha v0.5.8-alpha n/a
v0.7.1-alpha v0.15.0-beta v0.19.1-beta v0.2.8-alpha v0.5.7-alpha n/a
v0.7.0-alpha v0.15.0-beta v0.19.1-beta v0.2.8-alpha v0.5.7-alpha n/a
v0.6.7-alpha v0.14.3-beta v0.18.0-beta v0.2.7-alpha v0.5.6-alpha n/a
v0.6.6-alpha v0.14.3-beta v0.18.0-beta v0.2.7-alpha v0.5.6-alpha n/a
v0.6.5-alpha v0.14.2-beta v0.15.1-beta v0.2.7-alpha v0.5.5-alpha n/a
v0.6.4-alpha v0.14.2-beta v0.15.1-beta v0.2.7-alpha v0.5.4-alpha n/a
v0.6.3-alpha v0.14.2-beta v0.15.1-beta v0.2.7-alpha v0.5.4-alpha n/a
v0.6.2-alpha v0.14.1-beta v0.15.1-beta v0.2.7-alpha v0.5.4-alpha n/a
v0.6.1-alpha v0.14.1-beta v0.15.1-beta v0.2.7-alpha v0.5.2-alpha n/a
v0.5.3-alpha v0.13.3-beta v0.14.1-beta v0.2.6-alpha v0.5.0-alpha n/a
v0.5.2-alpha v0.13.3-beta v0.14.1-beta v0.2.6-alpha v0.5.0-alpha n/a
v0.5.1-alpha v0.13.0-beta v0.14.1-beta v0.2.6-alpha v0.5.0-alpha n/a
v0.5.0-alpha v0.13.0-beta v0.14.1-beta v0.2.6-alpha v0.5.0-alpha n/a
v0.4.1-alpha v0.12.1-beta v0.11.4-beta v0.2.3-alpha v0.4.4-alpha n/a
v0.4.0-alpha v0.12.0-beta v0.11.2-beta v0.2.3-alpha v0.4.3-alpha n/a
v0.3.4-alpha v0.11.1-beta v0.11.2-beta v0.2.2-alpha v0.3.4-alpha n/a
v0.3.3-alpha v0.11.1-beta v0.11.2-beta v0.2.2-alpha v0.3.4-alpha n/a
v0.3.2-alpha v0.11.1-beta v0.11.1-beta v0.2.2-alpha v0.3.4-alpha n/a
v0.3.1-alpha v0.11.1-beta v0.11.1-beta v0.2.2-alpha v0.3.3-alpha n/a
v0.3.0-alpha v0.11.1-beta v0.11.0-beta v0.2.2-alpha v0.3.2-alpha n/a
v0.2.0-alpha v0.11.1-beta v0.10.0-beta v0.2.1-alpha n/a n/a
v0.1.1-alpha v0.11.0-beta v0.8.1-beta v0.2.0-alpha n/a n/a
v0.1.0-alpha v0.10.3-beta v0.6.5-beta v0.2.0-alpha n/a n/a

Documentation

Index

Constants

View Source
const (
	ModeIntegrated = "integrated"
	ModeRemote     = "remote"
	ModeDisable    = "disable"

	DefaultLndMode = ModeRemote

	DefaultTLSCertFilename = "tls.cert"
	DefaultTLSKeyFilename  = "tls.key"

	DefaultNetwork = "mainnet"

	// DefaultAutogenValidity is the default validity of a self-signed
	// certificate. The value corresponds to 14 months
	// (14 months * 30 days * 24 hours).
	DefaultAutogenValidity = 14 * 30 * 24 * time.Hour

	// DefaultMacaroonFilename is the default file name for the
	// autogenerated lit macaroon.
	DefaultMacaroonFilename = "lit.macaroon"
)
View Source
const (
	// Subsystem defines the logging code for this subsystem.
	Subsystem = "LITD"

	// GrpcLogSubsystem defines the logging code for the gRPC subsystem.
	GrpcLogSubsystem = "GRPC"
)
View Source
const (
	MainnetServer = "autopilot.lightning.finance:12010"
	TestnetServer = "test.autopilot.lightning.finance:12010"
)
View Source
const (

	// HeaderMacaroon is the HTTP header field name that is used to send
	// the macaroon.
	HeaderMacaroon = "Macaroon"
)

Variables

View Source
var (

	// DefaultLitDir is the default directory where LiT tries to find its
	// configuration file and store its data (in remote lnd node). This is a
	// directory in the user's application data, for example:
	//   C:\Users\<username>\AppData\Local\Lit on Windows
	//   ~/.lit on Linux
	//   ~/Library/Application Support/Lit on MacOS
	DefaultLitDir = btcutil.AppDataDir("lit", false)

	// DefaultTLSCertPath is the default full path of the autogenerated TLS
	// certificate that is created in remote lnd mode.
	DefaultTLSCertPath = filepath.Join(
		DefaultLitDir, DefaultTLSCertFilename,
	)

	// DefaultRemoteLndMacaroonPath is the default path we assume for a
	// local lnd node to store its admin.macaroon file at.
	DefaultRemoteLndMacaroonPath = filepath.Join(
		lndDefaultConfig.DataDir, defaultLndChainSubDir,
		defaultLndChain, DefaultNetwork, defaultLndMacaroon,
	)

	// DefaultMacaroonPath is the default full path of the base lit
	// macaroon.
	DefaultMacaroonPath = filepath.Join(
		DefaultLitDir, DefaultNetwork, DefaultMacaroonFilename,
	)
)
View Source
var (
	// ErrWaitingToStart is returned if Lit's rpcProxy is not yet ready to
	// handle calls.
	ErrWaitingToStart = fmt.Errorf("waiting for the RPC server to start")

	// ErrUnknownRequest is an error returned when the request URI is
	// unknown if the permissions for the request are unknown.
	ErrUnknownRequest = fmt.Errorf("unknown request")
)
View Source
var Commit string

Commit stores the current commit hash of this build, this should be set using the -ldflags during compilation.

Functions

func BakeSuperMacaroon

func BakeSuperMacaroon(ctx context.Context, lnd lnrpc.LightningClient,
	rootKeyID uint64, perms []bakery.Op, caveats []macaroon.Caveat) (string,
	error)

BakeSuperMacaroon uses the lnd client to bake a macaroon that can include permissions for multiple daemons.

func SetupLoggers

func SetupLoggers(root *build.RotatingLogWriter, intercept signal.Interceptor)

SetupLoggers initializes all package-global logger variables.

func UseLogger

func UseLogger(logger btclog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using btclog.

func Version

func Version() string

Version returns the application version as a properly formed string per the semantic versioning 2.0.0 spec (http://semver.org/).

Types

type ClientRouteWrapper

type ClientRouteWrapper struct {
	// contains filtered or unexported fields
}

ClientRouteWrapper is a wrapper around a FileSystem which properly handles URL routes that are defined in the client app but unknown to the backend http server

func (*ClientRouteWrapper) Open

func (i *ClientRouteWrapper) Open(name string) (http.File, error)

Open intercepts requests to open files. If the file does not exist and there is no file extension, then assume this is a client side route and return the contents of index.html

type Config

type Config struct {
	HTTPSListen    string   `long:"httpslisten" description:"The host:port to listen for incoming HTTP/2 connections on for the web UI only."`
	HTTPListen     string   `` /* 257-byte string literal not displayed */
	EnableREST     bool     `long:"enablerest" description:"Also allow REST requests to be made to the main HTTP(s) port(s) configured above."`
	RestCORS       []string `long:"restcors" description:"Add an ip:port/hostname to allow cross origin access from. To allow all origins, set as \"*\"."`
	UIPassword     string   `` /* 172-byte string literal not displayed */
	UIPasswordFile string   `` /* 144-byte string literal not displayed */
	UIPasswordEnv  string   `` /* 159-byte string literal not displayed */
	DisableUI      bool     `long:"disableui" description:"If set to true, no web UI will be served and so the uipassword will also not need to be set."`

	LetsEncrypt       bool   `` /* 221-byte string literal not displayed */
	LetsEncryptHost   string `long:"letsencrypthost" description:"The host name to create a Let's Encrypt certificate for."`
	LetsEncryptDir    string `long:"letsencryptdir" description:"The directory where the Let's Encrypt library will store its key and certificate."`
	LetsEncryptListen string `` /* 471-byte string literal not displayed */

	TLSCertPath string `` /* 190-byte string literal not displayed */
	TLSKeyPath  string `` /* 189-byte string literal not displayed */

	LitDir     string `` /* 222-byte string literal not displayed */
	ConfigFile string `long:"configfile" description:"Path to LiT's configuration file."`

	MacaroonPath string `long:"macaroonpath" description:"Path to write the macaroon for litd's RPC and REST services if it doesn't exist."`

	FirstLNCConnDeadline time.Duration `` /* 212-byte string literal not displayed */

	// Network is the Bitcoin network we're running on. This will be parsed
	// before the configuration is loaded and will set the correct flag on
	// `lnd.bitcoin.mainnet|testnet|regtest` and also for the other daemons.
	// That way only one global network flag is needed.
	Network string `` /* 144-byte string literal not displayed */

	Remote *subservers.RemoteConfig `group:"Remote mode options (use when lnd-mode=remote)" namespace:"remote"`

	// LndMode is the selected mode to run lnd in. The supported modes are
	// 'integrated' and 'remote'. We only use a string instead of a bool
	// here (and for all the other daemons) to make the CLI more user
	// friendly. Because then we can reference the explicit modes in the
	// help descriptions of the section headers. We'll parse the mode into
	// a bool for internal use for better code readability.
	LndMode string      `` /* 515-byte string literal not displayed */
	Lnd     *lnd.Config `group:"Integrated lnd (use when lnd-mode=integrated)" namespace:"lnd"`

	FaradayMode string          `` /* 489-byte string literal not displayed */
	Faraday     *faraday.Config `group:"Integrated faraday options (use when faraday-mode=integrated)" namespace:"faraday"`

	LoopMode string        `` /* 470-byte string literal not displayed */
	Loop     *loopd.Config `group:"Integrated loop options (use when loop-mode=integrated)" namespace:"loop"`

	PoolMode string       `` /* 470-byte string literal not displayed */
	Pool     *pool.Config `group:"Integrated pool options (use when pool-mode=integrated)" namespace:"pool"`

	TaprootAssetsMode string         `` /* 496-byte string literal not displayed */
	TaprootAssets     *tapcfg.Config `group:"Integrated taproot assets options (use when taproot-assets=integrated)" namespace:"taproot-assets"`

	RPCMiddleware *mid.Config `group:"RPC middleware options" namespace:"rpcmiddleware"`

	Autopilot *autopilotserver.Config `group:"Autopilot server options" namespace:"autopilot"`

	Firewall *firewall.Config `group:"Firewall options" namespace:"firewall"`

	Accounts *accounts.Config `group:"Accounts options" namespace:"accounts"`
	// contains filtered or unexported fields
}

Config is the main configuration struct of lightning-terminal. It contains all config items of its enveloping subservers, each prefixed with their daemon's short name.

type GrpcLogLogger

type GrpcLogLogger struct {
	btclog.Logger
}

GrpcLogLogger is a wrapper around a btclog logger to make it compatible with the grpclog logger package. By default we downgrade the info level to debug to reduce the verbosity of the logger.

func NewGrpcLogLogger

func NewGrpcLogLogger(root *build.RotatingLogWriter,
	intercept signal.Interceptor, subsystem string) *GrpcLogLogger

NewGrpcLogLogger creates a new grpclog compatible logger and attaches it as a sub logger to the passed root logger.

func (GrpcLogLogger) Errorln

func (l GrpcLogLogger) Errorln(args ...interface{})

func (GrpcLogLogger) Fatal

func (l GrpcLogLogger) Fatal(args ...interface{})

func (GrpcLogLogger) Fatalf

func (l GrpcLogLogger) Fatalf(format string, args ...interface{})

func (GrpcLogLogger) Fatalln

func (l GrpcLogLogger) Fatalln(args ...interface{})

func (GrpcLogLogger) Info

func (l GrpcLogLogger) Info(args ...interface{})

func (GrpcLogLogger) Infof

func (l GrpcLogLogger) Infof(format string, args ...interface{})

func (GrpcLogLogger) Infoln

func (l GrpcLogLogger) Infoln(args ...interface{})

func (GrpcLogLogger) V

func (l GrpcLogLogger) V(level int) bool

func (GrpcLogLogger) Warning

func (l GrpcLogLogger) Warning(args ...interface{})

func (GrpcLogLogger) Warningf

func (l GrpcLogLogger) Warningf(format string, args ...interface{})

func (GrpcLogLogger) Warningln

func (l GrpcLogLogger) Warningln(args ...interface{})

type LightningTerminal

type LightningTerminal struct {
	// contains filtered or unexported fields
}

LightningTerminal is the main grand unified binary instance. Its task is to start an lnd node then start and register external subservers to it.

func New

func New() *LightningTerminal

New creates a new instance of the lightning-terminal daemon.

func (*LightningTerminal) BuildWalletConfig

func (g *LightningTerminal) BuildWalletConfig(ctx context.Context,
	dbs *lnd.DatabaseInstances, interceptorChain *rpcperms.InterceptorChain,
	grpcListeners []*lnd.ListenerWithSignal) (*chainreg.PartialChainControl,
	*btcwallet.Config, func(), error)

BuildWalletConfig is responsible for creating or unlocking and then fully initializing a wallet.

NOTE: This is only implemented in order for us to intercept the setup call and store a reference to the interceptor chain.

NOTE: This is part of the lnd.WalletConfigBuilder interface.

func (*LightningTerminal) Permissions

func (g *LightningTerminal) Permissions() map[string][]bakery.Op

Permissions returns all permissions for which the external validator of the terminal is responsible.

NOTE: This is part of the lnd.ExternalValidator interface.

func (*LightningTerminal) RegisterGrpcSubserver

func (g *LightningTerminal) RegisterGrpcSubserver(server *grpc.Server) error

RegisterGrpcSubserver is a callback on the lnd.SubserverConfig struct that is called once lnd has initialized its main gRPC server instance. It gives the daemons (or external subservers) the possibility to register themselves to the same server instance.

NOTE: This is part of the lnd.GrpcRegistrar interface.

func (*LightningTerminal) RegisterRestSubserver

func (g *LightningTerminal) RegisterRestSubserver(ctx context.Context,
	mux *restProxy.ServeMux, endpoint string,
	dialOpts []grpc.DialOption) error

RegisterRestSubserver is a callback on the lnd.SubserverConfig struct that is called once lnd has initialized its main REST server instance. It gives the daemons (or external subservers) the possibility to register themselves to the same server instance.

NOTE: This is part of the lnd.RestRegistrar interface.

func (*LightningTerminal) Run

func (g *LightningTerminal) Run() error

Run starts everything and then blocks until either the application is shut down or a critical error happens.

func (*LightningTerminal) ValidateMacaroon

func (g *LightningTerminal) ValidateMacaroon(ctx context.Context,
	requiredPermissions []bakery.Op, fullMethod string) error

ValidateMacaroon extracts the macaroon from the context's gRPC metadata, checks its signature, makes sure all specified permissions for the called method are contained within and finally ensures all caveat conditions are met. A non-nil error is returned if any of the checks fail.

NOTE: This is part of the lnd.ExternalValidator interface.

Directories

Path Synopsis
cmd
Package litrpc is a reverse proxy.
Package litrpc is a reverse proxy.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL