#lightning #protocols #bitcoin #rpc

clightningrpc

Crate that provides a strong typed RPC binding from rust code to the core lightning daemon

10 releases

0.3.0-beta.8 Aug 24, 2023
0.3.0-beta.6 Jun 13, 2023
0.3.0-beta.5 Mar 10, 2023
0.3.0-beta.4 Nov 21, 2022
0.1.0 Sep 5, 2018

#888 in Magic Beans

Download history 170/week @ 2023-12-15 69/week @ 2023-12-22 227/week @ 2023-12-29 531/week @ 2024-01-05 123/week @ 2024-01-12 211/week @ 2024-01-19 168/week @ 2024-01-26 418/week @ 2024-02-02 363/week @ 2024-02-09 238/week @ 2024-02-16 590/week @ 2024-02-23 1004/week @ 2024-03-01 641/week @ 2024-03-08 802/week @ 2024-03-15 393/week @ 2024-03-22 155/week @ 2024-03-29

2,124 downloads per month
Used in 4 crates

CC0 license

62KB
1.5K SLoC

Rust c-lightning client

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

Project Homepage

GitHub Workflow Status (branch) Crates.io docs.rs

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!

N.B: A good solution if you have some missing compatibility between core lightning and the rust library, considering to use the common crate.

Contributing guidelines

  • Four spaces
  • Call make fmt before committing
  • If you can, GPG-sign at least your top commit when filing a PR

Supports

If you want support this library consider to donate with the following methods

Credits

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

Dependencies

~0.7–1.4MB
~33K SLoC