Skip to main content

lncm/lnd-rpc

This repo aims to make grpc communication with (any version of) lnd trivial.

Currently Go, and Python are supported.

Go

While lnd natively provides .go files for grpc communication, importing the entirety of lnd sometimes causes issues with dependencies (ex. the infamous btcd), etc. We aim to solve it by having zero/minimal dependencies, and providing direct access to each version individually.

tl;dr: Just use ex. github.com/lncm/lnd-rpc/v0.9.0/invicesrpc in your source

Python

This repo also holds the source (and scrips necessary to generate) the contents of lnd-rpc PyPI package. To use it install the version of the version you want to use, and

tl;dr

This repo helps with:

  1. download - download all lnd .proto's, and their dependencies
  2. generate-go - generate .go sources for available .proto files
  3. generate-python - generate .py sources for available .proto files

Each of these can be done in two ways:

  1. Run the script directly
  2. Via docker run

Download

./script/download downloads all .proto files, and all their dependencies unless a specific version is provided.

Run directly

./scripts/download --help
download v1.0.0

Download all .proto files necessary to build lnd's gRPC client libraries

Usage: ./scripts/download [options] LND_VERSION

Where LND_VERSION is in a form: [v]MAJOR.MINOR.PATCH (ex: v0.9.0), or "all" to download all versions

Options:

  -h, --help, help      Show this help message
  -G, --no-google       Skip download of google/api/* and google/protobuf/*
  -S, --strip-version   Don't include lnd version in the path (only works if LND_VERSION != "all")
  -o, --output          Download to a specified dir (will be created, if doesn't exist)

Examples:

  ./scripts/download  all                          # Download all lnd versions, and all google/* protos
  ./scripts/download  --no-google  v0.4.2          # Only download protos for lnd v0.4.2, and no google/* protos
  ./scripts/download  -G -S -o=~/last-lnd/ v0.9.0  # Only download protos for lnd v0.9.0, and save them to last-lnd/
                                                   #    in user's HOME directory w/o the /LND_VERSION/ segment in path

github: github.com/lncm/lnd-rpc/

Docker

NOTE: this one requires DOCKER_BUILDKIT=1 due to usage of --target=

# Build with:
DOCKER_BUILDKIT=1  docker build . \
    --target=protos-downloader
    --tag=lnd-rpc-downloader

# Run with:
docker run --rm -it \
    --volume=$(pwd)/:/protos/ \
    lnd-rpc-downloader # [VERSION|all] 

Generate Go

./scripts/generate-go generates .go files for all available versions, unless a specific version is provided.

Run directly

./scripts/generate-go --help
generate-go v1.0.0

Compile all .proto definitions into importable .go files

Usage: generate-go [options] LND_VERSION

Where LND_VERSION is in a form: [v]MAJOR.MINOR.PATCH (ex: v0.9.0), or "all" to generate for all versions

Options:

  -h, --help, help      Show this help message
  -S, --strip-version   Don't include lnd version in the path (only works if LND_VERSION != "all")
  -o, --output          Save generated files to a specified dir (created, if doesn't exist)

Examples:

  ./generate-go all
  ./generate-go  -o /tmp/last/  v0.9.0

github: github.com/lncm/lnd-rpc/

Docker

docker build . \
    --build-arg="LANG=go" \
    --tag=lnd-rpc-go

docker run --rm -it \
    --volume=$(pwd):/data/go/ \
    lnd-rpc-go  # [VERSION|all]

Generate Python

./scripts/generate-python generates .py files for all available versions, unless a specific version is provided.

NOTE: All generated versions are published to PyPi using this workflow

Run directly

./scripts/generate-python --help
generate-python v1.0.0

Compile all .proto definitions into .py files

Usage: generate-python [options] LND_VERSION

Where LND_VERSION is in a form: [v]MAJOR.MINOR.PATCH (ex: v0.9.0), or "all" to generate for all versions

Options:

  -h, --help, help      Show this help message
  -S, --strip-version   Don't include lnd version in the path (only works if LND_VERSION != "all")
  -o, --output          Save generated files to a specified dir (created, if doesn't exist)

Examples:

  ./generate-python all
  ./generate-python  -o /tmp/last/  v0.9.0

github: github.com/lncm/lnd-rpc/

Docker

docker build . \
    --build-arg="LANG=python" \
    --tag=lnd-rpc-python

docker run --rm -it \
    --volume=$(pwd):/data/python/ \
    lnd-rpc-python  # [VERSION|all]

Metadata

Release files for lnd-rpc 0.9.0.post4

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

Source distribution (sdist)

Source distribution for lnd-rpc 0.9.0.post4
File Size Uploaded
lnd-rpc-0.9.0.post4.tar.gz 83.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lnd-rpc 0.9.0.post4
File Interpreter ABI Platform
lnd_rpc-0.9.0.post4-py3-none-any.whl Python 3 none any Details

Total release size: 144.4 kB

Release files / lnd-rpc-0.9.0.post4.tar.gz

Download URL lnd-rpc-0.9.0.post4.tar.gz
Size 83.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b73f5e3a7dd830c4a4ce5e20181d332e5efa79992e8228d45f1e559054d320f3
BLAKE2b-256 checksum
How to use checksums
f5fba27d14f5f001e53e1a58ec238d4f05a7cd59a420978a0d342c60179ea983
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.1

Release files / lnd_rpc-0.9.0.post4-py3-none-any.whl

Download URL lnd_rpc-0.9.0.post4-py3-none-any.whl
Size 61.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ec5f708532e5bb111af7e3483e6f12826a74728d231878ece7f26e61176e3c71
BLAKE2b-256 checksum
How to use checksums
f42da4c4cf173cf157f152d4f8cd74ffc852922dfc5a97d62814bd89c6cdbadb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.1

Release history Release notifications | RSS feed

This release

0.9.0.post4 This release

2 release files

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