Lightning Network using Ruby
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
.DS_Store
.gitignore
LICENSE
README.md
lightning.gemspec

README.md

LIGHTNING.RB

⊂_ヽ
  \\ Λ_Λ
   \( ˇωˇ)
    / ⌒
  /  へ\
  /  / \\
   レ ノ   ヽ_つ
  / /  So you are telling me I can use Lightning from Ruby now? ⚡️ 
 ( (ヽ
 | |、 \
 | 丿 \
 | |  ) /
ノ )  Lノ

A Ruby library to talk to Lightning Nodes

Install

gem install lightning_rb

Backends

We curently fully support LND. We'll be adding support for c-lightning and other lightning backends.

Authentication

We use Macaroons and the certificate generated by lnd to authenticate. See Node.rb.

TODO:

  • Use ENV variable for CERTIFICATE_PATH

  • Use ENV variable for MACAROONS_PATH

  • Use ENV variable for NODE_URL

  • Yard Documentation for:

  • Node::Payments

  • Node::Channels

  • Node::OnChain

  • Node::Peers

  • Node::Wallet

  • Able to configure location of macaroons.

  • Able to configure location of certificate file.

LND

We fully support lnd-cli with a Ruby like API. For example:

Node.new.get_info 

Node::Payments.new.list_invoices

Node::Channels.new.list_channels

Node::OnChain.new.send_coins(address, number)

Node::Peers.new.list_peers

Node::Wallet.new_address

LN-CLI HELP

The following is the help from ln-cli. We wrapped most of the commands below with a Ruby like syntax.


############
  Legend
############

* DONE
- WON'T DO
p PENDING

------------



COMMANDS:

*     getinfo     Returns basic information related to the active daemon.
-     debuglevel  Set the debug level.
-     stop        Stop and shutdown the daemon.
-     help, h     Shows a list of commands or help for one command

   Startup:
-     create  Initialize a wallet when starting lnd for the first time.
-     unlock  Unlock an encrypted wallet at startup.




   Payments:

p    getchaninfo       Get the state of a channel.
p    queryroutes    Query a route to a destination.
p    fwdinghistory  Query the history of all forwarded HTLCs.



*     payinvoice     Pay an invoice over lightning.
*     sendpayment    Send a payment over lightning.
*     addinvoice     Add a new invoice.
*     lookupinvoice  Lookup an existing invoice by its payment hash.
*     decodepayreq   Decode a payment request.
*     listinvoices   List all invoices currently stored.
*     listpayments   List all outgoing payments.

   Channels:

p     openchannel       Open a channel to a node or an existing peer.
*     closechannel      Close an existing channel.
*     closeallchannels  Close all existing channels.

*     channelbalance    Returns the sum of the total available channel balance across all open chans
*     pendingchannels   Display information pertaining to pending channels.
*     listchannels      List all open channels.
*     getnetworkinfo    Get statistical information about the current state of the network.
*     feereport         Display the current fee policies of all active channels.
-     updatechanpolicy  Update the channel policy for all channels, or a single channel.



   On-chain:

*     sendmany       Send bitcoin on-chain to multiple addresses.
*     sendcoins      Send bitcoin on-chain to an address.
*     listchaintxns  List transactions from the wallet.


*   Peers:

*     connect        Connect to a remote lnd peer.
*     disconnect     Disconnect a remote lnd peer identified by public key.
*     listpeers      List all active, currently connected peers.
*     describegraph  Describe the network graph.
*     getnodeinfo    Get information on a specific node.

   Wallet:

*     newaddress     Generates a new address.
*     walletbalance  Compute and display the wallet's current balance.
*     signmessage    Sign a message with the node's private key.
*     verifymessage  Verify a message signed with the signature.