osslabz / lnd-rest-client

A simple REST client to connect to Lightning Network Daemon (LND) via HTTP.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lnd-rest-client

GitHub GitHub Workflow Status Maven Central

lnd-http-client is a simple client to interact with Lightning Network Daemon (LND) via it's REST API. Thanks to the API's excellent documentation the client is simply generated based on it's swagger definition.

If you prefer LND's gRPC API please have a look at LighntingJ.

Why this client?

This library mostly exists because when I needed such a library LighntingJ. wasn't (yet) supported on Apple Silicon....

Other advantages are:

  • it's very easy to review (which you should always do when you handle any valuable assets, crypto or otherwise)
  • it supports good old HTTP/1.1 while gRPC is build on http/2. In a perfect world we would all have migrated to http/2 already but there might be circumstances that might hinder its usage.
  • It serves as my playground for reproducible builds via maven ;-)

QuickStart

Maven

<dependency>
    <groupId>net.osslabz</groupId>
    <artifactId>lnd-rest-client</artifactId>
    <version>0.0.2</version>
</dependency>

Usage

    String lndHost="127.0.0.1";
    int lndPort=8080;

    String lndCertPath="/path/to/tls.cert";
    String lndMacaroonPath="/path/to/readonly.macaroon";

    LndApiClient lndApiClient=new LndApiClient(lndHost,lndPort,lndCertPath,lndMacaroonPath,true);

    LnrpcNetworkInfo lnrpcNetworkInfo=lndApiClient.getLightningApi().getNetworkInfo();

    log.debug("network info: {}",lnrpcNetworkInfo);

Logging

The actual client uses slf4j-api but doesn't package an implementation. This is up to the using application.

About

A simple REST client to connect to Lightning Network Daemon (LND) via HTTP.

License:Apache License 2.0


Languages

Language:Java 100.0%