A python grpc client for LND (Lightning Network Daemon) ⚡⚡⚡
This is a wrapper around the default grpc interface that handles setting up credentials (including macaroons). An async client is also available to do fun async stuff like listening for invoices in the background.
## Dependencies
Python 2.7, 3.4+
Note: the async client is only available for Python 3.5+
## Installation
```bash
$ pip install lndgrpc
```
## Basic Usage
The api mirrors the underlying lnd grpc api (http://api.lightning.community/) but methods will be in pep8 style. ie. `.GetInfo()` becomes `.get_info()`.
```python
from lndgrpc import LNDClient
# pass in the ip-address with RPC port and network ('mainnet', 'testnet', 'simnet')
# the client defaults to 127.0.0.1:10009 and mainnet if no args provided
lnd = LNDClient("127.0.0.1:10009", network='simnet')
lnd.get_info()
print('Listening for invoices...')
for invoice in lnd.subscribe_invoices():
print(invoice)
```
### Async
```python
import asyncio
from lndgrpc import AsyncLNDClient
async_lnd = AsyncLNDClient()
async def subscribe_invoices():
print('Listening for invoices...')
async for invoice in async_lnd.subscribe_invoices():
print(invoice)
async def get_info():
while True:
info = await async_lnd.get_info()
print(info)
await asyncio.sleep(5)
async def run():
coros = [subscribe_invoices(), get_info()]
await asyncio.gather(*coros)
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
```
### Specifying Macaroon/Cert files
By default the client will attempt to lookup the `readonly.macaron` and `tls.cert` files in the mainnet directory.
However if you want to specify a different macaroon or different path you can pass in the filepath explicitly.
```python
lnd = LNDClient(macaroon_filepath='~/.lnd/invoice.macaroon', cert_filepath='path/to/tls.cert')
```
#### Admin macaroon
Use the admin macaroon to perform write actions (ie. creating invoices, creating new addresses)
```python
lnd = LNDClient(admin=True)
lnd.add_invoice(2000)
```
Metadata
Release files for lndgrpc 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lndgrpc-0.2.0.tar.gz | 41.1 kB | Without provenance | Details for lndgrpc-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lndgrpc-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for lndgrpc-0.2.0-py3-none-any.whl |
Total release size: 86.0 kB
Release files / lndgrpc-0.2.0.tar.gz
| Download URL | lndgrpc-0.2.0.tar.gz |
|---|---|
| Size | 41.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4ef3687b9f43d2307e8356eea9641b2f86124a8a301dec1807af7e7e4443a537
|
|
BLAKE2b-256 checksum How to use checksums |
1818148423007703b44015d97b403680b8ad6433ca63e8b14d99fada76c5bc78
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1
|
Release files / lndgrpc-0.2.0-py3-none-any.whl
| Download URL | lndgrpc-0.2.0-py3-none-any.whl |
|---|---|
| Size | 44.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
105da840da1d67f997906c47028d2f5bf0365991fca35b689108bb937ab31ad8
|
|
BLAKE2b-256 checksum How to use checksums |
4751e8b3972bdb3ad5adff44c30d994236ded8ba74de65b80adb80bcb7140940
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1
|
Security for lndgrpc 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.