2017-01-11 02:02:30 +03:00
|
|
|
lnrpc
|
|
|
|
=====
|
|
|
|
|
2017-03-28 02:25:25 +03:00
|
|
|
[![Build Status](http://img.shields.io/travis/lightningnetwork/lnd.svg)](https://travis-ci.org/lightningnetwork/lnd)
|
|
|
|
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/lightningnetwork/lnd/blob/master/LICENSE)
|
|
|
|
[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/lightningnetwork/lnd/lnrpc)
|
2017-01-11 02:02:30 +03:00
|
|
|
|
|
|
|
This lnrpc package implements both a client and server for `lnd`s RPC system
|
|
|
|
which is based off of the high-performance cross-platform
|
|
|
|
[gRPC](http://www.grpc.io/) RPC framework. By default, only the Go
|
|
|
|
client+server libraries are compiled within the package. In order to compile
|
|
|
|
the client side libraries for other supported languages, the `protoc` tool will
|
|
|
|
need to be used to generate the compiled protos for a specific language.
|
|
|
|
|
|
|
|
The following languages are supported as clients to `lnrpc`: C++, Go, Node.js,
|
|
|
|
Java, Ruby, Android Java, PHP, Python, C#, Objective-C.
|
|
|
|
|
|
|
|
The list of defined RPC's on the main service are the following (with a brief
|
|
|
|
description):
|
|
|
|
|
|
|
|
* WalletBalance
|
|
|
|
* Returns the wallet's current confirmed balance in BTC.
|
|
|
|
* ChannelBalance
|
|
|
|
* Returns the daemons' available aggregate channel balance in BTC.
|
|
|
|
* GetTransactions
|
|
|
|
* Returns a list of on-chain transactions that pay to or are spends from
|
|
|
|
`lnd`.
|
|
|
|
* SendCoins
|
2017-01-11 20:36:02 +03:00
|
|
|
* Sends an amount of satoshis to a specific address.
|
2017-01-11 02:02:30 +03:00
|
|
|
* SubscribeTransactions
|
|
|
|
* Returns a stream which sends async notifications each time a transaction
|
|
|
|
is created or one is received that pays to us.
|
|
|
|
* SendMany
|
|
|
|
* Allows the caller to create a transaction with an arbitrary fan-out
|
|
|
|
(many outputs).
|
|
|
|
* NewAddress
|
2017-01-11 20:36:02 +03:00
|
|
|
* Returns a new address, the following address types are supported:
|
2017-01-11 02:02:30 +03:00
|
|
|
pay-to-public-key-hash (p2pkh), pay-to-witness-key-hash (p2wkh), and
|
|
|
|
nested-pay-to-witness-key-hash (np2wkh).
|
2017-04-20 05:28:10 +03:00
|
|
|
* SignMessage
|
|
|
|
* Signs a message with the node's identity key and returns a
|
|
|
|
zbase32 encoded signature.
|
|
|
|
* VerifyMessage
|
|
|
|
* Verifies a signature signed by another node on a message. The other node
|
|
|
|
must be an active node in the channel database.
|
2017-01-11 02:02:30 +03:00
|
|
|
* ConnectPeer
|
|
|
|
* Connects to a peer identified by a public key and host.
|
2017-04-12 00:49:39 +03:00
|
|
|
* DisconnectPeer
|
|
|
|
* Disconnects a peer identified by a public key.
|
2017-01-11 02:02:30 +03:00
|
|
|
* ListPeers
|
|
|
|
* Lists all available connected peers.
|
|
|
|
* GetInfo
|
|
|
|
* Returns basic data concerning the daemon.
|
|
|
|
* PendingChannels
|
|
|
|
* List the number of pending (not fully confirmed) channels.
|
|
|
|
* ListChannels
|
|
|
|
* List all active channels the daemon manages.
|
|
|
|
* OpenChannel
|
|
|
|
* Attempts to open a channel to a target peer with a specific amount and
|
|
|
|
push amount.
|
2017-01-13 05:40:02 +03:00
|
|
|
* CloseChannel
|
|
|
|
* Attempts to close a target channel. A channel can either be closed
|
|
|
|
cooperatively if the channel peer is online, or using a "force" close to
|
|
|
|
broadcast the latest channel state.
|
2017-01-11 02:02:30 +03:00
|
|
|
* SendPayment
|
|
|
|
* Send a payment over Lightning to a target peer.
|
|
|
|
* AddInvoice
|
|
|
|
* Adds an invoice to the daemon. Invoices are automatically settled once
|
|
|
|
seen as an incoming HTLC.
|
|
|
|
* ListInvoices
|
|
|
|
* Lists all stored invoices.
|
|
|
|
* LookupInvoice
|
|
|
|
* Attempts to look up an invoice by payment hash (r-hash).
|
|
|
|
* SubscribeInvoices
|
|
|
|
* Creates a uni-directional stream which receives async notifications as
|
|
|
|
the daemon settles invoices
|
|
|
|
* ListPayments
|
|
|
|
* List all outgoing Lightning payments the daemon has made.
|
|
|
|
* DescribeGraph
|
|
|
|
* Returns a description of the known channel graph from the PoV of the
|
|
|
|
node.
|
|
|
|
* GetChanInfo
|
|
|
|
* Returns information for a specific channel identified by channel ID.
|
|
|
|
* GetNodeInfo
|
|
|
|
* Returns information for a particular node identified by its identity
|
|
|
|
public key.
|
|
|
|
* QueryRoute
|
|
|
|
* Queries for a possible route to a target peer which can carry a certain
|
|
|
|
amount of payment.
|
|
|
|
* GetNetworkInfo
|
|
|
|
* Returns some network level statistics.
|
|
|
|
* SetAlias
|
2017-01-11 20:36:02 +03:00
|
|
|
* Sets the node alias which is to be advertised on the network.
|
2017-01-11 02:02:30 +03:00
|
|
|
|
|
|
|
## Installation and Updating
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ go get -u github.com/lightningnetwork/lnd/lnrpc
|
|
|
|
```
|
2018-01-07 09:54:28 +03:00
|
|
|
|
|
|
|
## Generate protobuf definitions
|
|
|
|
|
|
|
|
1. Download [v.3.4.0](https://github.com/google/protobuf/releases/tag/v3.4.0) of
|
|
|
|
`protoc` for your operating system and add it to your `PATH`.
|
|
|
|
For example, if using macOS:
|
|
|
|
```bash
|
|
|
|
$ curl -LO https://github.com/google/protobuf/releases/download/v3.4.0/protoc-3.4.0-osx-x86_64.zip
|
|
|
|
$ unzip protoc-3.4.0-osx-x86_64.zip -d protoc
|
|
|
|
$ export PATH=$PWD/protoc/bin:$PATH
|
|
|
|
```
|
|
|
|
|
|
|
|
2. Install `golang/protobuf` at commit `ab9f9a6dab164b7d1246e0e688b0ab7b94d8553e`.
|
|
|
|
```bash
|
|
|
|
$ git clone https://github.com/golang/protobuf $GOPATH/src/github.com/golang/protobuf
|
|
|
|
$ cd $GOPATH/src/github.com/golang/protobuf
|
|
|
|
$ git reset --hard ab9f9a6dab164b7d1246e0e688b0ab7b94d8553e
|
|
|
|
$ make
|
|
|
|
```
|
|
|
|
|
|
|
|
3. Install `grpc-ecosystem/grpc-gateway` at commit `f2862b476edcef83412c7af8687c9cd8e4097c0f`.
|
|
|
|
```bash
|
|
|
|
$ git clone https://github.com/grpc-ecosystem/grpc-gateway $GOPATH/src/github.com/grpc-ecosystem/grpc-gateway
|
|
|
|
$ cd $GOPATH/src/github.com/grpc-ecosystem/grpc-gateway
|
|
|
|
$ git reset --hard f2862b476edcef83412c7af8687c9cd8e4097c0f
|
|
|
|
$ go install ./protoc-gen-grpc-gateway ./protoc-gen-swagger
|
|
|
|
```
|
|
|
|
|
|
|
|
4. Run `gen_protos.sh` to generate new protobuf definitions.
|