All Projects → adrienemery → Lnd Grpc Client

adrienemery / Lnd Grpc Client

Licence: mit
A python grpc client/async client for LND ⚡⚡⚡

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Lnd Grpc Client

Tonic
A native gRPC client & server implementation with async/await support.
Stars: ✭ 4,422 (+16907.69%)
Mutual labels:  grpc, rpc, async
Ln Service
Node.js interface to LND
Stars: ✭ 191 (+634.62%)
Mutual labels:  grpc, bitcoin, lightning-network
Umbrel
A personal Bitcoin and Lightning node designed for everyone
Stars: ✭ 508 (+1853.85%)
Mutual labels:  bitcoin, lightning-network
Lnd
Lightning Network Daemon ⚡️
Stars: ✭ 5,623 (+21526.92%)
Mutual labels:  bitcoin, lightning-network
Voltage
Voltage is a macOS GUI for c-lightning
Stars: ✭ 24 (-7.69%)
Mutual labels:  bitcoin, lightning-network
Rpc Benchmark
java rpc benchmark, 灵感源自 https://www.techempower.com/benchmarks/
Stars: ✭ 463 (+1680.77%)
Mutual labels:  grpc, rpc
Alibaba Rsocket Broker
Alibaba RSocket Broker: Mesh, Streaming & IoT
Stars: ✭ 485 (+1765.38%)
Mutual labels:  grpc, rpc
Libra Sdk Go
Go SDK for the Libra cryptocurrency
Stars: ✭ 23 (-11.54%)
Mutual labels:  grpc, rpc
Go Api Boilerplate
Go Server/API boilerplate using best practices DDD CQRS ES gRPC
Stars: ✭ 373 (+1334.62%)
Mutual labels:  grpc, rpc
Servicetalk
A networking framework that evolves with your application
Stars: ✭ 656 (+2423.08%)
Mutual labels:  grpc, rpc
Brpc Java
Java implementation for Baidu RPC, multi-protocol & high performance RPC.
Stars: ✭ 647 (+2388.46%)
Mutual labels:  grpc, rpc
Ws Promise Client
PROJECT MOVED: https://github.com/kdex/ws-promise
Stars: ✭ 6 (-76.92%)
Mutual labels:  rpc, async
Airframe
Essential Building Blocks for Scala
Stars: ✭ 442 (+1600%)
Mutual labels:  grpc, rpc
Javaspringbootsamples
SpringBoot、Dubbo、SpringCloud的各种集成例子:Atomikos、gRPC、Thrift、Seata、ShardingSphere、Dubbo、Hmily、Nacos、Consul、Ribbon、Jedis、Lettuce、Redisson等框架
Stars: ✭ 399 (+1434.62%)
Mutual labels:  grpc, rpc
Electrum
Electrum Bitcoin Wallet
Stars: ✭ 5,353 (+20488.46%)
Mutual labels:  bitcoin, lightning-network
Bitcoin Core
A modern Bitcoin Core REST and RPC client.
Stars: ✭ 379 (+1357.69%)
Mutual labels:  rpc, bitcoin
Neutrino
Privacy-Preserving Bitcoin Light Client
Stars: ✭ 564 (+2069.23%)
Mutual labels:  bitcoin, lightning-network
Rpc Thunderdome
A comparison between Proteus RPC and other commonly used RPC frameworks
Stars: ✭ 22 (-15.38%)
Mutual labels:  grpc, rpc
Mixin
🚀 the Mixin TEE-BFT-DAG network reference implementation
Stars: ✭ 351 (+1250%)
Mutual labels:  bitcoin, lightning-network
Akka Grpc
Akka gRPC
Stars: ✭ 361 (+1288.46%)
Mutual labels:  grpc, rpc

lndgrpc

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

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

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

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.

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)

lnd = LNDClient(admin=True)
lnd.add_invoice(2000)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].