Crates.io | voltage-tonic-lnd |
lib.rs | voltage-tonic-lnd |
version | 0.3.0 |
created_at | 2025-06-30 23:39:52.410824+00 |
updated_at | 2025-09-19 13:28:20.809145+00 |
description | An async library implementing LND RPC via tonic and prost. Forked from https://github.com/Kixunil/tonic_lnd |
homepage | https://github.com/voltagecloud/tonic_lnd |
repository | https://github.com/voltagecloud/tonic_lnd |
max_upload_size | |
id | 1732565 |
size | 538,831 |
Rust implementation of LND RPC client using async gRPC library tonic
.
Warning: this crate is in early development and may have unknown problems! Review it before using with mainnet funds!
This crate supports the following LND RPC APIs (from LND v0.19.1-beta):
This crate also supports Taproot Assets RPC APIs (from Taproot Assets v0.6.1):
This crate implements LND gRPC using tonic
and prost
, providing async usage and vendored *.proto
files (LND source not required by default). You can override the proto files at build time by setting the LND_REPO_DIR
environment variable, to test against unreleased LND features.
Each RPC API is behind a Cargo feature flag. All features are enabled by default, but you can select a subset for slimmer builds. See the [features]
section in Cargo.toml
for details. Example features:
LND Features:
lightningrpc
(core Lightning API)walletrpc
(WalletKit, depends on signrpc
)signrpc
(Signer)peersrpc
(Peers)routerrpc
(Router)invoicesrpc
(Invoices)staterpc
(State)versionrpc
(Versioner)lightning
(enables all LND RPCs)Taproot Assets Features:
taprpc
(core Taproot Assets API)assetwalletrpc
(asset wallet management)mintrpc
(asset minting)priceoraclerpc
(price oracle service)rfqrpc
(request for quote)tapchannelrpc
(Taproot Asset channels)tapdevrpc
(development tools)universerpc
(universe server)taprootassets
(enables all Taproot Assets RPCs)Meta Features:
all
(enables all LND and Taproot Assets RPCs)TLS Configuration:
ring
, aws-lc
tls-native-roots
, tls-webpki-roots
, tls
At least one TLS backend is required. ring
is currently used as the default.
See Cargo.toml
for the full list and combinations.
Since most of the LND RPCs supported by this crate can be used in isolation, and your project likely only needs a subset of these RPCs, we expose each RPC under Cargo feature gates. See the Cargo manifest for the latest supported features
All features are included by default, but you can explicitly select the features you want for a slimmer dependency and faster compilations.
Add the crate to your Cargo.toml
:
voltage-tonic-lnd = "0.1"
By default, all features are enabled. To customize, specify features:
voltage-tonic-lnd = { version = "0.1", default-features = false, features = ["lightningrpc", "routerrpc", "aws-lc", "tls-native-roots"] }
To use Taproot Assets features:
voltage-tonic-lnd = { version = "0.1", default-features = false, features = ["lightningrpc", "taprootassets", "ring", "tls-native-roots"] }
If you need to override the proto files, set the LND_REPO_DIR
environment variable to a directory with a cloned lnd
repo during build. For Taproot Assets proto files, set the TAPROOT_ASSETS_REPO_DIR
environment variable to a directory with a cloned taproot-assets
repo.
You can use the builder API for flexible connection:
#[tokio::main]
async fn main() -> voltage_tonic_lnd::Result<()> {
let client = voltage_tonic_lnd::Client::builder()
.address("https://localhost:10009")
.macaroon_path("/path/to/admin.macaroon")
.cert_path("/path/to/tls.cert")
.build()
.await?;
let info = client.lightning().get_info(voltage_tonic_lnd::lnrpc::GetInfoRequest {}).await?;
println!("{:#?}", info);
Ok(())
}
See more examples in the repo for advanced usage (router, invoices, payments, intercept HTLCs, etc).
let client = voltage_tonic_lnd::Client::builder()
.address("https://localhost:10009")
.macaroon_contents(hex_macaroon_string)
.cert_contents(pem_cert_string)
.build()
.await?;
1.75.0
MITNFA