Giter Club home page Giter Club logo

lndclient's Introduction

Golang client library for lnd

lndclient is a golang native wrapper for lnd's gRPC interface.

Compatibility matrix

This library depends heavily on lnd for obvious reasons. To support backward compatibility with older versions of lnd, we use different branches for different versions. There are two "levels" of depending on a version of lnd:

  • Code level dependency: This is the version of lnd that is pulled in when compiling lndclient. It is defined in go.mod. This usually is the latest released version of lnd, because its RPC definitions are kept backward compatible. This means that a new field added in the latest version of lnd might already be available in lndclient's code, but whether or not that field will actually be set at run time is dependent on the actual version of lnd that's being connected to.
  • RPC level dependency: This is defined in minimalCompatibleVersion in lnd_services.go. When connecting to lnd, the version returned by its version service is checked and if it doesn't meet the minimal required version defined in lnd_services.go, an error will be returned. Users of lndclient can also overwrite this minimum required version when creating a new client.

The current compatibility matrix reads as follows:

lndclient git tag lnd version in go.mod minimum required lnd version
master / v0.15.4-0 v0.15.4-beta v0.15.4-beta

By default, lndclient requires (and enforces) the following RPC subservers to be active in lnd:

  • signrpc
  • walletrpc
  • chainrpc
  • invoicesrpc

Branch strategy

We follow the following strategy to maintain different versions of this library that have different lnd compatibilities:

  1. The master is always backward compatible with the last major version.
  2. We create branches for all minor versions and future major versions and merge PRs to those branches, if the features require that version to work.
  3. We rebase the branches if needed and use tags to track versions that we depend on in other projects.
  4. Once a new major version of lnd is final, all branches of minor versions lower than that are merged into master.

lndclient's People

Contributors

ardevd avatar arshbot avatar bhandras avatar blackjid avatar calvinrzachman avatar carlakc avatar dependabot[bot] avatar ellemouton avatar ffranr avatar georgetsagk avatar guggero avatar halseth avatar joostjager avatar jstol avatar orbitalturtle avatar positiveblue avatar qustavo avatar roasbeef avatar sbres avatar sputn1ck avatar valentinewallace avatar viktortigerstrom avatar wpaulino avatar yyforyongyu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lndclient's Issues

Decoding signatures

When signing a message, a fixed-size LN wire format encoded signature is returned, but I haven't figured out how to decode it. Is there some helper functions in lndclient or do I have to use btcd or something similar to parse it?

Missing SubscribeInvoices in LightningClient

Hello,

I'm trying to Subscribe to Lnd incoming invoices
After bootstrapping some code using lnrpc.LightningClient & NewBasicClient, I switched to GrpcLndServices and I found out SubscribeInvoices is not in LightningClient.

Are we not meant to use the LightningClient for that or is it just missing?

Documentation?

Is there any official documentation for lndclient apart from the one on pkg.go.dev?

Are we still encouraged to use GrpcLndServices as opposed to LightningClient or BasicClient?

Router SendPayment does not parse Amount when Invoice with dynamic value is set.

rpcReq.Amt = int64(request.Amount)

When sending a payment with the parameters request.Invoice set to a 0 amount invoice as well as request.Amount set it will still submit it without the amount as opposed to what is expected for a dynamic value invoice.

I tried it with this invoice. This will result in rpc error: code = Unknown desc = amount must be specified when paying a zero amount invoice

Or is this expected and I have to replace the 0 amount invoice myself first?

Value rounded to sat in AddInvoice

In the call AddInvoice, the parameter Value that is in mSat is rounded to a full sat in order to be sent in the Value field of the Invoice.

Value: int64(in.Value.ToSatoshis()),

This creates a silent error because if you try to create an invoice of less than a Sat, an invoice for 0 sat is created. This creating an invoice that does not reflect what was requested.

I see that the Invoice structure has the field ValueMsat, I think this would be a better fit, the loss of precision will be avoided and the parameters will match the invoice.

Not possible to force closing inactive channel without specifying custom fee?

I'm trying to implement channel closure functionality with ´lndclient` and I'm facing an issue when trying to force close an inactive channel.

The API requires a confTarget int32 argument, but attempting to force close a channel leads to an RPC error due to the fact that a custom fee was set.

lndService.Client.CloseChannel(m.ctx, outPoint, true, 5, address)

results in:

rpc error: code = Unknown desc = force closing a channel uses a pre-defined fee

Is there a way to not pass a pre-defined fee that I haven't found yet or does lndclient need to be updated in order to support closing inactive channels?

Proposal: merge this repo into the main lnd (incompatible versions).

Apparently due to some version incompatibilities between LND, lndclient, and Loop, it's impossible to use all 3 successfully inside a single Go module (I'm not sure it's a supported use case, in case if not, I'd like to set a precedent then 😀).

Reproduce:

mkdir lnd-all
cd lnd-all
go mod init lnd-all
cat > main.go <<EOF
package main

import (
	"fmt"

	_ "github.com/lightninglabs/lndclient"
	_ "github.com/lightninglabs/loop"
	_ "github.com/lightningnetwork/lnd"
)

func main() {
	fmt.Println("Hello")
}
EOF
go mod tidy
go run ./

This fails with:

# github.com/lightninglabs/loop/sweep
../../../go/pkg/mod/github.com/lightninglabs/[email protected]/sweep/sweeper.go:61:14: undefined: lndclient.SignDescriptor
../../../go/pkg/mod/github.com/lightninglabs/[email protected]/sweep/sweeper.go:74:26: undefined: lndclient.SignDescriptor

It seems like this repo depends a lot on the main LND repo and reuses a lot of its packages (some of which are even separate Go modules). Could it be reasonable for this module to belong inside the main LND repository, so that breaking changes could be fixed immediately?

With that, Loop and other projects could depend on the main LND module and avoid having incompatible LND and lndclient in their dependencies. Any project depending on LND and lndclient at the same time could be having hard times integrating them.

Connecting to LND by supplying raw certs and macaroons

Feature request

Add ability to supply raw certs and macaroons as []byte, instead of specifying a path.

Motivation

When working with nodes and services running in containers, we do not necessarily have (easy) access to the underlying file system used by a container. Instead, it is easier to read specific files (certs and macaroons) out of the container. Being able to supply these would simplify my work flow.

Failing installing dependencies

github.com/lightninglabs/lndclient imports
github.com/btcsuite/btcd/btcec: cannot find module providing package github.com/btcsuite/btcd/btcec

How can this be solved?

No support for Main RPC message signing?

It seems lndclient only implements this RPC call for message signing and not the main RPC implementation. Am I correct?

This doesn't seem to work for message signing (for Amboss authentication for example). I presume Im using the wrong key.

keyLocator := &keychain.KeyLocator{
		Family: keychain.KeyFamilyNodeKey,
	}

	// Call the SignMessage function
	signature, err := m.lndService.Signer.SignMessage(m.ctx, []byte(messageToSign),
		*keyLocator, lndclient.SignCompact())

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.