Lightning Network Client for Elixir using grpc bindings
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
lib
priv/protos
test
.formatter.exs
.gitignore
LICENSE
README.md
mix.exs
mix.lock

README.md

ExLndclient

This is work in progress. It is functional but I would be careful using it in production. If you want to help, please drop me a message. Any help is greatly appreciated!

This is a gRPC client for lnd (0.5-beta). It is generated code from rpc.proto

Usage

  1. Install deps and compile
$ mix do deps.get, compile, escript.build
  1. set the macaroon.txt and tls.cert and get the hostname
  2. start the script
$ ./ex_lndclient --macaroonpath=macaroon.txt --tlscertpath=tls.cert --rpcserver=127.0.0.1:10009

Installation

You need the elixir implementation of gRPC

If available in Hex, the package can be installed by adding ex_lndclient to your list of dependencies in mix.exs:

def deps do
  [
    {:ex_lndclient, "~> 0.1.0"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/ex_lndclient.

Lightning network

  1. Convert the macaroon to txt format
$ xxd -p -c2000 admin.macaroon > macaroon.txt
  1. And get the tls.cert
  2. Copy the files

Generate Elixir code from proto

  1. Install priv/protos/lndrpc/rpc.proto here
  2. Get priv/protos/google/api/http.proto and priv/protos/google/api/annotations.proto here
  3. Install protoc here
  4. Install protoc-gen-elixir
mix escript.install hex protobuf
  1. Generate the code:
$ protoc -I priv/protos --elixir_out=plugins=grpc:./lib/ priv/protos/lnrpc/rpc.proto

Refer to protobuf-elixir for more information. And https://github.com/lightningnetwork/lnd/tree/master/docs/grpc for lightningnetwork grpc lnd

Roadmap

  • Connect to a lightning network server via gRPC
  • Subscribe to transaction stream
  • Enhance your calm too many pings (old server?)
  • Command line version
  • Elixir module for reuse
  • Add support for macaroon to the grpc library

More Info

License

  1. ex_lndclient Copyright (c) 2018 David Rasch Licensed under the MIT License
  2. Google Protos Licensed under the Apache 2.0 License
  3. lnrpc Lightningnetwork Protos Licensed under the MIT License