#protocol #rpc #lightning #bitcoin

clightningrpc

Crate that provides an RPC binding from rust code to the c-lightning daemon

2 unstable releases

0.2.0 Aug 21, 2020
0.1.0 Sep 5, 2018

#184 in Cryptocurrencies

Download history 15/week @ 2021-01-07 14/week @ 2021-01-14 17/week @ 2021-01-21 15/week @ 2021-01-28 5/week @ 2021-02-04 20/week @ 2021-02-11 17/week @ 2021-02-18 23/week @ 2021-02-25 12/week @ 2021-03-04 18/week @ 2021-03-11 14/week @ 2021-03-18 15/week @ 2021-03-25 12/week @ 2021-04-01 19/week @ 2021-04-08 17/week @ 2021-04-15 18/week @ 2021-04-22

73 downloads per month
Used in ionosphere

CC0 license

50KB
1K SLoC

Rust c-lightning client

Status Crates.io

This crate provides an interface from rust to the c-lightning daemon through RPC.

extern crate clightningrpc;
use std::env;
use clightningrpc::LightningRPC;

fn main() {
    let sock = env::home_dir().unwrap().join(".lightning/lightning-rpc");
    let mut client = LightningRPC::new(&sock);

    println!("getinfo result: {:?}", client.getinfo().unwrap());
}

See examples directory for more usage examples. To build and run an example do cargo run --example ex_1. API documentation for the lastest version can be found on docs.rs.

Currently implemented (this covers all non-dev commands as of c-lightning v0.6.1rc1):

  • getinfo
  • feerates
  • listnodes
  • listchannels
  • help
  • getlog
  • listconfigs
  • listpeers
  • listinvoices
  • invoice
  • delinvoice
  • delexpiredinvoice
  • autocleaninvoice
  • waitanyinvoice
  • waitinvoice
  • pay
  • sendpay
  • waitsendpay
  • listpayments
  • decodepay
  • getroute
  • connect
  • disconnect
  • fundchannel
  • close
  • ping
  • listfunds
  • withdraw
  • newaddr
  • stop

Be aware that the API (of rust-clighting-rpc, but also that of c-lightning itself) is not finalized. This means that it may change from version to version and break your compile, sorry!

Contributing guidelines

  • Four spaces
  • Call rustfmt src/lib.rs examples/*.rs before committing
  • If you can, GPG-sign at least your top commit when filing a PR

Credits

This library is based on Andrew Poelstra's rust-jsonrpc.

Dependencies

~0.8–1.5MB
~35K SLoC