raiju

package module
v0.0.0-...-1e2dbb7 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2022 License: MIT Imports: 8 Imported by: 0

README

      :::::::::      :::     ::::::::::: ::::::::::: :::    ::: 
     :+:    :+:   :+: :+:       :+:         :+:     :+:    :+:  
    +:+    +:+  +:+   +:+      +:+         +:+     +:+    +:+   
   +#++:++#:  +#++:++#++:     +#+         +#+     +#+    +:+    
  +#+    +#+ +#+     +#+     +#+         +#+     +#+    +#+     
 #+#    #+# #+#     #+#     #+#     #+# #+#     #+#    #+#      
###    ### ###     ### ###########  #####       ########            

overview

Your friendly bitcoin lightning network helper.

Raiju is a CLI app which sits on top of a running lightning node instance. It currently only supports the lnd node implementation. Raiju calls out to the node for information and then performs anaylsis for insights and node management.

usage

All of Raiju's subcommands can be listed with the global help flag.

raiju -h

candidates

Lists nodes by distance descending.

Theoretically these are desirable nodes to open channels to because they are well connected, but far (a.k.a. many fees) away from the current node. The Distant Neighbors metric is the number of channels that node has with distant nodes from the root node.

$ raiju candidates
Pubkey                                                              Alias                             Distance  Distant Neighbors  Capacity    Channels  Updated
029ef8a775117ba63662a1d1d92b8a184bb1758ed1e12b0cdbb5e92672ef695b73  Carnivore                         4         8                  14932925    8         2021-04-21 23:17:36 -0700 PDT
0390b5d4492dc2f5318e5233ab2cebf6d48914881a33ef6a9c6bcdbb433ad986d0  LNBIG.com [lnd-01]                3         547                2568240344  547       2021-04-22 12:20:14 -0700 PDT
02c91d6aa51aa940608b497b6beebcb1aec05be3c47704b682b3889424679ca490  LNBIG.com [lnd-21]                3         372                2134427027  372       2021-04-22 08:32:48 -0700 PDT
02a04446caa81636d60d63b066f2814cbd3a6b5c258e3172cbdded7a16e2cfff4c  ln.bitstamp.net [Bitstamp]        3         366                1621569578  366       2021-04-22 12:43:28 -0700 PDT
...

The assume flag allows you to see the remaining set of nodes assuming channels were opened to a candidate. This can be used to find a set of nodes to open channels too in single batch transaction in order to minimize on onchain fees.

fees

Auto set channel fees based on the channel's current liquidity.

The idea here is to encourage channel re-balancing through fees. If a channel has a too much local liquidity, fees are lowered in order to encourage relatively more outbound transactions. Visa versa for a channel with too little local liquidity.

The strategy for fee amounts is hardcoded (although I might try to add some more in the future) to standardFee/5, standardFee, or standardFeex5.

$ raiju fees -standardFee=200
systemd automation

Automatically update fees weekly with a systemd service and timer.

Example fees.service:

[Unit]
Description=Set fees of LND node

[Service]
User=lightning
Group=lightning
ExecStart=/usr/local/bin/raiju fees

Example fees.timer:

[Unit]
Description=Set fees weekly

[Timer]
OnCalendar=weekly

[Install]
WantedBy=timers.target

installation

Raiju requires go on the system to be compiled.

$ git clone https://git.sr.ht/~yonson/raiju
$ cd raiju
$ go install cmd/raiju/raiju.go

Some handy targets are provided in the Makefile, but do not need to be used.

configuration

All flags can be found with the help flag -h.

Global flags (not subcommand flags) can be set on the CLI, through environment variables, or with a configuration file. Flags overwrite environment variables which overwrite the configuration file values.

Environment variables have a RAIJU_ prefix appended to the flag name. For example, the global flag host can be set with the RAIJU_HOST environment variable.

A configuration file can be provided with the -config flag or the default location (for Linux it's ~/.config/raiju/config) can be used. The configuration file format is a flag per line, whitespace delimited.

host localhost:10009

node

Are you here looking for a node to open a channel too? Well, may I offer Riaju's node! Could always use the inbound: 02b6867b56ca1b6a4548b97b009152683fa366bfa1b14119c8f9992e1acacbe1c8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BtcToSat

func BtcToSat(btc float64) int

BtcToSat returns the btc amount in satoshis

func PrintNodes

func PrintNodes(nodes []RelativeNode) error

PrintNodes outputs table formatted list of nodes.

Types

type CandidatesRequest

type CandidatesRequest struct {
	// Pubkey is the key of the root node to perform crawl from
	Pubkey string
	// MinCapcity filters nodes with a minimum satoshi capacity (sum of channels)
	MinCapacity float64
	// MinChannels filters nodes with a minimum number of channels
	MinChannels int
	// MinDistance filters nodes with a minumum distance (number of hops) from the root node
	MinDistance int
	// MinNeighborDistance is the distance required for a node to be considered a distanct neighbor
	MinNeighborDistance int
	// MinUpdated filters nodes which have not been updated since time
	MinUpdated time.Time
	// Assume channels to these pubkeys
	Assume []string
	// Number of results
	Limit int
}

CandidatesRequest contains necessary info to perform sorting across the network

type Raiju

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

func New

func New(client client) Raiju

func (Raiju) Candidates

func (r Raiju) Candidates(ctx context.Context, request CandidatesRequest) ([]RelativeNode, error)

Candidates walks the lightning network from a specific node keeping track of distance (hops).

func (Raiju) Fees

func (r Raiju) Fees(ctx context.Context, standardFee int) error

Set fees to encourage a balanced channel.

type RelativeNode

type RelativeNode struct {
	lightning.Node
	// contains filtered or unexported fields
}

RelativeNode has information on a node's graph charactericts relative to other nodes.

Directories

Path Synopsis
cmd
Wrap lightning network node implementations.
Wrap lightning network node implementations.

Jump to

Keyboard shortcuts

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