rgb-cln/contrib/pylightning
lisa neigut a39c97c960 channeld: support private channel creation, fixes #2125
Adds a new 'announce' field for `fundchannel`, which if false
won't broadcast a `channel_announcement`.
2018-12-08 15:15:55 -08:00
..
lightning channeld: support private channel creation, fixes #2125 2018-12-08 15:15:55 -08:00
README.md update pylightning readme installation informations 2018-01-31 12:38:18 +01:00
lightning-pay [pylightning] Fix lightning-pay script 2018-11-19 21:24:03 +01:00
setup.py pylightning: Bump version number to 0.0.6 to make Pypi work again 2018-12-07 10:29:21 +01:00

README.md

pylightning: A python client library for lightningd

Installation

Note: With Python 2 you need to have the futures python library installed to be able to use pylightning:

pip install futures

pylightning is available on pip

pip install pylightning

Example

from lightning import LightningRpc
import random

# Create two instances of the LightningRpc object using two different c-lightning daemons on your computer
l1 = LightningRpc("/tmp/lightning1/lightning-rpc")
l5 = LightningRpc("/tmp/lightning5/lightning-rpc")

info5 = l5.getinfo()
print(info5)

# Create invoice for test payment
invoice = l5.invoice(100, "lbl{}".format(random.random()), "testpayment")
print(invoice)

# Get route to l1
route = l1.getroute(info5['id'], 100, 1)
print(route)

# Pay invoice
print(l1.sendpay(route['route'], invoice['payment_hash']))