lightning_network 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/lightning_network.rb +9 -0
- data/lib/lnd.rb +49 -0
- data/lib/macaroon_interceptor.rb +15 -0
- data/lib/node.rb +202 -0
- data/lib/rpc.proto +1828 -0
- data/lib/rpc_pb.rb +701 -0
- data/lib/rpc_services_pb.rb +290 -0
- metadata +78 -0
@@ -0,0 +1,290 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: rpc.proto for package 'lnrpc'
|
3
|
+
|
4
|
+
require 'grpc'
|
5
|
+
require_relative 'rpc_pb'
|
6
|
+
|
7
|
+
module Lnrpc
|
8
|
+
module WalletUnlocker
|
9
|
+
# The WalletUnlocker service is used to set up a wallet password for
|
10
|
+
# lnd at first startup, and unlock a previously set up wallet.
|
11
|
+
class Service
|
12
|
+
|
13
|
+
include GRPC::GenericService
|
14
|
+
|
15
|
+
self.marshal_class_method = :encode
|
16
|
+
self.unmarshal_class_method = :decode
|
17
|
+
self.service_name = 'lnrpc.WalletUnlocker'
|
18
|
+
|
19
|
+
# *
|
20
|
+
# GenSeed is the first method that should be used to instantiate a new lnd
|
21
|
+
# instance. This method allows a caller to generate a new aezeed cipher seed
|
22
|
+
# given an optional passphrase. If provided, the passphrase will be necessary
|
23
|
+
# to decrypt the cipherseed to expose the internal wallet seed.
|
24
|
+
#
|
25
|
+
# Once the cipherseed is obtained and verified by the user, the InitWallet
|
26
|
+
# method should be used to commit the newly generated seed, and create the
|
27
|
+
# wallet.
|
28
|
+
rpc :GenSeed, GenSeedRequest, GenSeedResponse
|
29
|
+
# *
|
30
|
+
# InitWallet is used when lnd is starting up for the first time to fully
|
31
|
+
# initialize the daemon and its internal wallet. At the very least a wallet
|
32
|
+
# password must be provided. This will be used to encrypt sensitive material
|
33
|
+
# on disk.
|
34
|
+
#
|
35
|
+
# In the case of a recovery scenario, the user can also specify their aezeed
|
36
|
+
# mnemonic and passphrase. If set, then the daemon will use this prior state
|
37
|
+
# to initialize its internal wallet.
|
38
|
+
#
|
39
|
+
# Alternatively, this can be used along with the GenSeed RPC to obtain a
|
40
|
+
# seed, then present it to the user. Once it has been verified by the user,
|
41
|
+
# the seed can be fed into this RPC in order to commit the new wallet.
|
42
|
+
rpc :InitWallet, InitWalletRequest, InitWalletResponse
|
43
|
+
# * lncli: `unlock`
|
44
|
+
# UnlockWallet is used at startup of lnd to provide a password to unlock
|
45
|
+
# the wallet database.
|
46
|
+
rpc :UnlockWallet, UnlockWalletRequest, UnlockWalletResponse
|
47
|
+
# * lncli: `changepassword`
|
48
|
+
# ChangePassword changes the password of the encrypted wallet. This will
|
49
|
+
# automatically unlock the wallet database if successful.
|
50
|
+
rpc :ChangePassword, ChangePasswordRequest, ChangePasswordResponse
|
51
|
+
end
|
52
|
+
|
53
|
+
Stub = Service.rpc_stub_class
|
54
|
+
end
|
55
|
+
module Lightning
|
56
|
+
class Service
|
57
|
+
|
58
|
+
include GRPC::GenericService
|
59
|
+
|
60
|
+
self.marshal_class_method = :encode
|
61
|
+
self.unmarshal_class_method = :decode
|
62
|
+
self.service_name = 'lnrpc.Lightning'
|
63
|
+
|
64
|
+
# * lncli: `walletbalance`
|
65
|
+
# WalletBalance returns total unspent outputs(confirmed and unconfirmed), all
|
66
|
+
# confirmed unspent outputs and all unconfirmed unspent outputs under control
|
67
|
+
# of the wallet.
|
68
|
+
rpc :WalletBalance, WalletBalanceRequest, WalletBalanceResponse
|
69
|
+
# * lncli: `channelbalance`
|
70
|
+
# ChannelBalance returns the total funds available across all open channels
|
71
|
+
# in satoshis.
|
72
|
+
rpc :ChannelBalance, ChannelBalanceRequest, ChannelBalanceResponse
|
73
|
+
# * lncli: `listchaintxns`
|
74
|
+
# GetTransactions returns a list describing all the known transactions
|
75
|
+
# relevant to the wallet.
|
76
|
+
rpc :GetTransactions, GetTransactionsRequest, TransactionDetails
|
77
|
+
# * lncli: `sendcoins`
|
78
|
+
# SendCoins executes a request to send coins to a particular address. Unlike
|
79
|
+
# SendMany, this RPC call only allows creating a single output at a time. If
|
80
|
+
# neither target_conf, or sat_per_byte are set, then the internal wallet will
|
81
|
+
# consult its fee model to determine a fee for the default confirmation
|
82
|
+
# target.
|
83
|
+
rpc :SendCoins, SendCoinsRequest, SendCoinsResponse
|
84
|
+
# *
|
85
|
+
# SubscribeTransactions creates a uni-directional stream from the server to
|
86
|
+
# the client in which any newly discovered transactions relevant to the
|
87
|
+
# wallet are sent over.
|
88
|
+
rpc :SubscribeTransactions, GetTransactionsRequest, stream(Transaction)
|
89
|
+
# * lncli: `sendmany`
|
90
|
+
# SendMany handles a request for a transaction that creates multiple specified
|
91
|
+
# outputs in parallel. If neither target_conf, or sat_per_byte are set, then
|
92
|
+
# the internal wallet will consult its fee model to determine a fee for the
|
93
|
+
# default confirmation target.
|
94
|
+
rpc :SendMany, SendManyRequest, SendManyResponse
|
95
|
+
# * lncli: `newaddress`
|
96
|
+
# NewAddress creates a new address under control of the local wallet.
|
97
|
+
rpc :NewAddress, NewAddressRequest, NewAddressResponse
|
98
|
+
# *
|
99
|
+
# NewWitnessAddress creates a new witness address under control of the local wallet.
|
100
|
+
rpc :NewWitnessAddress, NewWitnessAddressRequest, NewAddressResponse
|
101
|
+
# * lncli: `signmessage`
|
102
|
+
# SignMessage signs a message with this node's private key. The returned
|
103
|
+
# signature string is `zbase32` encoded and pubkey recoverable, meaning that
|
104
|
+
# only the message digest and signature are needed for verification.
|
105
|
+
rpc :SignMessage, SignMessageRequest, SignMessageResponse
|
106
|
+
# * lncli: `verifymessage`
|
107
|
+
# VerifyMessage verifies a signature over a msg. The signature must be
|
108
|
+
# zbase32 encoded and signed by an active node in the resident node's
|
109
|
+
# channel database. In addition to returning the validity of the signature,
|
110
|
+
# VerifyMessage also returns the recovered pubkey from the signature.
|
111
|
+
rpc :VerifyMessage, VerifyMessageRequest, VerifyMessageResponse
|
112
|
+
# * lncli: `connect`
|
113
|
+
# ConnectPeer attempts to establish a connection to a remote peer. This is at
|
114
|
+
# the networking level, and is used for communication between nodes. This is
|
115
|
+
# distinct from establishing a channel with a peer.
|
116
|
+
rpc :ConnectPeer, ConnectPeerRequest, ConnectPeerResponse
|
117
|
+
# * lncli: `disconnect`
|
118
|
+
# DisconnectPeer attempts to disconnect one peer from another identified by a
|
119
|
+
# given pubKey. In the case that we currently have a pending or active channel
|
120
|
+
# with the target peer, then this action will be not be allowed.
|
121
|
+
rpc :DisconnectPeer, DisconnectPeerRequest, DisconnectPeerResponse
|
122
|
+
# * lncli: `listpeers`
|
123
|
+
# ListPeers returns a verbose listing of all currently active peers.
|
124
|
+
rpc :ListPeers, ListPeersRequest, ListPeersResponse
|
125
|
+
# * lncli: `getinfo`
|
126
|
+
# GetInfo returns general information concerning the lightning node including
|
127
|
+
# it's identity pubkey, alias, the chains it is connected to, and information
|
128
|
+
# concerning the number of open+pending channels.
|
129
|
+
rpc :GetInfo, GetInfoRequest, GetInfoResponse
|
130
|
+
# TODO(roasbeef): merge with below with bool?
|
131
|
+
#
|
132
|
+
# * lncli: `pendingchannels`
|
133
|
+
# PendingChannels returns a list of all the channels that are currently
|
134
|
+
# considered "pending". A channel is pending if it has finished the funding
|
135
|
+
# workflow and is waiting for confirmations for the funding txn, or is in the
|
136
|
+
# process of closure, either initiated cooperatively or non-cooperatively.
|
137
|
+
rpc :PendingChannels, PendingChannelsRequest, PendingChannelsResponse
|
138
|
+
# * lncli: `listchannels`
|
139
|
+
# ListChannels returns a description of all the open channels that this node
|
140
|
+
# is a participant in.
|
141
|
+
rpc :ListChannels, ListChannelsRequest, ListChannelsResponse
|
142
|
+
# * lncli: `closedchannels`
|
143
|
+
# ClosedChannels returns a description of all the closed channels that
|
144
|
+
# this node was a participant in.
|
145
|
+
rpc :ClosedChannels, ClosedChannelsRequest, ClosedChannelsResponse
|
146
|
+
# *
|
147
|
+
# OpenChannelSync is a synchronous version of the OpenChannel RPC call. This
|
148
|
+
# call is meant to be consumed by clients to the REST proxy. As with all
|
149
|
+
# other sync calls, all byte slices are intended to be populated as hex
|
150
|
+
# encoded strings.
|
151
|
+
rpc :OpenChannelSync, OpenChannelRequest, ChannelPoint
|
152
|
+
# * lncli: `openchannel`
|
153
|
+
# OpenChannel attempts to open a singly funded channel specified in the
|
154
|
+
# request to a remote peer. Users are able to specify a target number of
|
155
|
+
# blocks that the funding transaction should be confirmed in, or a manual fee
|
156
|
+
# rate to us for the funding transaction. If neither are specified, then a
|
157
|
+
# lax block confirmation target is used.
|
158
|
+
rpc :OpenChannel, OpenChannelRequest, stream(OpenStatusUpdate)
|
159
|
+
# * lncli: `closechannel`
|
160
|
+
# CloseChannel attempts to close an active channel identified by its channel
|
161
|
+
# outpoint (ChannelPoint). The actions of this method can additionally be
|
162
|
+
# augmented to attempt a force close after a timeout period in the case of an
|
163
|
+
# inactive peer. If a non-force close (cooperative closure) is requested,
|
164
|
+
# then the user can specify either a target number of blocks until the
|
165
|
+
# closure transaction is confirmed, or a manual fee rate. If neither are
|
166
|
+
# specified, then a default lax, block confirmation target is used.
|
167
|
+
rpc :CloseChannel, CloseChannelRequest, stream(CloseStatusUpdate)
|
168
|
+
# * lncli: `sendpayment`
|
169
|
+
# SendPayment dispatches a bi-directional streaming RPC for sending payments
|
170
|
+
# through the Lightning Network. A single RPC invocation creates a persistent
|
171
|
+
# bi-directional stream allowing clients to rapidly send payments through the
|
172
|
+
# Lightning Network with a single persistent connection.
|
173
|
+
rpc :SendPayment, stream(SendRequest), stream(SendResponse)
|
174
|
+
# *
|
175
|
+
# SendPaymentSync is the synchronous non-streaming version of SendPayment.
|
176
|
+
# This RPC is intended to be consumed by clients of the REST proxy.
|
177
|
+
# Additionally, this RPC expects the destination's public key and the payment
|
178
|
+
# hash (if any) to be encoded as hex strings.
|
179
|
+
rpc :SendPaymentSync, SendRequest, SendResponse
|
180
|
+
# * lncli: `sendtoroute`
|
181
|
+
# SendToRoute is a bi-directional streaming RPC for sending payment through
|
182
|
+
# the Lightning Network. This method differs from SendPayment in that it
|
183
|
+
# allows users to specify a full route manually. This can be used for things
|
184
|
+
# like rebalancing, and atomic swaps.
|
185
|
+
rpc :SendToRoute, stream(SendToRouteRequest), stream(SendResponse)
|
186
|
+
# *
|
187
|
+
# SendToRouteSync is a synchronous version of SendToRoute. It Will block
|
188
|
+
# until the payment either fails or succeeds.
|
189
|
+
rpc :SendToRouteSync, SendToRouteRequest, SendResponse
|
190
|
+
# * lncli: `addinvoice`
|
191
|
+
# AddInvoice attempts to add a new invoice to the invoice database. Any
|
192
|
+
# duplicated invoices are rejected, therefore all invoices *must* have a
|
193
|
+
# unique payment preimage.
|
194
|
+
rpc :AddInvoice, Invoice, AddInvoiceResponse
|
195
|
+
# * lncli: `listinvoices`
|
196
|
+
# ListInvoices returns a list of all the invoices currently stored within the
|
197
|
+
# database. Any active debug invoices are ignored.
|
198
|
+
rpc :ListInvoices, ListInvoiceRequest, ListInvoiceResponse
|
199
|
+
# * lncli: `lookupinvoice`
|
200
|
+
# LookupInvoice attempts to look up an invoice according to its payment hash.
|
201
|
+
# The passed payment hash *must* be exactly 32 bytes, if not, an error is
|
202
|
+
# returned.
|
203
|
+
rpc :LookupInvoice, PaymentHash, Invoice
|
204
|
+
# *
|
205
|
+
# SubscribeInvoices returns a uni-directional stream (sever -> client) for
|
206
|
+
# notifying the client of newly added/settled invoices.
|
207
|
+
rpc :SubscribeInvoices, InvoiceSubscription, stream(Invoice)
|
208
|
+
# * lncli: `decodepayreq`
|
209
|
+
# DecodePayReq takes an encoded payment request string and attempts to decode
|
210
|
+
# it, returning a full description of the conditions encoded within the
|
211
|
+
# payment request.
|
212
|
+
rpc :DecodePayReq, PayReqString, PayReq
|
213
|
+
# * lncli: `listpayments`
|
214
|
+
# ListPayments returns a list of all outgoing payments.
|
215
|
+
rpc :ListPayments, ListPaymentsRequest, ListPaymentsResponse
|
216
|
+
# *
|
217
|
+
# DeleteAllPayments deletes all outgoing payments from DB.
|
218
|
+
rpc :DeleteAllPayments, DeleteAllPaymentsRequest, DeleteAllPaymentsResponse
|
219
|
+
# * lncli: `describegraph`
|
220
|
+
# DescribeGraph returns a description of the latest graph state from the
|
221
|
+
# point of view of the node. The graph information is partitioned into two
|
222
|
+
# components: all the nodes/vertexes, and all the edges that connect the
|
223
|
+
# vertexes themselves. As this is a directed graph, the edges also contain
|
224
|
+
# the node directional specific routing policy which includes: the time lock
|
225
|
+
# delta, fee information, etc.
|
226
|
+
rpc :DescribeGraph, ChannelGraphRequest, ChannelGraph
|
227
|
+
# * lncli: `getchaninfo`
|
228
|
+
# GetChanInfo returns the latest authenticated network announcement for the
|
229
|
+
# given channel identified by its channel ID: an 8-byte integer which
|
230
|
+
# uniquely identifies the location of transaction's funding output within the
|
231
|
+
# blockchain.
|
232
|
+
rpc :GetChanInfo, ChanInfoRequest, ChannelEdge
|
233
|
+
# * lncli: `getnodeinfo`
|
234
|
+
# GetNodeInfo returns the latest advertised, aggregated, and authenticated
|
235
|
+
# channel information for the specified node identified by its public key.
|
236
|
+
rpc :GetNodeInfo, NodeInfoRequest, NodeInfo
|
237
|
+
# * lncli: `queryroutes`
|
238
|
+
# QueryRoutes attempts to query the daemon's Channel Router for a possible
|
239
|
+
# route to a target destination capable of carrying a specific amount of
|
240
|
+
# satoshis. The retuned route contains the full details required to craft and
|
241
|
+
# send an HTLC, also including the necessary information that should be
|
242
|
+
# present within the Sphinx packet encapsulated within the HTLC.
|
243
|
+
rpc :QueryRoutes, QueryRoutesRequest, QueryRoutesResponse
|
244
|
+
# * lncli: `getnetworkinfo`
|
245
|
+
# GetNetworkInfo returns some basic stats about the known channel graph from
|
246
|
+
# the point of view of the node.
|
247
|
+
rpc :GetNetworkInfo, NetworkInfoRequest, NetworkInfo
|
248
|
+
# * lncli: `stop`
|
249
|
+
# StopDaemon will send a shutdown request to the interrupt handler, triggering
|
250
|
+
# a graceful shutdown of the daemon.
|
251
|
+
rpc :StopDaemon, StopRequest, StopResponse
|
252
|
+
# *
|
253
|
+
# SubscribeChannelGraph launches a streaming RPC that allows the caller to
|
254
|
+
# receive notifications upon any changes to the channel graph topology from
|
255
|
+
# the point of view of the responding node. Events notified include: new
|
256
|
+
# nodes coming online, nodes updating their authenticated attributes, new
|
257
|
+
# channels being advertised, updates in the routing policy for a directional
|
258
|
+
# channel edge, and when channels are closed on-chain.
|
259
|
+
rpc :SubscribeChannelGraph, GraphTopologySubscription, stream(GraphTopologyUpdate)
|
260
|
+
# * lncli: `debuglevel`
|
261
|
+
# DebugLevel allows a caller to programmatically set the logging verbosity of
|
262
|
+
# lnd. The logging can be targeted according to a coarse daemon-wide logging
|
263
|
+
# level, or in a granular fashion to specify the logging for a target
|
264
|
+
# sub-system.
|
265
|
+
rpc :DebugLevel, DebugLevelRequest, DebugLevelResponse
|
266
|
+
# * lncli: `feereport`
|
267
|
+
# FeeReport allows the caller to obtain a report detailing the current fee
|
268
|
+
# schedule enforced by the node globally for each channel.
|
269
|
+
rpc :FeeReport, FeeReportRequest, FeeReportResponse
|
270
|
+
# * lncli: `updatechanpolicy`
|
271
|
+
# UpdateChannelPolicy allows the caller to update the fee schedule and
|
272
|
+
# channel policies for all channels globally, or a particular channel.
|
273
|
+
rpc :UpdateChannelPolicy, PolicyUpdateRequest, PolicyUpdateResponse
|
274
|
+
# * lncli: `fwdinghistory`
|
275
|
+
# ForwardingHistory allows the caller to query the htlcswitch for a record of
|
276
|
+
# all HTLC's forwarded within the target time range, and integer offset
|
277
|
+
# within that time range. If no time-range is specified, then the first chunk
|
278
|
+
# of the past 24 hrs of forwarding history are returned.
|
279
|
+
#
|
280
|
+
# A list of forwarding events are returned. The size of each forwarding event
|
281
|
+
# is 40 bytes, and the max message size able to be returned in gRPC is 4 MiB.
|
282
|
+
# As a result each message can only contain 50k entries. Each response has
|
283
|
+
# the index offset of the last entry. The index offset can be provided to the
|
284
|
+
# request to allow the caller to skip a series of records.
|
285
|
+
rpc :ForwardingHistory, ForwardingHistoryRequest, ForwardingHistoryResponse
|
286
|
+
end
|
287
|
+
|
288
|
+
Stub = Service.rpc_stub_class
|
289
|
+
end
|
290
|
+
end
|
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lightning_network
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ivan Acosta-Rubio
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-02-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: grpc
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.12.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.12.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: grpc-tools
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.12.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.12.0
|
41
|
+
description: 'Connect to the Lightning Network with Ruby. '
|
42
|
+
email: 12wordscapital@protonmail.com
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- "./lib/lightning_network.rb"
|
48
|
+
- "./lib/lnd.rb"
|
49
|
+
- "./lib/macaroon_interceptor.rb"
|
50
|
+
- "./lib/node.rb"
|
51
|
+
- "./lib/rpc.proto"
|
52
|
+
- "./lib/rpc_pb.rb"
|
53
|
+
- "./lib/rpc_services_pb.rb"
|
54
|
+
homepage: https://github.com/ivanacostarubio/lightning_network
|
55
|
+
licenses:
|
56
|
+
- MIT
|
57
|
+
metadata: {}
|
58
|
+
post_install_message:
|
59
|
+
rdoc_options: []
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
requirements: []
|
73
|
+
rubyforge_project:
|
74
|
+
rubygems_version: 2.6.11
|
75
|
+
signing_key:
|
76
|
+
specification_version: 4
|
77
|
+
summary: Lightning Network
|
78
|
+
test_files: []
|