Skip to main content

pool-grpc-client

A python grpc client for Lightning Pool (Lightning Network Daemon) ⚡⚡⚡

This is a wrapper around the default grpc interface that handles setting up credentials (including macaroons.

Dependencies

  • Python 3.6+
  • Working LND lightning node, take note of its ip address.
  • Copy your pool.macaroon and tls.cert files from ~/.pool/mainnet to a directoy on your machine.

Installation

pip install pool-grpc-client

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().

from pathlib import Path
import json
from poolgrpc.client import PoolClient

credential_path = Path("/home/skorn/.pool/mainnet/")

mac = str(credential_path.joinpath("pool.macaroon").absolute())
tls = str(credential_path.joinpath("tls.cert").absolute())

pool = PoolClient(
	macaroon_filepath=mac,
	cert_filepath=tls
)

pool.get_info()

pool.get_lsat_tokens()

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.

lnd = LNDClient(
    macaroon_filepath='~/.lnd/invoice.macaroon', 
    cert_filepath='path/to/tls.cert'
)

Compiling Proto Files

mkvirtualenv gen_rpc_protos
# or 
workon gen_rpc_protos
# then

pip install grpcio grpcio-tools googleapis-common-protos sh

cd poolgrpc
git clone --depth 1 https://github.com/googleapis/googleapis.git
cd ..

Set environment variables

export APP_DIR=$HOME/Documents/lightning/pool
export CLIENT_DIR=$HOME/Documents/lightning/pool-grpc-client
python3 rebuild_protos.py

Deploy to Test-PyPi

poetry build
twine check dist/*
twine upload --repository-url https://test.pypi.org/legacy/ dist/*

Metadata

Release files for pool-grpc-client 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pool-grpc-client 0.1.1
File Size Uploaded
pool-grpc-client-0.1.1.tar.gz 54.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pool-grpc-client 0.1.1
File Interpreter ABI Platform
pool_grpc_client-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 113.8 kB

Release files / pool-grpc-client-0.1.1.tar.gz

Download URL pool-grpc-client-0.1.1.tar.gz
Size 54.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f0060164f28960ee3d7eb037db38fcf56dd910372de21ef7bdef46c0a58905bd
BLAKE2b-256 checksum
How to use checksums
bc3347efd35900a8d8560e0311adf4976587a49a46e0ced84a5030faf77eac80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release files / pool_grpc_client-0.1.1-py3-none-any.whl

Download URL pool_grpc_client-0.1.1-py3-none-any.whl
Size 58.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d46c48501cdff22d759f034bb64e3403e4653d62bbe10dbc90ee6a484570601c
BLAKE2b-256 checksum
How to use checksums
37bae6b689da102cbefe1b3383224476f822ebdab32d0c0059a5716ecd31b291
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

1 release file

0.0.26

1 release file

0.0.25

1 release file

0.0.24

1 release file

0.0.23

1 release file

0.0.22

1 release file

0.0.21

1 release file

0.0.20

1 release file

0.0.19

1 release file

0.0.18

1 release file

0.0.17

1 release file

0.0.16

1 release file

0.0.12

1 release file

0.0.11

1 release file

0.0.10

1 release file

0.0.9

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page