lnd-rust

Crates.iolnd-rust
lib.rslnd-rust
version0.5.0
sourcesrc
created_at2018-07-06 08:58:36.334106
updated_at2019-09-11 12:09:31.702442
descriptionRust binding to the Lightning Network Daemon
homepage
repositoryhttps://github.com/LightningPeach/lnd-rust
max_upload_size
id73092
size1,492,204
Vladislav Melnik (vlad9486)

documentation

README

lnd-rust

The lnd-rust is the rust binding to the Lightning Network Daemon.

Requirements

Go and lnd are required to generate the additional code and build the package.

Updating

The file protos/rpc.proto should be synced with https://github.com/lightningnetwork/lnd/blob/master/lnrpc/rpc.proto.

Tested with the Lightning Network Daemon version "0.4.2".

Usage

First, add the following to Cargo.toml:

[dependencies]
lnd-rust = "0.1"
grpc = "0.5.0"

Next, create lightning client object:

let lightning_client = {
    let certificate = lnd_rust::TLSCertificate::from_der_path("path/to/file.crt").unwrap();
    let config = Default::default();
    let socket = "127.0.0.1:9000".parse().unwrap();
    let tls = certificate.into_tls("localhost").unwrap();
    let grpc_client = grpc::Client::new_expl(&socket_addr, "localhost", tls, config).unwrap();
    lnd_rust::rpc_grpc::LightningClient::with_client(grpc_client)
};

Now, it is possible to make requests:

let request = lnd_rust::rpc::GetInfoRequest::new();
let options = grpc::RequestOptions::new();
let response = lightning_client.get_info(options, request);

See src/bin/main.rs for details.

Commit count: 34

cargo fmt