lnd_ruby_sdk 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,16 @@
1
+ # Namespace for classes and modules that handle communication with your LND node
2
+ module Lightning
3
+ class << self
4
+ # Returns general information concerning the lightning node
5
+ # including it's identity pubkey, alias, the chains it is connected
6
+ # to, and information concerning the number of open+pending channels.
7
+ #
8
+ # @example Receive node info
9
+ # Lightning.getinfo
10
+ #
11
+ # @return [Lnrpc::GetInfoResponse]
12
+ def getinfo
13
+ stub.get_info(Lnrpc::GetInfoRequest.new)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,62 @@
1
+ # Namespace for classes and modules that handle communication with your LND node
2
+ module Lightning
3
+ # When this module is included in another class, we have access to the
4
+ # pre-generated stub (client) and can use it to communicate with the
5
+ # gRPC api.
6
+ # @since 0.1.0
7
+ class << self
8
+ private
9
+
10
+ # On the client side, the client has a local object known as stub
11
+ # (for other languages, the preferred term is client) that implements
12
+ # the same methods as the service. The client can then just call those
13
+ # methods on the local object, wrapping the parameters for the call in
14
+ # the appropriate protocol buffer message type - gRPC looks after sending
15
+ # the request(s) to the server and returning the server's protocol buffer
16
+ # response(s). Read more about stubs at: http://tiny.cc/nwuc5y. We're using
17
+ # a pre-generated stub created with inspiration from the tutorial at:
18
+ # https://github.com/lightningnetwork/lnd/blob/master/docs/grpc/ruby.md
19
+ # @since 0.1.0
20
+ # @return [Lnrpc::Lightning::Stub]
21
+ def stub
22
+ Lnrpc::Lightning::Stub.new(
23
+ '127.0.0.1:10009',
24
+ credentials,
25
+ interceptors: [MacaroonInterceptor.new(macaroon)]
26
+ )
27
+ end
28
+
29
+ # Macaroon files works like cookies and are used to authenticate with
30
+ # LND gRPC. By default, when lnd starts, it creates three files which
31
+ # contain macaroons: a file called admin.macaroon, which contains a
32
+ # macaroon with no caveats, a file called readonly.macaroon, which is
33
+ # the same macaroon but with an additional caveat, that permits only
34
+ # methods that don't change the state of lnd, and invoice.macaroon,
35
+ # which only has access to invoice related methods. You can learn more
36
+ # about LND macaroons at: http://tiny.cc/1nuc5y
37
+ # @since 0.1.0
38
+ # @return [Binary]
39
+ def macaroon
40
+ macaroon_binary = File.read(
41
+ File.expand_path(config[:macaroon_path])
42
+ )
43
+
44
+ macaroon_binary.each_byte.map { |b| b.to_s(16).rjust(2, '0') }.join
45
+ end
46
+
47
+ # Get SSL credentials from the tls.cert file generated by
48
+ # LND. This file is normally generated by LND and will be
49
+ # created by default at ~/.lnd/tls.cert on the server running
50
+ # your LND node. We will use it to establish a secured connection
51
+ # between your app and the node/server.
52
+ # @since 0.1.0
53
+ # @return [GRPC::Core::ChannelCredentials]
54
+ def credentials
55
+ ENV['GRPC_SSL_CIPHER_SUITES'] =
56
+ ENV['GRPC_SSL_CIPHER_SUITES'] || 'HIGH+ECDSA'
57
+
58
+ certificate = File.read(File.expand_path(config[:certificate_path]))
59
+ GRPC::Core::ChannelCredentials.new(certificate)
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,5 @@
1
+ # Namespace for classes and modules that handle communication with your LND node
2
+ module Lightning
3
+ # Current SDK version number.
4
+ VERSION = '0.1.0'.freeze
5
+ end
@@ -0,0 +1,24 @@
1
+ require 'grpc'
2
+ require 'rpc_services_pb'
3
+ require 'macaroon_interceptor.rb'
4
+ require 'json'
5
+ require 'ostruct'
6
+
7
+ require 'lightning/version'
8
+ require 'lightning/stub'
9
+ require 'lightning/node'
10
+ require 'lightning/invoices'
11
+
12
+ # Namespace for classes and modules that handle communication with your LND node
13
+ module Lightning
14
+ class << self
15
+ attr_accessor :config
16
+ end
17
+
18
+ # Basic configuration variables that can be changed from
19
+ # outside the module.
20
+ self.config = {
21
+ macaroon_path: '~/.lnd/data/chain/bitcoin/mainnet/admin.macaroon',
22
+ certificate_path: '~/.lnd/tls.cert'
23
+ }
24
+ end
@@ -0,0 +1,34 @@
1
+ lib = File.expand_path('lib', __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'lightning/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'lnd_ruby_sdk'
7
+ spec.version = Lightning::VERSION
8
+ spec.authors = ['Rasmus']
9
+ spec.email = ['rk@youngmedia.se']
10
+
11
+ spec.summary = 'A SDK for communicating with LND\'s gRPC in Ruby'
12
+ spec.homepage = 'https://github.com/lnpay'
13
+ spec.license = 'MIT'
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
16
+ f.match(%r{^(test|spec|features)/})
17
+ end
18
+
19
+ #spec.bindir = 'exe'
20
+ #spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ['lib', 'vendor']
22
+
23
+ spec.add_dependency 'grpc', '~> 1.20', '>= 1.20.0'
24
+
25
+ # use "yard" to build full HTML docs.
26
+ spec.metadata["yard.run"] = "yri"
27
+
28
+ spec.add_development_dependency 'bundler', '~> 1.16'
29
+ spec.add_development_dependency 'rake', '~> 10.0'
30
+ spec.add_development_dependency 'rspec', '~> 3.0'
31
+ spec.add_development_dependency 'rubocop', '~> 0.67.2'
32
+ spec.add_development_dependency 'rubocop-performance', '~> 1.1', '>= 1.1.0'
33
+ spec.add_development_dependency 'yard', '~> 0.9', '>= 0.9.11'
34
+ end
@@ -0,0 +1,10 @@
1
+ {
2
+ "systemParams": "darwin-x64-57",
3
+ "modulesFolders": [],
4
+ "flags": [],
5
+ "linkedModules": [],
6
+ "topLevelPatterns": [],
7
+ "lockfileEntries": {},
8
+ "files": [],
9
+ "artifacts": {}
10
+ }
@@ -0,0 +1,18 @@
1
+ class MacaroonInterceptor < GRPC::ClientInterceptor
2
+ attr_reader :macaroon
3
+
4
+ def initialize(macaroon)
5
+ @macaroon = macaroon
6
+ super
7
+ end
8
+
9
+ def request_response(request:, call:, method:, metadata:)
10
+ metadata['macaroon'] = macaroon
11
+ yield
12
+ end
13
+
14
+ def server_streamer(request:, call:, method:, metadata:)
15
+ metadata['macaroon'] = macaroon
16
+ yield
17
+ end
18
+ end
@@ -0,0 +1,2367 @@
1
+ syntax = "proto3";
2
+
3
+ import "google/api/annotations.proto";
4
+
5
+ package lnrpc;
6
+
7
+ option go_package = "github.com/lightningnetwork/lnd/lnrpc";
8
+
9
+ /**
10
+ * Comments in this file will be directly parsed into the API
11
+ * Documentation as descriptions of the associated method, message, or field.
12
+ * These descriptions should go right above the definition of the object, and
13
+ * can be in either block or /// comment format.
14
+ *
15
+ * One edge case exists where a // comment followed by a /// comment in the
16
+ * next line will cause the description not to show up in the documentation. In
17
+ * that instance, simply separate the two comments with a blank line.
18
+ *
19
+ * An RPC method can be matched to an lncli command by placing a line in the
20
+ * beginning of the description in exactly the following format:
21
+ * lncli: `methodname`
22
+ *
23
+ * Failure to specify the exact name of the command will cause documentation
24
+ * generation to fail.
25
+ *
26
+ * More information on how exactly the gRPC documentation is generated from
27
+ * this proto file can be found here:
28
+ * https://github.com/lightninglabs/lightning-api
29
+ */
30
+
31
+ // The WalletUnlocker service is used to set up a wallet password for
32
+ // lnd at first startup, and unlock a previously set up wallet.
33
+ service WalletUnlocker {
34
+ /**
35
+ GenSeed is the first method that should be used to instantiate a new lnd
36
+ instance. This method allows a caller to generate a new aezeed cipher seed
37
+ given an optional passphrase. If provided, the passphrase will be necessary
38
+ to decrypt the cipherseed to expose the internal wallet seed.
39
+
40
+ Once the cipherseed is obtained and verified by the user, the InitWallet
41
+ method should be used to commit the newly generated seed, and create the
42
+ wallet.
43
+ */
44
+ rpc GenSeed(GenSeedRequest) returns (GenSeedResponse) {
45
+ option (google.api.http) = {
46
+ get: "/v1/genseed"
47
+ };
48
+ }
49
+
50
+ /**
51
+ InitWallet is used when lnd is starting up for the first time to fully
52
+ initialize the daemon and its internal wallet. At the very least a wallet
53
+ password must be provided. This will be used to encrypt sensitive material
54
+ on disk.
55
+
56
+ In the case of a recovery scenario, the user can also specify their aezeed
57
+ mnemonic and passphrase. If set, then the daemon will use this prior state
58
+ to initialize its internal wallet.
59
+
60
+ Alternatively, this can be used along with the GenSeed RPC to obtain a
61
+ seed, then present it to the user. Once it has been verified by the user,
62
+ the seed can be fed into this RPC in order to commit the new wallet.
63
+ */
64
+ rpc InitWallet(InitWalletRequest) returns (InitWalletResponse) {
65
+ option (google.api.http) = {
66
+ post: "/v1/initwallet"
67
+ body: "*"
68
+ };
69
+ }
70
+
71
+ /** lncli: `unlock`
72
+ UnlockWallet is used at startup of lnd to provide a password to unlock
73
+ the wallet database.
74
+ */
75
+ rpc UnlockWallet(UnlockWalletRequest) returns (UnlockWalletResponse) {
76
+ option (google.api.http) = {
77
+ post: "/v1/unlockwallet"
78
+ body: "*"
79
+ };
80
+ }
81
+
82
+ /** lncli: `changepassword`
83
+ ChangePassword changes the password of the encrypted wallet. This will
84
+ automatically unlock the wallet database if successful.
85
+ */
86
+ rpc ChangePassword (ChangePasswordRequest) returns (ChangePasswordResponse) {
87
+ option (google.api.http) = {
88
+ post: "/v1/changepassword"
89
+ body: "*"
90
+ };
91
+ }
92
+ }
93
+
94
+ message GenSeedRequest {
95
+ /**
96
+ aezeed_passphrase is an optional user provided passphrase that will be used
97
+ to encrypt the generated aezeed cipher seed.
98
+ */
99
+ bytes aezeed_passphrase = 1;
100
+
101
+ /**
102
+ seed_entropy is an optional 16-bytes generated via CSPRNG. If not
103
+ specified, then a fresh set of randomness will be used to create the seed.
104
+ */
105
+ bytes seed_entropy = 2;
106
+ }
107
+ message GenSeedResponse {
108
+ /**
109
+ cipher_seed_mnemonic is a 24-word mnemonic that encodes a prior aezeed
110
+ cipher seed obtained by the user. This field is optional, as if not
111
+ provided, then the daemon will generate a new cipher seed for the user.
112
+ Otherwise, then the daemon will attempt to recover the wallet state linked
113
+ to this cipher seed.
114
+ */
115
+ repeated string cipher_seed_mnemonic = 1;
116
+
117
+ /**
118
+ enciphered_seed are the raw aezeed cipher seed bytes. This is the raw
119
+ cipher text before run through our mnemonic encoding scheme.
120
+ */
121
+ bytes enciphered_seed = 2;
122
+ }
123
+
124
+ message InitWalletRequest {
125
+ /**
126
+ wallet_password is the passphrase that should be used to encrypt the
127
+ wallet. This MUST be at least 8 chars in length. After creation, this
128
+ password is required to unlock the daemon.
129
+ */
130
+ bytes wallet_password = 1;
131
+
132
+ /**
133
+ cipher_seed_mnemonic is a 24-word mnemonic that encodes a prior aezeed
134
+ cipher seed obtained by the user. This may have been generated by the
135
+ GenSeed method, or be an existing seed.
136
+ */
137
+ repeated string cipher_seed_mnemonic = 2;
138
+
139
+ /**
140
+ aezeed_passphrase is an optional user provided passphrase that will be used
141
+ to encrypt the generated aezeed cipher seed.
142
+ */
143
+ bytes aezeed_passphrase = 3;
144
+
145
+ /**
146
+ recovery_window is an optional argument specifying the address lookahead
147
+ when restoring a wallet seed. The recovery window applies to each
148
+ individual branch of the BIP44 derivation paths. Supplying a recovery
149
+ window of zero indicates that no addresses should be recovered, such after
150
+ the first initialization of the wallet.
151
+ */
152
+ int32 recovery_window = 4;
153
+
154
+ /**
155
+ channel_backups is an optional argument that allows clients to recover the
156
+ settled funds within a set of channels. This should be populated if the
157
+ user was unable to close out all channels and sweep funds before partial or
158
+ total data loss occurred. If specified, then after on-chain recovery of
159
+ funds, lnd begin to carry out the data loss recovery protocol in order to
160
+ recover the funds in each channel from a remote force closed transaction.
161
+ */
162
+ ChanBackupSnapshot channel_backups = 5;
163
+ }
164
+ message InitWalletResponse {
165
+ }
166
+
167
+ message UnlockWalletRequest {
168
+ /**
169
+ wallet_password should be the current valid passphrase for the daemon. This
170
+ will be required to decrypt on-disk material that the daemon requires to
171
+ function properly.
172
+ */
173
+ bytes wallet_password = 1;
174
+
175
+ /**
176
+ recovery_window is an optional argument specifying the address lookahead
177
+ when restoring a wallet seed. The recovery window applies to each
178
+ invdividual branch of the BIP44 derivation paths. Supplying a recovery
179
+ window of zero indicates that no addresses should be recovered, such after
180
+ the first initialization of the wallet.
181
+ */
182
+ int32 recovery_window = 2;
183
+
184
+ /**
185
+ channel_backups is an optional argument that allows clients to recover the
186
+ settled funds within a set of channels. This should be populated if the
187
+ user was unable to close out all channels and sweep funds before partial or
188
+ total data loss occurred. If specified, then after on-chain recovery of
189
+ funds, lnd begin to carry out the data loss recovery protocol in order to
190
+ recover the funds in each channel from a remote force closed transaction.
191
+ */
192
+ ChanBackupSnapshot channel_backups = 3;
193
+ }
194
+ message UnlockWalletResponse {}
195
+
196
+ message ChangePasswordRequest {
197
+ /**
198
+ current_password should be the current valid passphrase used to unlock the
199
+ daemon.
200
+ */
201
+ bytes current_password = 1;
202
+
203
+ /**
204
+ new_password should be the new passphrase that will be needed to unlock the
205
+ daemon.
206
+ */
207
+ bytes new_password = 2;
208
+ }
209
+ message ChangePasswordResponse {}
210
+
211
+ service Lightning {
212
+ /** lncli: `walletbalance`
213
+ WalletBalance returns total unspent outputs(confirmed and unconfirmed), all
214
+ confirmed unspent outputs and all unconfirmed unspent outputs under control
215
+ of the wallet.
216
+ */
217
+ rpc WalletBalance (WalletBalanceRequest) returns (WalletBalanceResponse) {
218
+ option (google.api.http) = {
219
+ get: "/v1/balance/blockchain"
220
+ };
221
+ }
222
+
223
+ /** lncli: `channelbalance`
224
+ ChannelBalance returns the total funds available across all open channels
225
+ in satoshis.
226
+ */
227
+ rpc ChannelBalance (ChannelBalanceRequest) returns (ChannelBalanceResponse) {
228
+ option (google.api.http) = {
229
+ get: "/v1/balance/channels"
230
+ };
231
+ }
232
+
233
+ /** lncli: `listchaintxns`
234
+ GetTransactions returns a list describing all the known transactions
235
+ relevant to the wallet.
236
+ */
237
+ rpc GetTransactions (GetTransactionsRequest) returns (TransactionDetails) {
238
+ option (google.api.http) = {
239
+ get: "/v1/transactions"
240
+ };
241
+ }
242
+
243
+ /** lncli: `estimatefee`
244
+ EstimateFee asks the chain backend to estimate the fee rate and total fees
245
+ for a transaction that pays to multiple specified outputs.
246
+ */
247
+ rpc EstimateFee (EstimateFeeRequest) returns (EstimateFeeResponse) {
248
+ option (google.api.http) = {
249
+ get: "/v1/transactions/fee"
250
+ };
251
+ }
252
+
253
+ /** lncli: `sendcoins`
254
+ SendCoins executes a request to send coins to a particular address. Unlike
255
+ SendMany, this RPC call only allows creating a single output at a time. If
256
+ neither target_conf, or sat_per_byte are set, then the internal wallet will
257
+ consult its fee model to determine a fee for the default confirmation
258
+ target.
259
+ */
260
+ rpc SendCoins (SendCoinsRequest) returns (SendCoinsResponse) {
261
+ option (google.api.http) = {
262
+ post: "/v1/transactions"
263
+ body: "*"
264
+ };
265
+ }
266
+
267
+ /** lncli: `listunspent`
268
+ ListUnspent returns a list of all utxos spendable by the wallet with a
269
+ number of confirmations between the specified minimum and maximum.
270
+ */
271
+ rpc ListUnspent (ListUnspentRequest) returns (ListUnspentResponse) {
272
+ option (google.api.http) = {
273
+ get: "/v1/utxos"
274
+ };
275
+ }
276
+
277
+ /**
278
+ SubscribeTransactions creates a uni-directional stream from the server to
279
+ the client in which any newly discovered transactions relevant to the
280
+ wallet are sent over.
281
+ */
282
+ rpc SubscribeTransactions (GetTransactionsRequest) returns (stream Transaction);
283
+
284
+ /** lncli: `sendmany`
285
+ SendMany handles a request for a transaction that creates multiple specified
286
+ outputs in parallel. If neither target_conf, or sat_per_byte are set, then
287
+ the internal wallet will consult its fee model to determine a fee for the
288
+ default confirmation target.
289
+ */
290
+ rpc SendMany (SendManyRequest) returns (SendManyResponse);
291
+
292
+ /** lncli: `newaddress`
293
+ NewAddress creates a new address under control of the local wallet.
294
+ */
295
+ rpc NewAddress (NewAddressRequest) returns (NewAddressResponse) {
296
+ option (google.api.http) = {
297
+ get: "/v1/newaddress"
298
+ };
299
+ }
300
+
301
+ /** lncli: `signmessage`
302
+ SignMessage signs a message with this node's private key. The returned
303
+ signature string is `zbase32` encoded and pubkey recoverable, meaning that
304
+ only the message digest and signature are needed for verification.
305
+ */
306
+ rpc SignMessage (SignMessageRequest) returns (SignMessageResponse) {
307
+ option (google.api.http) = {
308
+ post: "/v1/signmessage"
309
+ body: "*"
310
+ };
311
+ }
312
+
313
+ /** lncli: `verifymessage`
314
+ VerifyMessage verifies a signature over a msg. The signature must be
315
+ zbase32 encoded and signed by an active node in the resident node's
316
+ channel database. In addition to returning the validity of the signature,
317
+ VerifyMessage also returns the recovered pubkey from the signature.
318
+ */
319
+ rpc VerifyMessage (VerifyMessageRequest) returns (VerifyMessageResponse) {
320
+ option (google.api.http) = {
321
+ post: "/v1/verifymessage"
322
+ body: "*"
323
+ };
324
+ }
325
+
326
+ /** lncli: `connect`
327
+ ConnectPeer attempts to establish a connection to a remote peer. This is at
328
+ the networking level, and is used for communication between nodes. This is
329
+ distinct from establishing a channel with a peer.
330
+ */
331
+ rpc ConnectPeer (ConnectPeerRequest) returns (ConnectPeerResponse) {
332
+ option (google.api.http) = {
333
+ post: "/v1/peers"
334
+ body: "*"
335
+ };
336
+ }
337
+
338
+ /** lncli: `disconnect`
339
+ DisconnectPeer attempts to disconnect one peer from another identified by a
340
+ given pubKey. In the case that we currently have a pending or active channel
341
+ with the target peer, then this action will be not be allowed.
342
+ */
343
+ rpc DisconnectPeer (DisconnectPeerRequest) returns (DisconnectPeerResponse) {
344
+ option (google.api.http) = {
345
+ delete: "/v1/peers/{pub_key}"
346
+ };
347
+ }
348
+
349
+ /** lncli: `listpeers`
350
+ ListPeers returns a verbose listing of all currently active peers.
351
+ */
352
+ rpc ListPeers (ListPeersRequest) returns (ListPeersResponse) {
353
+ option (google.api.http) = {
354
+ get: "/v1/peers"
355
+ };
356
+ }
357
+
358
+ /** lncli: `getinfo`
359
+ GetInfo returns general information concerning the lightning node including
360
+ it's identity pubkey, alias, the chains it is connected to, and information
361
+ concerning the number of open+pending channels.
362
+ */
363
+ rpc GetInfo (GetInfoRequest) returns (GetInfoResponse) {
364
+ option (google.api.http) = {
365
+ get: "/v1/getinfo"
366
+ };
367
+ }
368
+
369
+ // TODO(roasbeef): merge with below with bool?
370
+ /** lncli: `pendingchannels`
371
+ PendingChannels returns a list of all the channels that are currently
372
+ considered "pending". A channel is pending if it has finished the funding
373
+ workflow and is waiting for confirmations for the funding txn, or is in the
374
+ process of closure, either initiated cooperatively or non-cooperatively.
375
+ */
376
+ rpc PendingChannels (PendingChannelsRequest) returns (PendingChannelsResponse) {
377
+ option (google.api.http) = {
378
+ get: "/v1/channels/pending"
379
+ };
380
+ }
381
+
382
+ /** lncli: `listchannels`
383
+ ListChannels returns a description of all the open channels that this node
384
+ is a participant in.
385
+ */
386
+ rpc ListChannels (ListChannelsRequest) returns (ListChannelsResponse) {
387
+ option (google.api.http) = {
388
+ get: "/v1/channels"
389
+ };
390
+ }
391
+
392
+ /** lncli: `subscribechannelevents`
393
+ SubscribeChannelEvents creates a uni-directional stream from the server to
394
+ the client in which any updates relevant to the state of the channels are
395
+ sent over. Events include new active channels, inactive channels, and closed
396
+ channels.
397
+ */
398
+ rpc SubscribeChannelEvents (ChannelEventSubscription) returns (stream ChannelEventUpdate);
399
+
400
+ /** lncli: `closedchannels`
401
+ ClosedChannels returns a description of all the closed channels that
402
+ this node was a participant in.
403
+ */
404
+ rpc ClosedChannels (ClosedChannelsRequest) returns (ClosedChannelsResponse) {
405
+ option (google.api.http) = {
406
+ get: "/v1/channels/closed"
407
+ };
408
+ }
409
+
410
+
411
+ /**
412
+ OpenChannelSync is a synchronous version of the OpenChannel RPC call. This
413
+ call is meant to be consumed by clients to the REST proxy. As with all
414
+ other sync calls, all byte slices are intended to be populated as hex
415
+ encoded strings.
416
+ */
417
+ rpc OpenChannelSync (OpenChannelRequest) returns (ChannelPoint) {
418
+ option (google.api.http) = {
419
+ post: "/v1/channels"
420
+ body: "*"
421
+ };
422
+ }
423
+
424
+ /** lncli: `openchannel`
425
+ OpenChannel attempts to open a singly funded channel specified in the
426
+ request to a remote peer. Users are able to specify a target number of
427
+ blocks that the funding transaction should be confirmed in, or a manual fee
428
+ rate to us for the funding transaction. If neither are specified, then a
429
+ lax block confirmation target is used.
430
+ */
431
+ rpc OpenChannel (OpenChannelRequest) returns (stream OpenStatusUpdate);
432
+
433
+ /** lncli: `closechannel`
434
+ CloseChannel attempts to close an active channel identified by its channel
435
+ outpoint (ChannelPoint). The actions of this method can additionally be
436
+ augmented to attempt a force close after a timeout period in the case of an
437
+ inactive peer. If a non-force close (cooperative closure) is requested,
438
+ then the user can specify either a target number of blocks until the
439
+ closure transaction is confirmed, or a manual fee rate. If neither are
440
+ specified, then a default lax, block confirmation target is used.
441
+ */
442
+ rpc CloseChannel (CloseChannelRequest) returns (stream CloseStatusUpdate) {
443
+ option (google.api.http) = {
444
+ delete: "/v1/channels/{channel_point.funding_txid_str}/{channel_point.output_index}"
445
+ };
446
+ }
447
+
448
+ /** lncli: `abandonchannel`
449
+ AbandonChannel removes all channel state from the database except for a
450
+ close summary. This method can be used to get rid of permanently unusable
451
+ channels due to bugs fixed in newer versions of lnd. Only available
452
+ when in debug builds of lnd.
453
+ */
454
+ rpc AbandonChannel (AbandonChannelRequest) returns (AbandonChannelResponse) {
455
+ option (google.api.http) = {
456
+ delete: "/v1/channels/abandon/{channel_point.funding_txid_str}/{channel_point.output_index}"
457
+ };
458
+ }
459
+
460
+
461
+ /** lncli: `sendpayment`
462
+ SendPayment dispatches a bi-directional streaming RPC for sending payments
463
+ through the Lightning Network. A single RPC invocation creates a persistent
464
+ bi-directional stream allowing clients to rapidly send payments through the
465
+ Lightning Network with a single persistent connection.
466
+ */
467
+ rpc SendPayment (stream SendRequest) returns (stream SendResponse);
468
+
469
+ /**
470
+ SendPaymentSync is the synchronous non-streaming version of SendPayment.
471
+ This RPC is intended to be consumed by clients of the REST proxy.
472
+ Additionally, this RPC expects the destination's public key and the payment
473
+ hash (if any) to be encoded as hex strings.
474
+ */
475
+ rpc SendPaymentSync (SendRequest) returns (SendResponse) {
476
+ option (google.api.http) = {
477
+ post: "/v1/channels/transactions"
478
+ body: "*"
479
+ };
480
+ }
481
+
482
+ /** lncli: `sendtoroute`
483
+ SendToRoute is a bi-directional streaming RPC for sending payment through
484
+ the Lightning Network. This method differs from SendPayment in that it
485
+ allows users to specify a full route manually. This can be used for things
486
+ like rebalancing, and atomic swaps.
487
+ */
488
+ rpc SendToRoute(stream SendToRouteRequest) returns (stream SendResponse);
489
+
490
+ /**
491
+ SendToRouteSync is a synchronous version of SendToRoute. It Will block
492
+ until the payment either fails or succeeds.
493
+ */
494
+ rpc SendToRouteSync (SendToRouteRequest) returns (SendResponse) {
495
+ option (google.api.http) = {
496
+ post: "/v1/channels/transactions/route"
497
+ body: "*"
498
+ };
499
+ }
500
+
501
+ /** lncli: `addinvoice`
502
+ AddInvoice attempts to add a new invoice to the invoice database. Any
503
+ duplicated invoices are rejected, therefore all invoices *must* have a
504
+ unique payment preimage.
505
+ */
506
+ rpc AddInvoice (Invoice) returns (AddInvoiceResponse) {
507
+ option (google.api.http) = {
508
+ post: "/v1/invoices"
509
+ body: "*"
510
+ };
511
+ }
512
+
513
+ /** lncli: `listinvoices`
514
+ ListInvoices returns a list of all the invoices currently stored within the
515
+ database. Any active debug invoices are ignored. It has full support for
516
+ paginated responses, allowing users to query for specific invoices through
517
+ their add_index. This can be done by using either the first_index_offset or
518
+ last_index_offset fields included in the response as the index_offset of the
519
+ next request. By default, the first 100 invoices created will be returned.
520
+ Backwards pagination is also supported through the Reversed flag.
521
+ */
522
+ rpc ListInvoices (ListInvoiceRequest) returns (ListInvoiceResponse) {
523
+ option (google.api.http) = {
524
+ get: "/v1/invoices"
525
+ };
526
+ }
527
+
528
+ /** lncli: `lookupinvoice`
529
+ LookupInvoice attempts to look up an invoice according to its payment hash.
530
+ The passed payment hash *must* be exactly 32 bytes, if not, an error is
531
+ returned.
532
+ */
533
+ rpc LookupInvoice (PaymentHash) returns (Invoice) {
534
+ option (google.api.http) = {
535
+ get: "/v1/invoice/{r_hash_str}"
536
+ };
537
+ }
538
+
539
+ /**
540
+ SubscribeInvoices returns a uni-directional stream (server -> client) for
541
+ notifying the client of newly added/settled invoices. The caller can
542
+ optionally specify the add_index and/or the settle_index. If the add_index
543
+ is specified, then we'll first start by sending add invoice events for all
544
+ invoices with an add_index greater than the specified value. If the
545
+ settle_index is specified, the next, we'll send out all settle events for
546
+ invoices with a settle_index greater than the specified value. One or both
547
+ of these fields can be set. If no fields are set, then we'll only send out
548
+ the latest add/settle events.
549
+ */
550
+ rpc SubscribeInvoices (InvoiceSubscription) returns (stream Invoice) {
551
+ option (google.api.http) = {
552
+ get: "/v1/invoices/subscribe"
553
+ };
554
+ }
555
+
556
+ /** lncli: `decodepayreq`
557
+ DecodePayReq takes an encoded payment request string and attempts to decode
558
+ it, returning a full description of the conditions encoded within the
559
+ payment request.
560
+ */
561
+ rpc DecodePayReq (PayReqString) returns (PayReq) {
562
+ option (google.api.http) = {
563
+ get: "/v1/payreq/{pay_req}"
564
+ };
565
+ }
566
+
567
+ /** lncli: `listpayments`
568
+ ListPayments returns a list of all outgoing payments.
569
+ */
570
+ rpc ListPayments (ListPaymentsRequest) returns (ListPaymentsResponse) {
571
+ option (google.api.http) = {
572
+ get: "/v1/payments"
573
+ };
574
+ };
575
+
576
+ /**
577
+ DeleteAllPayments deletes all outgoing payments from DB.
578
+ */
579
+ rpc DeleteAllPayments (DeleteAllPaymentsRequest) returns (DeleteAllPaymentsResponse) {
580
+ option (google.api.http) = {
581
+ delete: "/v1/payments"
582
+ };
583
+ };
584
+
585
+ /** lncli: `describegraph`
586
+ DescribeGraph returns a description of the latest graph state from the
587
+ point of view of the node. The graph information is partitioned into two
588
+ components: all the nodes/vertexes, and all the edges that connect the
589
+ vertexes themselves. As this is a directed graph, the edges also contain
590
+ the node directional specific routing policy which includes: the time lock
591
+ delta, fee information, etc.
592
+ */
593
+ rpc DescribeGraph (ChannelGraphRequest) returns (ChannelGraph) {
594
+ option (google.api.http) = {
595
+ get: "/v1/graph"
596
+ };
597
+ }
598
+
599
+ /** lncli: `getchaninfo`
600
+ GetChanInfo returns the latest authenticated network announcement for the
601
+ given channel identified by its channel ID: an 8-byte integer which
602
+ uniquely identifies the location of transaction's funding output within the
603
+ blockchain.
604
+ */
605
+ rpc GetChanInfo (ChanInfoRequest) returns (ChannelEdge) {
606
+ option (google.api.http) = {
607
+ get: "/v1/graph/edge/{chan_id}"
608
+ };
609
+ }
610
+
611
+ /** lncli: `getnodeinfo`
612
+ GetNodeInfo returns the latest advertised, aggregated, and authenticated
613
+ channel information for the specified node identified by its public key.
614
+ */
615
+ rpc GetNodeInfo (NodeInfoRequest) returns (NodeInfo) {
616
+ option (google.api.http) = {
617
+ get: "/v1/graph/node/{pub_key}"
618
+ };
619
+ }
620
+
621
+ /** lncli: `queryroutes`
622
+ QueryRoutes attempts to query the daemon's Channel Router for a possible
623
+ route to a target destination capable of carrying a specific amount of
624
+ satoshis. The retuned route contains the full details required to craft and
625
+ send an HTLC, also including the necessary information that should be
626
+ present within the Sphinx packet encapsulated within the HTLC.
627
+ */
628
+ rpc QueryRoutes(QueryRoutesRequest) returns (QueryRoutesResponse) {
629
+ option (google.api.http) = {
630
+ get: "/v1/graph/routes/{pub_key}/{amt}"
631
+ };
632
+ }
633
+
634
+ /** lncli: `getnetworkinfo`
635
+ GetNetworkInfo returns some basic stats about the known channel graph from
636
+ the point of view of the node.
637
+ */
638
+ rpc GetNetworkInfo (NetworkInfoRequest) returns (NetworkInfo) {
639
+ option (google.api.http) = {
640
+ get: "/v1/graph/info"
641
+ };
642
+ }
643
+
644
+ /** lncli: `stop`
645
+ StopDaemon will send a shutdown request to the interrupt handler, triggering
646
+ a graceful shutdown of the daemon.
647
+ */
648
+ rpc StopDaemon(StopRequest) returns (StopResponse);
649
+
650
+ /**
651
+ SubscribeChannelGraph launches a streaming RPC that allows the caller to
652
+ receive notifications upon any changes to the channel graph topology from
653
+ the point of view of the responding node. Events notified include: new
654
+ nodes coming online, nodes updating their authenticated attributes, new
655
+ channels being advertised, updates in the routing policy for a directional
656
+ channel edge, and when channels are closed on-chain.
657
+ */
658
+ rpc SubscribeChannelGraph(GraphTopologySubscription) returns (stream GraphTopologyUpdate);
659
+
660
+ /** lncli: `debuglevel`
661
+ DebugLevel allows a caller to programmatically set the logging verbosity of
662
+ lnd. The logging can be targeted according to a coarse daemon-wide logging
663
+ level, or in a granular fashion to specify the logging for a target
664
+ sub-system.
665
+ */
666
+ rpc DebugLevel (DebugLevelRequest) returns (DebugLevelResponse);
667
+
668
+ /** lncli: `feereport`
669
+ FeeReport allows the caller to obtain a report detailing the current fee
670
+ schedule enforced by the node globally for each channel.
671
+ */
672
+ rpc FeeReport(FeeReportRequest) returns (FeeReportResponse) {
673
+ option (google.api.http) = {
674
+ get: "/v1/fees"
675
+ };
676
+ }
677
+
678
+ /** lncli: `updatechanpolicy`
679
+ UpdateChannelPolicy allows the caller to update the fee schedule and
680
+ channel policies for all channels globally, or a particular channel.
681
+ */
682
+ rpc UpdateChannelPolicy(PolicyUpdateRequest) returns (PolicyUpdateResponse) {
683
+ option (google.api.http) = {
684
+ post: "/v1/chanpolicy"
685
+ body: "*"
686
+ };
687
+ }
688
+
689
+ /** lncli: `fwdinghistory`
690
+ ForwardingHistory allows the caller to query the htlcswitch for a record of
691
+ all HTLCs forwarded within the target time range, and integer offset
692
+ within that time range. If no time-range is specified, then the first chunk
693
+ of the past 24 hrs of forwarding history are returned.
694
+
695
+ A list of forwarding events are returned. The size of each forwarding event
696
+ is 40 bytes, and the max message size able to be returned in gRPC is 4 MiB.
697
+ As a result each message can only contain 50k entries. Each response has
698
+ the index offset of the last entry. The index offset can be provided to the
699
+ request to allow the caller to skip a series of records.
700
+ */
701
+ rpc ForwardingHistory(ForwardingHistoryRequest) returns (ForwardingHistoryResponse) {
702
+ option (google.api.http) = {
703
+ post: "/v1/switch"
704
+ body: "*"
705
+ };
706
+ };
707
+
708
+ /** lncli: `exportchanbackup`
709
+ ExportChannelBackup attempts to return an encrypted static channel backup
710
+ for the target channel identified by it channel point. The backup is
711
+ encrypted with a key generated from the aezeed seed of the user. The
712
+ returned backup can either be restored using the RestoreChannelBackup
713
+ method once lnd is running, or via the InitWallet and UnlockWallet methods
714
+ from the WalletUnlocker service.
715
+ */
716
+ rpc ExportChannelBackup(ExportChannelBackupRequest) returns (ChannelBackup) {
717
+ option (google.api.http) = {
718
+ get: "/v1/channels/backup/{chan_point.funding_txid_str}/{chan_point.output_index}"
719
+ };
720
+ };
721
+
722
+ /**
723
+ ExportAllChannelBackups returns static channel backups for all existing
724
+ channels known to lnd. A set of regular singular static channel backups for
725
+ each channel are returned. Additionally, a multi-channel backup is returned
726
+ as well, which contains a single encrypted blob containing the backups of
727
+ each channel.
728
+ */
729
+ rpc ExportAllChannelBackups(ChanBackupExportRequest) returns (ChanBackupSnapshot) {
730
+ option (google.api.http) = {
731
+ get: "/v1/channels/backup"
732
+ };
733
+ };
734
+
735
+ /**
736
+ VerifyChanBackup allows a caller to verify the integrity of a channel backup
737
+ snapshot. This method will accept either a packed Single or a packed Multi.
738
+ Specifying both will result in an error.
739
+ */
740
+ rpc VerifyChanBackup(ChanBackupSnapshot) returns (VerifyChanBackupResponse) {
741
+ option (google.api.http) = {
742
+ post: "/v1/channels/backup/verify"
743
+ body: "*"
744
+ };
745
+ };
746
+
747
+ /** lncli: `restorechanbackup`
748
+ RestoreChannelBackups accepts a set of singular channel backups, or a
749
+ single encrypted multi-chan backup and attempts to recover any funds
750
+ remaining within the channel. If we are able to unpack the backup, then the
751
+ new channel will be shown under listchannels, as well as pending channels.
752
+ */
753
+ rpc RestoreChannelBackups(RestoreChanBackupRequest) returns (RestoreBackupResponse) {
754
+ option (google.api.http) = {
755
+ post: "/v1/channels/backup/restore"
756
+ body: "*"
757
+ };
758
+ };
759
+
760
+ /**
761
+ SubscribeChannelBackups allows a client to sub-subscribe to the most up to
762
+ date information concerning the state of all channel backups. Each time a
763
+ new channel is added, we return the new set of channels, along with a
764
+ multi-chan backup containing the backup info for all channels. Each time a
765
+ channel is closed, we send a new update, which contains new new chan back
766
+ ups, but the updated set of encrypted multi-chan backups with the closed
767
+ channel(s) removed.
768
+ */
769
+ rpc SubscribeChannelBackups(ChannelBackupSubscription) returns (stream ChanBackupSnapshot) {
770
+ };
771
+ }
772
+
773
+ message Utxo {
774
+ /// The type of address
775
+ AddressType type = 1 [json_name = "address_type"];
776
+
777
+ /// The address
778
+ string address = 2 [json_name = "address"];
779
+
780
+ /// The value of the unspent coin in satoshis
781
+ int64 amount_sat = 3 [json_name = "amount_sat"];
782
+
783
+ /// The pkscript in hex
784
+ string pk_script = 4 [json_name = "pk_script"];
785
+
786
+ /// The outpoint in format txid:n
787
+ OutPoint outpoint = 5 [json_name = "outpoint"];
788
+
789
+ /// The number of confirmations for the Utxo
790
+ int64 confirmations = 6 [json_name = "confirmations"];
791
+ }
792
+
793
+ message Transaction {
794
+ /// The transaction hash
795
+ string tx_hash = 1 [ json_name = "tx_hash" ];
796
+
797
+ /// The transaction amount, denominated in satoshis
798
+ int64 amount = 2 [ json_name = "amount" ];
799
+
800
+ /// The number of confirmations
801
+ int32 num_confirmations = 3 [ json_name = "num_confirmations" ];
802
+
803
+ /// The hash of the block this transaction was included in
804
+ string block_hash = 4 [ json_name = "block_hash" ];
805
+
806
+ /// The height of the block this transaction was included in
807
+ int32 block_height = 5 [ json_name = "block_height" ];
808
+
809
+ /// Timestamp of this transaction
810
+ int64 time_stamp = 6 [ json_name = "time_stamp" ];
811
+
812
+ /// Fees paid for this transaction
813
+ int64 total_fees = 7 [ json_name = "total_fees" ];
814
+
815
+ /// Addresses that received funds for this transaction
816
+ repeated string dest_addresses = 8 [ json_name = "dest_addresses" ];
817
+ }
818
+ message GetTransactionsRequest {
819
+ }
820
+ message TransactionDetails {
821
+ /// The list of transactions relevant to the wallet.
822
+ repeated Transaction transactions = 1 [json_name = "transactions"];
823
+ }
824
+
825
+ message FeeLimit {
826
+ oneof limit {
827
+ /// The fee limit expressed as a fixed amount of satoshis.
828
+ int64 fixed = 1;
829
+
830
+ /// The fee limit expressed as a percentage of the payment amount.
831
+ int64 percent = 2;
832
+ }
833
+ }
834
+
835
+ message SendRequest {
836
+ /// The identity pubkey of the payment recipient
837
+ bytes dest = 1;
838
+
839
+ /// The hex-encoded identity pubkey of the payment recipient
840
+ string dest_string = 2;
841
+
842
+ /// Number of satoshis to send.
843
+ int64 amt = 3;
844
+
845
+ /// The hash to use within the payment's HTLC
846
+ bytes payment_hash = 4;
847
+
848
+ /// The hex-encoded hash to use within the payment's HTLC
849
+ string payment_hash_string = 5;
850
+
851
+ /**
852
+ A bare-bones invoice for a payment within the Lightning Network. With the
853
+ details of the invoice, the sender has all the data necessary to send a
854
+ payment to the recipient.
855
+ */
856
+ string payment_request = 6;
857
+
858
+ /**
859
+ The CLTV delta from the current height that should be used to set the
860
+ timelock for the final hop.
861
+ */
862
+ int32 final_cltv_delta = 7;
863
+
864
+ /**
865
+ The maximum number of satoshis that will be paid as a fee of the payment.
866
+ This value can be represented either as a percentage of the amount being
867
+ sent, or as a fixed amount of the maximum fee the user is willing the pay to
868
+ send the payment.
869
+ */
870
+ FeeLimit fee_limit = 8;
871
+
872
+ /**
873
+ The channel id of the channel that must be taken to the first hop. If zero,
874
+ any channel may be used.
875
+ */
876
+ uint64 outgoing_chan_id = 9;
877
+
878
+ /**
879
+ An optional maximum total time lock for the route. If zero, there is no
880
+ maximum enforced.
881
+ */
882
+ uint32 cltv_limit = 10;
883
+ }
884
+
885
+ message SendResponse {
886
+ string payment_error = 1 [json_name = "payment_error"];
887
+ bytes payment_preimage = 2 [json_name = "payment_preimage"];
888
+ Route payment_route = 3 [json_name = "payment_route"];
889
+ bytes payment_hash = 4 [json_name = "payment_hash"];
890
+ }
891
+
892
+ message SendToRouteRequest {
893
+ /// The payment hash to use for the HTLC.
894
+ bytes payment_hash = 1;
895
+
896
+ /// An optional hex-encoded payment hash to be used for the HTLC.
897
+ string payment_hash_string = 2;
898
+
899
+ /**
900
+ Deprecated. The set of routes that should be used to attempt to complete the
901
+ payment. The possibility to pass in multiple routes is deprecated and
902
+ instead the single route field below should be used in combination with the
903
+ streaming variant of SendToRoute.
904
+ */
905
+ repeated Route routes = 3 [deprecated = true];
906
+
907
+ /// Route that should be used to attempt to complete the payment.
908
+ Route route = 4;
909
+ }
910
+
911
+ message ChannelPoint {
912
+ oneof funding_txid {
913
+ /// Txid of the funding transaction
914
+ bytes funding_txid_bytes = 1 [json_name = "funding_txid_bytes"];
915
+
916
+ /// Hex-encoded string representing the funding transaction
917
+ string funding_txid_str = 2 [json_name = "funding_txid_str"];
918
+ }
919
+
920
+ /// The index of the output of the funding transaction
921
+ uint32 output_index = 3 [json_name = "output_index"];
922
+ }
923
+
924
+ message OutPoint {
925
+ /// Raw bytes representing the transaction id.
926
+ bytes txid_bytes = 1 [json_name = "txid_bytes"];
927
+
928
+ /// Reversed, hex-encoded string representing the transaction id.
929
+ string txid_str = 2 [json_name = "txid_str"];
930
+
931
+ /// The index of the output on the transaction.
932
+ uint32 output_index = 3 [json_name = "output_index"];
933
+ }
934
+
935
+ message LightningAddress {
936
+ /// The identity pubkey of the Lightning node
937
+ string pubkey = 1 [json_name = "pubkey"];
938
+
939
+ /// The network location of the lightning node, e.g. `69.69.69.69:1337` or `localhost:10011`
940
+ string host = 2 [json_name = "host"];
941
+ }
942
+
943
+ message EstimateFeeRequest {
944
+ /// The map from addresses to amounts for the transaction.
945
+ map<string, int64> AddrToAmount = 1;
946
+
947
+ /// The target number of blocks that this transaction should be confirmed by.
948
+ int32 target_conf = 2;
949
+ }
950
+
951
+ message EstimateFeeResponse {
952
+ /// The total fee in satoshis.
953
+ int64 fee_sat = 1 [json_name = "fee_sat"];
954
+
955
+ /// The fee rate in satoshi/byte.
956
+ int64 feerate_sat_per_byte = 2 [json_name = "feerate_sat_per_byte"];
957
+ }
958
+
959
+ message SendManyRequest {
960
+ /// The map from addresses to amounts
961
+ map<string, int64> AddrToAmount = 1;
962
+
963
+ /// The target number of blocks that this transaction should be confirmed by.
964
+ int32 target_conf = 3;
965
+
966
+ /// A manual fee rate set in sat/byte that should be used when crafting the transaction.
967
+ int64 sat_per_byte = 5;
968
+ }
969
+ message SendManyResponse {
970
+ /// The id of the transaction
971
+ string txid = 1 [json_name = "txid"];
972
+ }
973
+
974
+ message SendCoinsRequest {
975
+ /// The address to send coins to
976
+ string addr = 1;
977
+
978
+ /// The amount in satoshis to send
979
+ int64 amount = 2;
980
+
981
+ /// The target number of blocks that this transaction should be confirmed by.
982
+ int32 target_conf = 3;
983
+
984
+ /// A manual fee rate set in sat/byte that should be used when crafting the transaction.
985
+ int64 sat_per_byte = 5;
986
+
987
+ /**
988
+ If set, then the amount field will be ignored, and lnd will attempt to
989
+ send all the coins under control of the internal wallet to the specified
990
+ address.
991
+ */
992
+ bool send_all = 6;
993
+ }
994
+ message SendCoinsResponse {
995
+ /// The transaction ID of the transaction
996
+ string txid = 1 [json_name = "txid"];
997
+ }
998
+
999
+ message ListUnspentRequest {
1000
+ /// The minimum number of confirmations to be included.
1001
+ int32 min_confs = 1;
1002
+
1003
+ /// The maximum number of confirmations to be included.
1004
+ int32 max_confs = 2;
1005
+ }
1006
+ message ListUnspentResponse {
1007
+ /// A list of utxos
1008
+ repeated Utxo utxos = 1 [json_name = "utxos"];
1009
+ }
1010
+
1011
+ /**
1012
+ `AddressType` has to be one of:
1013
+
1014
+ - `p2wkh`: Pay to witness key hash (`WITNESS_PUBKEY_HASH` = 0)
1015
+ - `np2wkh`: Pay to nested witness key hash (`NESTED_PUBKEY_HASH` = 1)
1016
+ */
1017
+ enum AddressType {
1018
+ WITNESS_PUBKEY_HASH = 0;
1019
+ NESTED_PUBKEY_HASH = 1;
1020
+ UNUSED_WITNESS_PUBKEY_HASH = 2;
1021
+ UNUSED_NESTED_PUBKEY_HASH = 3;
1022
+ }
1023
+
1024
+ message NewAddressRequest {
1025
+ /// The address type
1026
+ AddressType type = 1;
1027
+ }
1028
+ message NewAddressResponse {
1029
+ /// The newly generated wallet address
1030
+ string address = 1 [json_name = "address"];
1031
+ }
1032
+
1033
+ message SignMessageRequest {
1034
+ /// The message to be signed
1035
+ bytes msg = 1 [ json_name = "msg" ];
1036
+ }
1037
+ message SignMessageResponse {
1038
+ /// The signature for the given message
1039
+ string signature = 1 [ json_name = "signature" ];
1040
+ }
1041
+
1042
+ message VerifyMessageRequest {
1043
+ /// The message over which the signature is to be verified
1044
+ bytes msg = 1 [ json_name = "msg" ];
1045
+
1046
+ /// The signature to be verified over the given message
1047
+ string signature = 2 [ json_name = "signature" ];
1048
+ }
1049
+ message VerifyMessageResponse {
1050
+ /// Whether the signature was valid over the given message
1051
+ bool valid = 1 [ json_name = "valid" ];
1052
+
1053
+ /// The pubkey recovered from the signature
1054
+ string pubkey = 2 [ json_name = "pubkey" ];
1055
+ }
1056
+
1057
+ message ConnectPeerRequest {
1058
+ /// Lightning address of the peer, in the format `<pubkey>@host`
1059
+ LightningAddress addr = 1;
1060
+
1061
+ /** If set, the daemon will attempt to persistently connect to the target
1062
+ * peer. Otherwise, the call will be synchronous. */
1063
+ bool perm = 2;
1064
+ }
1065
+ message ConnectPeerResponse {
1066
+ }
1067
+
1068
+ message DisconnectPeerRequest {
1069
+ /// The pubkey of the node to disconnect from
1070
+ string pub_key = 1 [json_name = "pub_key"];
1071
+ }
1072
+ message DisconnectPeerResponse {
1073
+ }
1074
+
1075
+ message HTLC {
1076
+ bool incoming = 1 [json_name = "incoming"];
1077
+ int64 amount = 2 [json_name = "amount"];
1078
+ bytes hash_lock = 3 [json_name = "hash_lock"];
1079
+ uint32 expiration_height = 4 [json_name = "expiration_height"];
1080
+ }
1081
+
1082
+ message Channel {
1083
+ /// Whether this channel is active or not
1084
+ bool active = 1 [json_name = "active"];
1085
+
1086
+ /// The identity pubkey of the remote node
1087
+ string remote_pubkey = 2 [json_name = "remote_pubkey"];
1088
+
1089
+ /**
1090
+ The outpoint (txid:index) of the funding transaction. With this value, Bob
1091
+ will be able to generate a signature for Alice's version of the commitment
1092
+ transaction.
1093
+ */
1094
+ string channel_point = 3 [json_name = "channel_point"];
1095
+
1096
+ /**
1097
+ The unique channel ID for the channel. The first 3 bytes are the block
1098
+ height, the next 3 the index within the block, and the last 2 bytes are the
1099
+ output index for the channel.
1100
+ */
1101
+ uint64 chan_id = 4 [json_name = "chan_id"];
1102
+
1103
+ /// The total amount of funds held in this channel
1104
+ int64 capacity = 5 [json_name = "capacity"];
1105
+
1106
+ /// This node's current balance in this channel
1107
+ int64 local_balance = 6 [json_name = "local_balance"];
1108
+
1109
+ /// The counterparty's current balance in this channel
1110
+ int64 remote_balance = 7 [json_name = "remote_balance"];
1111
+
1112
+ /**
1113
+ The amount calculated to be paid in fees for the current set of commitment
1114
+ transactions. The fee amount is persisted with the channel in order to
1115
+ allow the fee amount to be removed and recalculated with each channel state
1116
+ update, including updates that happen after a system restart.
1117
+ */
1118
+ int64 commit_fee = 8 [json_name = "commit_fee"];
1119
+
1120
+ /// The weight of the commitment transaction
1121
+ int64 commit_weight = 9 [json_name = "commit_weight"];
1122
+
1123
+ /**
1124
+ The required number of satoshis per kilo-weight that the requester will pay
1125
+ at all times, for both the funding transaction and commitment transaction.
1126
+ This value can later be updated once the channel is open.
1127
+ */
1128
+ int64 fee_per_kw = 10 [json_name = "fee_per_kw"];
1129
+
1130
+ /// The unsettled balance in this channel
1131
+ int64 unsettled_balance = 11 [json_name = "unsettled_balance"];
1132
+
1133
+ /**
1134
+ The total number of satoshis we've sent within this channel.
1135
+ */
1136
+ int64 total_satoshis_sent = 12 [json_name = "total_satoshis_sent"];
1137
+
1138
+ /**
1139
+ The total number of satoshis we've received within this channel.
1140
+ */
1141
+ int64 total_satoshis_received = 13 [json_name = "total_satoshis_received"];
1142
+
1143
+ /**
1144
+ The total number of updates conducted within this channel.
1145
+ */
1146
+ uint64 num_updates = 14 [json_name = "num_updates"];
1147
+
1148
+ /**
1149
+ The list of active, uncleared HTLCs currently pending within the channel.
1150
+ */
1151
+ repeated HTLC pending_htlcs = 15 [json_name = "pending_htlcs"];
1152
+
1153
+ /**
1154
+ The CSV delay expressed in relative blocks. If the channel is force closed,
1155
+ we will need to wait for this many blocks before we can regain our funds.
1156
+ */
1157
+ uint32 csv_delay = 16 [json_name = "csv_delay"];
1158
+
1159
+ /// Whether this channel is advertised to the network or not.
1160
+ bool private = 17 [json_name = "private"];
1161
+
1162
+ /// True if we were the ones that created the channel.
1163
+ bool initiator = 18 [json_name = "initiator"];
1164
+
1165
+ /// A set of flags showing the current state of the cahnnel.
1166
+ string chan_status_flags = 19 [json_name = "chan_status_flags"];
1167
+ }
1168
+
1169
+
1170
+ message ListChannelsRequest {
1171
+ bool active_only = 1;
1172
+ bool inactive_only = 2;
1173
+ bool public_only = 3;
1174
+ bool private_only = 4;
1175
+ }
1176
+ message ListChannelsResponse {
1177
+ /// The list of active channels
1178
+ repeated Channel channels = 11 [json_name = "channels"];
1179
+ }
1180
+
1181
+ message ChannelCloseSummary {
1182
+ /// The outpoint (txid:index) of the funding transaction.
1183
+ string channel_point = 1 [json_name = "channel_point"];
1184
+
1185
+ /// The unique channel ID for the channel.
1186
+ uint64 chan_id = 2 [json_name = "chan_id"];
1187
+
1188
+ /// The hash of the genesis block that this channel resides within.
1189
+ string chain_hash = 3 [json_name = "chain_hash"];
1190
+
1191
+ /// The txid of the transaction which ultimately closed this channel.
1192
+ string closing_tx_hash = 4 [json_name = "closing_tx_hash"];
1193
+
1194
+ /// Public key of the remote peer that we formerly had a channel with.
1195
+ string remote_pubkey = 5 [json_name = "remote_pubkey"];
1196
+
1197
+ /// Total capacity of the channel.
1198
+ int64 capacity = 6 [json_name = "capacity"];
1199
+
1200
+ /// Height at which the funding transaction was spent.
1201
+ uint32 close_height = 7 [json_name = "close_height"];
1202
+
1203
+ /// Settled balance at the time of channel closure
1204
+ int64 settled_balance = 8 [json_name = "settled_balance"];
1205
+
1206
+ /// The sum of all the time-locked outputs at the time of channel closure
1207
+ int64 time_locked_balance = 9 [json_name = "time_locked_balance"];
1208
+
1209
+ enum ClosureType {
1210
+ COOPERATIVE_CLOSE = 0;
1211
+ LOCAL_FORCE_CLOSE = 1;
1212
+ REMOTE_FORCE_CLOSE = 2;
1213
+ BREACH_CLOSE = 3;
1214
+ FUNDING_CANCELED = 4;
1215
+ ABANDONED = 5;
1216
+ }
1217
+
1218
+ /// Details on how the channel was closed.
1219
+ ClosureType close_type = 10 [json_name = "close_type"];
1220
+ }
1221
+
1222
+ message ClosedChannelsRequest {
1223
+ bool cooperative = 1;
1224
+ bool local_force = 2;
1225
+ bool remote_force = 3;
1226
+ bool breach = 4;
1227
+ bool funding_canceled = 5;
1228
+ bool abandoned = 6;
1229
+ }
1230
+
1231
+ message ClosedChannelsResponse {
1232
+ repeated ChannelCloseSummary channels = 1 [json_name = "channels"];
1233
+ }
1234
+
1235
+ message Peer {
1236
+ /// The identity pubkey of the peer
1237
+ string pub_key = 1 [json_name = "pub_key"];
1238
+
1239
+ /// Network address of the peer; eg `127.0.0.1:10011`
1240
+ string address = 3 [json_name = "address"];
1241
+
1242
+ /// Bytes of data transmitted to this peer
1243
+ uint64 bytes_sent = 4 [json_name = "bytes_sent"];
1244
+
1245
+ /// Bytes of data transmitted from this peer
1246
+ uint64 bytes_recv = 5 [json_name = "bytes_recv"];
1247
+
1248
+ /// Satoshis sent to this peer
1249
+ int64 sat_sent = 6 [json_name = "sat_sent"];
1250
+
1251
+ /// Satoshis received from this peer
1252
+ int64 sat_recv = 7 [json_name = "sat_recv"];
1253
+
1254
+ /// A channel is inbound if the counterparty initiated the channel
1255
+ bool inbound = 8 [json_name = "inbound"];
1256
+
1257
+ /// Ping time to this peer
1258
+ int64 ping_time = 9 [json_name = "ping_time"];
1259
+
1260
+ enum SyncType {
1261
+ /**
1262
+ Denotes that we cannot determine the peer's current sync type.
1263
+ */
1264
+ UNKNOWN_SYNC = 0;
1265
+
1266
+ /**
1267
+ Denotes that we are actively receiving new graph updates from the peer.
1268
+ */
1269
+ ACTIVE_SYNC = 1;
1270
+
1271
+ /**
1272
+ Denotes that we are not receiving new graph updates from the peer.
1273
+ */
1274
+ PASSIVE_SYNC = 2;
1275
+ }
1276
+
1277
+ // The type of sync we are currently performing with this peer.
1278
+ SyncType sync_type = 10 [json_name = "sync_type"];
1279
+ }
1280
+
1281
+ message ListPeersRequest {
1282
+ }
1283
+ message ListPeersResponse {
1284
+ /// The list of currently connected peers
1285
+ repeated Peer peers = 1 [json_name = "peers"];
1286
+ }
1287
+
1288
+ message GetInfoRequest {
1289
+ }
1290
+ message GetInfoResponse {
1291
+
1292
+ /// The identity pubkey of the current node.
1293
+ string identity_pubkey = 1 [json_name = "identity_pubkey"];
1294
+
1295
+ /// If applicable, the alias of the current node, e.g. "bob"
1296
+ string alias = 2 [json_name = "alias"];
1297
+
1298
+ /// Number of pending channels
1299
+ uint32 num_pending_channels = 3 [json_name = "num_pending_channels"];
1300
+
1301
+ /// Number of active channels
1302
+ uint32 num_active_channels = 4 [json_name = "num_active_channels"];
1303
+
1304
+ /// Number of peers
1305
+ uint32 num_peers = 5 [json_name = "num_peers"];
1306
+
1307
+ /// The node's current view of the height of the best block
1308
+ uint32 block_height = 6 [json_name = "block_height"];
1309
+
1310
+ /// The node's current view of the hash of the best block
1311
+ string block_hash = 8 [json_name = "block_hash"];
1312
+
1313
+ /// Whether the wallet's view is synced to the main chain
1314
+ bool synced_to_chain = 9 [json_name = "synced_to_chain"];
1315
+
1316
+ /**
1317
+ Whether the current node is connected to testnet. This field is
1318
+ deprecated and the network field should be used instead
1319
+ **/
1320
+ bool testnet = 10 [json_name = "testnet", deprecated = true];
1321
+
1322
+ reserved 11;
1323
+
1324
+ /// The URIs of the current node.
1325
+ repeated string uris = 12 [json_name = "uris"];
1326
+
1327
+ /// Timestamp of the block best known to the wallet
1328
+ int64 best_header_timestamp = 13 [ json_name = "best_header_timestamp" ];
1329
+
1330
+ /// The version of the LND software that the node is running.
1331
+ string version = 14 [ json_name = "version" ];
1332
+
1333
+ /// Number of inactive channels
1334
+ uint32 num_inactive_channels = 15 [json_name = "num_inactive_channels"];
1335
+
1336
+ /// A list of active chains the node is connected to
1337
+ repeated Chain chains = 16 [json_name = "chains"];
1338
+ }
1339
+
1340
+ message Chain {
1341
+ /// The blockchain the node is on (eg bitcoin, litecoin)
1342
+ string chain = 1 [json_name = "chain"];
1343
+
1344
+ /// The network the node is on (eg regtest, testnet, mainnet)
1345
+ string network = 2 [json_name = "network"];
1346
+ }
1347
+
1348
+ message ConfirmationUpdate {
1349
+ bytes block_sha = 1;
1350
+ int32 block_height = 2;
1351
+
1352
+ uint32 num_confs_left = 3;
1353
+ }
1354
+
1355
+ message ChannelOpenUpdate {
1356
+ ChannelPoint channel_point = 1 [json_name = "channel_point"];
1357
+ }
1358
+
1359
+ message ChannelCloseUpdate {
1360
+ bytes closing_txid = 1 [json_name = "closing_txid"];
1361
+
1362
+ bool success = 2 [json_name = "success"];
1363
+ }
1364
+
1365
+ message CloseChannelRequest {
1366
+ /**
1367
+ The outpoint (txid:index) of the funding transaction. With this value, Bob
1368
+ will be able to generate a signature for Alice's version of the commitment
1369
+ transaction.
1370
+ */
1371
+ ChannelPoint channel_point = 1;
1372
+
1373
+ /// If true, then the channel will be closed forcibly. This means the current commitment transaction will be signed and broadcast.
1374
+ bool force = 2;
1375
+
1376
+ /// The target number of blocks that the closure transaction should be confirmed by.
1377
+ int32 target_conf = 3;
1378
+
1379
+ /// A manual fee rate set in sat/byte that should be used when crafting the closure transaction.
1380
+ int64 sat_per_byte = 4;
1381
+ }
1382
+
1383
+ message CloseStatusUpdate {
1384
+ oneof update {
1385
+ PendingUpdate close_pending = 1 [json_name = "close_pending"];
1386
+ ChannelCloseUpdate chan_close = 3 [json_name = "chan_close"];
1387
+ }
1388
+ }
1389
+
1390
+ message PendingUpdate {
1391
+ bytes txid = 1 [json_name = "txid"];
1392
+ uint32 output_index = 2 [json_name = "output_index"];
1393
+ }
1394
+
1395
+ message OpenChannelRequest {
1396
+ /// The pubkey of the node to open a channel with
1397
+ bytes node_pubkey = 2 [json_name = "node_pubkey"];
1398
+
1399
+ /// The hex encoded pubkey of the node to open a channel with
1400
+ string node_pubkey_string = 3 [json_name = "node_pubkey_string"];
1401
+
1402
+ /// The number of satoshis the wallet should commit to the channel
1403
+ int64 local_funding_amount = 4 [json_name = "local_funding_amount"];
1404
+
1405
+ /// The number of satoshis to push to the remote side as part of the initial commitment state
1406
+ int64 push_sat = 5 [json_name = "push_sat"];
1407
+
1408
+ /// The target number of blocks that the funding transaction should be confirmed by.
1409
+ int32 target_conf = 6;
1410
+
1411
+ /// A manual fee rate set in sat/byte that should be used when crafting the funding transaction.
1412
+ int64 sat_per_byte = 7;
1413
+
1414
+ /// Whether this channel should be private, not announced to the greater network.
1415
+ bool private = 8 [json_name = "private"];
1416
+
1417
+ /// The minimum value in millisatoshi we will require for incoming HTLCs on the channel.
1418
+ int64 min_htlc_msat = 9 [json_name = "min_htlc_msat"];
1419
+
1420
+ /// The delay we require on the remote's commitment transaction. If this is not set, it will be scaled automatically with the channel size.
1421
+ uint32 remote_csv_delay = 10 [json_name = "remote_csv_delay"];
1422
+
1423
+ /// The minimum number of confirmations each one of your outputs used for the funding transaction must satisfy.
1424
+ int32 min_confs = 11 [json_name = "min_confs"];
1425
+
1426
+ /// Whether unconfirmed outputs should be used as inputs for the funding transaction.
1427
+ bool spend_unconfirmed = 12 [json_name = "spend_unconfirmed"];
1428
+ }
1429
+ message OpenStatusUpdate {
1430
+ oneof update {
1431
+ PendingUpdate chan_pending = 1 [json_name = "chan_pending"];
1432
+ ChannelOpenUpdate chan_open = 3 [json_name = "chan_open"];
1433
+ }
1434
+ }
1435
+
1436
+ message PendingHTLC {
1437
+
1438
+ /// The direction within the channel that the htlc was sent
1439
+ bool incoming = 1 [ json_name = "incoming" ];
1440
+
1441
+ /// The total value of the htlc
1442
+ int64 amount = 2 [ json_name = "amount" ];
1443
+
1444
+ /// The final output to be swept back to the user's wallet
1445
+ string outpoint = 3 [ json_name = "outpoint" ];
1446
+
1447
+ /// The next block height at which we can spend the current stage
1448
+ uint32 maturity_height = 4 [ json_name = "maturity_height" ];
1449
+
1450
+ /**
1451
+ The number of blocks remaining until the current stage can be swept.
1452
+ Negative values indicate how many blocks have passed since becoming
1453
+ mature.
1454
+ */
1455
+ int32 blocks_til_maturity = 5 [ json_name = "blocks_til_maturity" ];
1456
+
1457
+ /// Indicates whether the htlc is in its first or second stage of recovery
1458
+ uint32 stage = 6 [ json_name = "stage" ];
1459
+ }
1460
+
1461
+ message PendingChannelsRequest {}
1462
+ message PendingChannelsResponse {
1463
+ message PendingChannel {
1464
+ string remote_node_pub = 1 [ json_name = "remote_node_pub" ];
1465
+ string channel_point = 2 [ json_name = "channel_point" ];
1466
+
1467
+ int64 capacity = 3 [ json_name = "capacity" ];
1468
+
1469
+ int64 local_balance = 4 [ json_name = "local_balance" ];
1470
+ int64 remote_balance = 5 [ json_name = "remote_balance" ];
1471
+ }
1472
+
1473
+ message PendingOpenChannel {
1474
+ /// The pending channel
1475
+ PendingChannel channel = 1 [ json_name = "channel" ];
1476
+
1477
+ /// The height at which this channel will be confirmed
1478
+ uint32 confirmation_height = 2 [ json_name = "confirmation_height" ];
1479
+
1480
+ /**
1481
+ The amount calculated to be paid in fees for the current set of
1482
+ commitment transactions. The fee amount is persisted with the channel
1483
+ in order to allow the fee amount to be removed and recalculated with
1484
+ each channel state update, including updates that happen after a system
1485
+ restart.
1486
+ */
1487
+ int64 commit_fee = 4 [json_name = "commit_fee" ];
1488
+
1489
+ /// The weight of the commitment transaction
1490
+ int64 commit_weight = 5 [ json_name = "commit_weight" ];
1491
+
1492
+ /**
1493
+ The required number of satoshis per kilo-weight that the requester will
1494
+ pay at all times, for both the funding transaction and commitment
1495
+ transaction. This value can later be updated once the channel is open.
1496
+ */
1497
+ int64 fee_per_kw = 6 [ json_name = "fee_per_kw" ];
1498
+ }
1499
+
1500
+ message WaitingCloseChannel {
1501
+ /// The pending channel waiting for closing tx to confirm
1502
+ PendingChannel channel = 1;
1503
+
1504
+ /// The balance in satoshis encumbered in this channel
1505
+ int64 limbo_balance = 2 [ json_name = "limbo_balance" ];
1506
+ }
1507
+
1508
+ message ClosedChannel {
1509
+ /// The pending channel to be closed
1510
+ PendingChannel channel = 1;
1511
+
1512
+ /// The transaction id of the closing transaction
1513
+ string closing_txid = 2 [ json_name = "closing_txid" ];
1514
+ }
1515
+
1516
+ message ForceClosedChannel {
1517
+ /// The pending channel to be force closed
1518
+ PendingChannel channel = 1 [ json_name = "channel" ];
1519
+
1520
+ /// The transaction id of the closing transaction
1521
+ string closing_txid = 2 [ json_name = "closing_txid" ];
1522
+
1523
+ /// The balance in satoshis encumbered in this pending channel
1524
+ int64 limbo_balance = 3 [ json_name = "limbo_balance" ];
1525
+
1526
+ /// The height at which funds can be sweeped into the wallet
1527
+ uint32 maturity_height = 4 [ json_name = "maturity_height" ];
1528
+
1529
+ /*
1530
+ Remaining # of blocks until the commitment output can be swept.
1531
+ Negative values indicate how many blocks have passed since becoming
1532
+ mature.
1533
+ */
1534
+ int32 blocks_til_maturity = 5 [ json_name = "blocks_til_maturity" ];
1535
+
1536
+ /// The total value of funds successfully recovered from this channel
1537
+ int64 recovered_balance = 6 [ json_name = "recovered_balance" ];
1538
+
1539
+ repeated PendingHTLC pending_htlcs = 8 [ json_name = "pending_htlcs" ];
1540
+ }
1541
+
1542
+ /// The balance in satoshis encumbered in pending channels
1543
+ int64 total_limbo_balance = 1 [ json_name = "total_limbo_balance" ];
1544
+
1545
+ /// Channels pending opening
1546
+ repeated PendingOpenChannel pending_open_channels = 2 [ json_name = "pending_open_channels" ];
1547
+
1548
+ /// Channels pending closing
1549
+ repeated ClosedChannel pending_closing_channels = 3 [ json_name = "pending_closing_channels" ];
1550
+
1551
+ /// Channels pending force closing
1552
+ repeated ForceClosedChannel pending_force_closing_channels = 4 [ json_name = "pending_force_closing_channels" ];
1553
+
1554
+ /// Channels waiting for closing tx to confirm
1555
+ repeated WaitingCloseChannel waiting_close_channels = 5 [ json_name = "waiting_close_channels" ];
1556
+ }
1557
+
1558
+ message ChannelEventSubscription {
1559
+ }
1560
+
1561
+ message ChannelEventUpdate {
1562
+ oneof channel {
1563
+ Channel open_channel = 1 [ json_name = "open_channel" ];
1564
+ ChannelCloseSummary closed_channel = 2 [ json_name = "closed_channel" ];
1565
+ ChannelPoint active_channel = 3 [ json_name = "active_channel" ];
1566
+ ChannelPoint inactive_channel = 4 [ json_name = "inactive_channel" ];
1567
+ }
1568
+
1569
+ enum UpdateType {
1570
+ OPEN_CHANNEL = 0;
1571
+ CLOSED_CHANNEL = 1;
1572
+ ACTIVE_CHANNEL = 2;
1573
+ INACTIVE_CHANNEL = 3;
1574
+ }
1575
+
1576
+ UpdateType type = 5 [ json_name = "type" ];
1577
+ }
1578
+
1579
+ message WalletBalanceRequest {
1580
+ }
1581
+ message WalletBalanceResponse {
1582
+ /// The balance of the wallet
1583
+ int64 total_balance = 1 [json_name = "total_balance"];
1584
+
1585
+ /// The confirmed balance of a wallet(with >= 1 confirmations)
1586
+ int64 confirmed_balance = 2 [json_name = "confirmed_balance"];
1587
+
1588
+ /// The unconfirmed balance of a wallet(with 0 confirmations)
1589
+ int64 unconfirmed_balance = 3 [json_name = "unconfirmed_balance"];
1590
+ }
1591
+
1592
+ message ChannelBalanceRequest {
1593
+ }
1594
+ message ChannelBalanceResponse {
1595
+ /// Sum of channels balances denominated in satoshis
1596
+ int64 balance = 1 [json_name = "balance"];
1597
+
1598
+ /// Sum of channels pending balances denominated in satoshis
1599
+ int64 pending_open_balance = 2 [json_name = "pending_open_balance"];
1600
+ }
1601
+
1602
+ message QueryRoutesRequest {
1603
+ /// The 33-byte hex-encoded public key for the payment destination
1604
+ string pub_key = 1;
1605
+
1606
+ /// The amount to send expressed in satoshis
1607
+ int64 amt = 2;
1608
+
1609
+ /**
1610
+ Deprecated. The max number of routes to return. In the future, QueryRoutes
1611
+ will only return a single route.
1612
+ */
1613
+ int32 num_routes = 3 [deprecated = true];
1614
+
1615
+ /// An optional CLTV delta from the current height that should be used for the timelock of the final hop
1616
+ int32 final_cltv_delta = 4;
1617
+
1618
+ /**
1619
+ The maximum number of satoshis that will be paid as a fee of the payment.
1620
+ This value can be represented either as a percentage of the amount being
1621
+ sent, or as a fixed amount of the maximum fee the user is willing the pay to
1622
+ send the payment.
1623
+ */
1624
+ FeeLimit fee_limit = 5;
1625
+
1626
+ /**
1627
+ A list of nodes to ignore during path finding.
1628
+ */
1629
+ repeated bytes ignored_nodes = 6;
1630
+
1631
+ /**
1632
+ A list of edges to ignore during path finding.
1633
+ */
1634
+ repeated EdgeLocator ignored_edges = 7;
1635
+
1636
+ /**
1637
+ The source node where the request route should originated from. If empty,
1638
+ self is assumed.
1639
+ */
1640
+ string source_pub_key = 8;
1641
+ }
1642
+
1643
+ message EdgeLocator {
1644
+ /// The short channel id of this edge.
1645
+ uint64 channel_id = 1;
1646
+
1647
+ /**
1648
+ The direction of this edge. If direction_reverse is false, the direction
1649
+ of this edge is from the channel endpoint with the lexicographically smaller
1650
+ pub key to the endpoint with the larger pub key. If direction_reverse is
1651
+ is true, the edge goes the other way.
1652
+ */
1653
+ bool direction_reverse = 2;
1654
+ }
1655
+
1656
+ message QueryRoutesResponse {
1657
+ repeated Route routes = 1 [json_name = "routes"];
1658
+ }
1659
+
1660
+ message Hop {
1661
+ /**
1662
+ The unique channel ID for the channel. The first 3 bytes are the block
1663
+ height, the next 3 the index within the block, and the last 2 bytes are the
1664
+ output index for the channel.
1665
+ */
1666
+ uint64 chan_id = 1 [json_name = "chan_id"];
1667
+ int64 chan_capacity = 2 [json_name = "chan_capacity"];
1668
+ int64 amt_to_forward = 3 [json_name = "amt_to_forward", deprecated = true];
1669
+ int64 fee = 4 [json_name = "fee", deprecated = true];
1670
+ uint32 expiry = 5 [json_name = "expiry"];
1671
+ int64 amt_to_forward_msat = 6 [json_name = "amt_to_forward_msat"];
1672
+ int64 fee_msat = 7 [json_name = "fee_msat"];
1673
+
1674
+ /**
1675
+ An optional public key of the hop. If the public key is given, the payment
1676
+ can be executed without relying on a copy of the channel graph.
1677
+ */
1678
+ string pub_key = 8 [json_name = "pub_key"];
1679
+ }
1680
+
1681
+ /**
1682
+ A path through the channel graph which runs over one or more channels in
1683
+ succession. This struct carries all the information required to craft the
1684
+ Sphinx onion packet, and send the payment along the first hop in the path. A
1685
+ route is only selected as valid if all the channels have sufficient capacity to
1686
+ carry the initial payment amount after fees are accounted for.
1687
+ */
1688
+ message Route {
1689
+
1690
+ /**
1691
+ The cumulative (final) time lock across the entire route. This is the CLTV
1692
+ value that should be extended to the first hop in the route. All other hops
1693
+ will decrement the time-lock as advertised, leaving enough time for all
1694
+ hops to wait for or present the payment preimage to complete the payment.
1695
+ */
1696
+ uint32 total_time_lock = 1 [json_name = "total_time_lock"];
1697
+
1698
+ /**
1699
+ The sum of the fees paid at each hop within the final route. In the case
1700
+ of a one-hop payment, this value will be zero as we don't need to pay a fee
1701
+ it ourself.
1702
+ */
1703
+ int64 total_fees = 2 [json_name = "total_fees", deprecated = true];
1704
+
1705
+ /**
1706
+ The total amount of funds required to complete a payment over this route.
1707
+ This value includes the cumulative fees at each hop. As a result, the HTLC
1708
+ extended to the first-hop in the route will need to have at least this many
1709
+ satoshis, otherwise the route will fail at an intermediate node due to an
1710
+ insufficient amount of fees.
1711
+ */
1712
+ int64 total_amt = 3 [json_name = "total_amt", deprecated = true];
1713
+
1714
+ /**
1715
+ Contains details concerning the specific forwarding details at each hop.
1716
+ */
1717
+ repeated Hop hops = 4 [json_name = "hops"];
1718
+
1719
+ /**
1720
+ The total fees in millisatoshis.
1721
+ */
1722
+ int64 total_fees_msat = 5 [json_name = "total_fees_msat"];
1723
+
1724
+ /**
1725
+ The total amount in millisatoshis.
1726
+ */
1727
+ int64 total_amt_msat = 6 [json_name = "total_amt_msat"];
1728
+ }
1729
+
1730
+ message NodeInfoRequest {
1731
+ /// The 33-byte hex-encoded compressed public of the target node
1732
+ string pub_key = 1;
1733
+ }
1734
+
1735
+ message NodeInfo {
1736
+
1737
+ /**
1738
+ An individual vertex/node within the channel graph. A node is
1739
+ connected to other nodes by one or more channel edges emanating from it. As
1740
+ the graph is directed, a node will also have an incoming edge attached to
1741
+ it for each outgoing edge.
1742
+ */
1743
+ LightningNode node = 1 [json_name = "node"];
1744
+
1745
+ uint32 num_channels = 2 [json_name = "num_channels"];
1746
+ int64 total_capacity = 3 [json_name = "total_capacity"];
1747
+ }
1748
+
1749
+ /**
1750
+ An individual vertex/node within the channel graph. A node is
1751
+ connected to other nodes by one or more channel edges emanating from it. As the
1752
+ graph is directed, a node will also have an incoming edge attached to it for
1753
+ each outgoing edge.
1754
+ */
1755
+ message LightningNode {
1756
+ uint32 last_update = 1 [ json_name = "last_update" ];
1757
+ string pub_key = 2 [ json_name = "pub_key" ];
1758
+ string alias = 3 [ json_name = "alias" ];
1759
+ repeated NodeAddress addresses = 4 [ json_name = "addresses" ];
1760
+ string color = 5 [ json_name = "color" ];
1761
+ }
1762
+
1763
+ message NodeAddress {
1764
+ string network = 1 [ json_name = "network" ];
1765
+ string addr = 2 [ json_name = "addr" ];
1766
+ }
1767
+
1768
+ message RoutingPolicy {
1769
+ uint32 time_lock_delta = 1 [json_name = "time_lock_delta"];
1770
+ int64 min_htlc = 2 [json_name = "min_htlc"];
1771
+ int64 fee_base_msat = 3 [json_name = "fee_base_msat"];
1772
+ int64 fee_rate_milli_msat = 4 [json_name = "fee_rate_milli_msat"];
1773
+ bool disabled = 5 [json_name = "disabled"];
1774
+ uint64 max_htlc_msat = 6 [json_name = "max_htlc_msat"];
1775
+ }
1776
+
1777
+ /**
1778
+ A fully authenticated channel along with all its unique attributes.
1779
+ Once an authenticated channel announcement has been processed on the network,
1780
+ then an instance of ChannelEdgeInfo encapsulating the channels attributes is
1781
+ stored. The other portions relevant to routing policy of a channel are stored
1782
+ within a ChannelEdgePolicy for each direction of the channel.
1783
+ */
1784
+ message ChannelEdge {
1785
+
1786
+ /**
1787
+ The unique channel ID for the channel. The first 3 bytes are the block
1788
+ height, the next 3 the index within the block, and the last 2 bytes are the
1789
+ output index for the channel.
1790
+ */
1791
+ uint64 channel_id = 1 [json_name = "channel_id"];
1792
+ string chan_point = 2 [json_name = "chan_point"];
1793
+
1794
+ uint32 last_update = 3 [json_name = "last_update"];
1795
+
1796
+ string node1_pub = 4 [json_name = "node1_pub"];
1797
+ string node2_pub = 5 [json_name = "node2_pub"];
1798
+
1799
+ int64 capacity = 6 [json_name = "capacity"];
1800
+
1801
+ RoutingPolicy node1_policy = 7 [json_name = "node1_policy"];
1802
+ RoutingPolicy node2_policy = 8 [json_name = "node2_policy"];
1803
+ }
1804
+
1805
+ message ChannelGraphRequest {
1806
+ /**
1807
+ Whether unannounced channels are included in the response or not. If set,
1808
+ unannounced channels are included. Unannounced channels are both private
1809
+ channels, and public channels that are not yet announced to the network.
1810
+ */
1811
+ bool include_unannounced = 1 [json_name = "include_unannounced"];
1812
+ }
1813
+
1814
+ /// Returns a new instance of the directed channel graph.
1815
+ message ChannelGraph {
1816
+ /// The list of `LightningNode`s in this channel graph
1817
+ repeated LightningNode nodes = 1 [json_name = "nodes"];
1818
+
1819
+ /// The list of `ChannelEdge`s in this channel graph
1820
+ repeated ChannelEdge edges = 2 [json_name = "edges"];
1821
+ }
1822
+
1823
+ message ChanInfoRequest {
1824
+ /**
1825
+ The unique channel ID for the channel. The first 3 bytes are the block
1826
+ height, the next 3 the index within the block, and the last 2 bytes are the
1827
+ output index for the channel.
1828
+ */
1829
+ uint64 chan_id = 1;
1830
+ }
1831
+
1832
+ message NetworkInfoRequest {
1833
+ }
1834
+ message NetworkInfo {
1835
+ uint32 graph_diameter = 1 [json_name = "graph_diameter"];
1836
+ double avg_out_degree = 2 [json_name = "avg_out_degree"];
1837
+ uint32 max_out_degree = 3 [json_name = "max_out_degree"];
1838
+
1839
+ uint32 num_nodes = 4 [json_name = "num_nodes"];
1840
+ uint32 num_channels = 5 [json_name = "num_channels"];
1841
+
1842
+ int64 total_network_capacity = 6 [json_name = "total_network_capacity"];
1843
+
1844
+ double avg_channel_size = 7 [json_name = "avg_channel_size"];
1845
+ int64 min_channel_size = 8 [json_name = "min_channel_size"];
1846
+ int64 max_channel_size = 9 [json_name = "max_channel_size"];
1847
+ int64 median_channel_size_sat = 10 [json_name = "median_channel_size_sat"];
1848
+
1849
+ // TODO(roasbeef): fee rate info, expiry
1850
+ // * also additional RPC for tracking fee info once in
1851
+ }
1852
+
1853
+ message StopRequest{}
1854
+ message StopResponse{}
1855
+
1856
+ message GraphTopologySubscription {}
1857
+ message GraphTopologyUpdate {
1858
+ repeated NodeUpdate node_updates = 1;
1859
+ repeated ChannelEdgeUpdate channel_updates = 2;
1860
+ repeated ClosedChannelUpdate closed_chans = 3;
1861
+ }
1862
+ message NodeUpdate {
1863
+ repeated string addresses = 1;
1864
+ string identity_key = 2;
1865
+ bytes global_features = 3;
1866
+ string alias = 4;
1867
+ }
1868
+ message ChannelEdgeUpdate {
1869
+ /**
1870
+ The unique channel ID for the channel. The first 3 bytes are the block
1871
+ height, the next 3 the index within the block, and the last 2 bytes are the
1872
+ output index for the channel.
1873
+ */
1874
+ uint64 chan_id = 1;
1875
+
1876
+ ChannelPoint chan_point = 2;
1877
+
1878
+ int64 capacity = 3;
1879
+
1880
+ RoutingPolicy routing_policy = 4;
1881
+
1882
+ string advertising_node = 5;
1883
+ string connecting_node = 6;
1884
+ }
1885
+ message ClosedChannelUpdate {
1886
+ /**
1887
+ The unique channel ID for the channel. The first 3 bytes are the block
1888
+ height, the next 3 the index within the block, and the last 2 bytes are the
1889
+ output index for the channel.
1890
+ */
1891
+ uint64 chan_id = 1;
1892
+ int64 capacity = 2;
1893
+ uint32 closed_height = 3;
1894
+ ChannelPoint chan_point = 4;
1895
+ }
1896
+
1897
+ message HopHint {
1898
+ /// The public key of the node at the start of the channel.
1899
+ string node_id = 1 [json_name = "node_id"];
1900
+
1901
+ /// The unique identifier of the channel.
1902
+ uint64 chan_id = 2 [json_name = "chan_id"];
1903
+
1904
+ /// The base fee of the channel denominated in millisatoshis.
1905
+ uint32 fee_base_msat = 3 [json_name = "fee_base_msat"];
1906
+
1907
+ /**
1908
+ The fee rate of the channel for sending one satoshi across it denominated in
1909
+ millionths of a satoshi.
1910
+ */
1911
+ uint32 fee_proportional_millionths = 4 [json_name = "fee_proportional_millionths"];
1912
+
1913
+ /// The time-lock delta of the channel.
1914
+ uint32 cltv_expiry_delta = 5 [json_name = "cltv_expiry_delta"];
1915
+ }
1916
+
1917
+ message RouteHint {
1918
+ /**
1919
+ A list of hop hints that when chained together can assist in reaching a
1920
+ specific destination.
1921
+ */
1922
+ repeated HopHint hop_hints = 1 [json_name = "hop_hints"];
1923
+ }
1924
+
1925
+ message Invoice {
1926
+ /**
1927
+ An optional memo to attach along with the invoice. Used for record keeping
1928
+ purposes for the invoice's creator, and will also be set in the description
1929
+ field of the encoded payment request if the description_hash field is not
1930
+ being used.
1931
+ */
1932
+ string memo = 1 [json_name = "memo"];
1933
+
1934
+ /** Deprecated. An optional cryptographic receipt of payment which is not
1935
+ implemented.
1936
+ */
1937
+ bytes receipt = 2 [json_name = "receipt", deprecated = true];
1938
+
1939
+ /**
1940
+ The hex-encoded preimage (32 byte) which will allow settling an incoming
1941
+ HTLC payable to this preimage
1942
+ */
1943
+ bytes r_preimage = 3 [json_name = "r_preimage"];
1944
+
1945
+ /// The hash of the preimage
1946
+ bytes r_hash = 4 [json_name = "r_hash"];
1947
+
1948
+ /// The value of this invoice in satoshis
1949
+ int64 value = 5 [json_name = "value"];
1950
+
1951
+ /// Whether this invoice has been fulfilled
1952
+ bool settled = 6 [json_name = "settled", deprecated = true];
1953
+
1954
+ /// When this invoice was created
1955
+ int64 creation_date = 7 [json_name = "creation_date"];
1956
+
1957
+ /// When this invoice was settled
1958
+ int64 settle_date = 8 [json_name = "settle_date"];
1959
+
1960
+ /**
1961
+ A bare-bones invoice for a payment within the Lightning Network. With the
1962
+ details of the invoice, the sender has all the data necessary to send a
1963
+ payment to the recipient.
1964
+ */
1965
+ string payment_request = 9 [json_name = "payment_request"];
1966
+
1967
+ /**
1968
+ Hash (SHA-256) of a description of the payment. Used if the description of
1969
+ payment (memo) is too long to naturally fit within the description field
1970
+ of an encoded payment request.
1971
+ */
1972
+ bytes description_hash = 10 [json_name = "description_hash"];
1973
+
1974
+ /// Payment request expiry time in seconds. Default is 3600 (1 hour).
1975
+ int64 expiry = 11 [json_name = "expiry"];
1976
+
1977
+ /// Fallback on-chain address.
1978
+ string fallback_addr = 12 [json_name = "fallback_addr"];
1979
+
1980
+ /// Delta to use for the time-lock of the CLTV extended to the final hop.
1981
+ uint64 cltv_expiry = 13 [json_name = "cltv_expiry"];
1982
+
1983
+ /**
1984
+ Route hints that can each be individually used to assist in reaching the
1985
+ invoice's destination.
1986
+ */
1987
+ repeated RouteHint route_hints = 14 [json_name = "route_hints"];
1988
+
1989
+ /// Whether this invoice should include routing hints for private channels.
1990
+ bool private = 15 [json_name = "private"];
1991
+
1992
+ /**
1993
+ The "add" index of this invoice. Each newly created invoice will increment
1994
+ this index making it monotonically increasing. Callers to the
1995
+ SubscribeInvoices call can use this to instantly get notified of all added
1996
+ invoices with an add_index greater than this one.
1997
+ */
1998
+ uint64 add_index = 16 [json_name = "add_index"];
1999
+
2000
+ /**
2001
+ The "settle" index of this invoice. Each newly settled invoice will
2002
+ increment this index making it monotonically increasing. Callers to the
2003
+ SubscribeInvoices call can use this to instantly get notified of all
2004
+ settled invoices with an settle_index greater than this one.
2005
+ */
2006
+ uint64 settle_index = 17 [json_name = "settle_index"];
2007
+
2008
+ /// Deprecated, use amt_paid_sat or amt_paid_msat.
2009
+ int64 amt_paid = 18 [json_name = "amt_paid", deprecated = true];
2010
+
2011
+ /**
2012
+ The amount that was accepted for this invoice, in satoshis. This will ONLY
2013
+ be set if this invoice has been settled. We provide this field as if the
2014
+ invoice was created with a zero value, then we need to record what amount
2015
+ was ultimately accepted. Additionally, it's possible that the sender paid
2016
+ MORE that was specified in the original invoice. So we'll record that here
2017
+ as well.
2018
+ */
2019
+ int64 amt_paid_sat = 19 [json_name = "amt_paid_sat"];
2020
+
2021
+ /**
2022
+ The amount that was accepted for this invoice, in millisatoshis. This will
2023
+ ONLY be set if this invoice has been settled. We provide this field as if
2024
+ the invoice was created with a zero value, then we need to record what
2025
+ amount was ultimately accepted. Additionally, it's possible that the sender
2026
+ paid MORE that was specified in the original invoice. So we'll record that
2027
+ here as well.
2028
+ */
2029
+ int64 amt_paid_msat = 20 [json_name = "amt_paid_msat"];
2030
+
2031
+ enum InvoiceState {
2032
+ OPEN = 0;
2033
+ SETTLED = 1;
2034
+ CANCELED = 2;
2035
+ ACCEPTED = 3;
2036
+ }
2037
+
2038
+ /**
2039
+ The state the invoice is in.
2040
+ */
2041
+ InvoiceState state = 21 [json_name = "state"];
2042
+ }
2043
+
2044
+ message AddInvoiceResponse {
2045
+ bytes r_hash = 1 [json_name = "r_hash"];
2046
+
2047
+ /**
2048
+ A bare-bones invoice for a payment within the Lightning Network. With the
2049
+ details of the invoice, the sender has all the data necessary to send a
2050
+ payment to the recipient.
2051
+ */
2052
+ string payment_request = 2 [json_name = "payment_request"];
2053
+
2054
+ /**
2055
+ The "add" index of this invoice. Each newly created invoice will increment
2056
+ this index making it monotonically increasing. Callers to the
2057
+ SubscribeInvoices call can use this to instantly get notified of all added
2058
+ invoices with an add_index greater than this one.
2059
+ */
2060
+ uint64 add_index = 16 [json_name = "add_index"];
2061
+ }
2062
+ message PaymentHash {
2063
+ /**
2064
+ The hex-encoded payment hash of the invoice to be looked up. The passed
2065
+ payment hash must be exactly 32 bytes, otherwise an error is returned.
2066
+ */
2067
+ string r_hash_str = 1 [json_name = "r_hash_str"];
2068
+
2069
+ /// The payment hash of the invoice to be looked up.
2070
+ bytes r_hash = 2 [json_name = "r_hash"];
2071
+ }
2072
+
2073
+ message ListInvoiceRequest {
2074
+ /// If set, only unsettled invoices will be returned in the response.
2075
+ bool pending_only = 1 [json_name = "pending_only"];
2076
+
2077
+ /**
2078
+ The index of an invoice that will be used as either the start or end of a
2079
+ query to determine which invoices should be returned in the response.
2080
+ */
2081
+ uint64 index_offset = 4 [json_name = "index_offset"];
2082
+
2083
+ /// The max number of invoices to return in the response to this query.
2084
+ uint64 num_max_invoices = 5 [json_name = "num_max_invoices"];
2085
+
2086
+ /**
2087
+ If set, the invoices returned will result from seeking backwards from the
2088
+ specified index offset. This can be used to paginate backwards.
2089
+ */
2090
+ bool reversed = 6 [json_name = "reversed"];
2091
+ }
2092
+ message ListInvoiceResponse {
2093
+ /**
2094
+ A list of invoices from the time slice of the time series specified in the
2095
+ request.
2096
+ */
2097
+ repeated Invoice invoices = 1 [json_name = "invoices"];
2098
+
2099
+ /**
2100
+ The index of the last item in the set of returned invoices. This can be used
2101
+ to seek further, pagination style.
2102
+ */
2103
+ uint64 last_index_offset = 2 [json_name = "last_index_offset"];
2104
+
2105
+ /**
2106
+ The index of the last item in the set of returned invoices. This can be used
2107
+ to seek backwards, pagination style.
2108
+ */
2109
+ uint64 first_index_offset = 3 [json_name = "first_index_offset"];
2110
+ }
2111
+
2112
+ message InvoiceSubscription {
2113
+ /**
2114
+ If specified (non-zero), then we'll first start by sending out
2115
+ notifications for all added indexes with an add_index greater than this
2116
+ value. This allows callers to catch up on any events they missed while they
2117
+ weren't connected to the streaming RPC.
2118
+ */
2119
+ uint64 add_index = 1 [json_name = "add_index"];
2120
+
2121
+ /**
2122
+ If specified (non-zero), then we'll first start by sending out
2123
+ notifications for all settled indexes with an settle_index greater than
2124
+ this value. This allows callers to catch up on any events they missed while
2125
+ they weren't connected to the streaming RPC.
2126
+ */
2127
+ uint64 settle_index = 2 [json_name = "settle_index"];
2128
+ }
2129
+
2130
+
2131
+ message Payment {
2132
+ /// The payment hash
2133
+ string payment_hash = 1 [json_name = "payment_hash"];
2134
+
2135
+ /// Deprecated, use value_sat or value_msat.
2136
+ int64 value = 2 [json_name = "value", deprecated = true];
2137
+
2138
+ /// The date of this payment
2139
+ int64 creation_date = 3 [json_name = "creation_date"];
2140
+
2141
+ /// The path this payment took
2142
+ repeated string path = 4 [ json_name = "path" ];
2143
+
2144
+ /// The fee paid for this payment in satoshis
2145
+ int64 fee = 5 [json_name = "fee"];
2146
+
2147
+ /// The payment preimage
2148
+ string payment_preimage = 6 [json_name = "payment_preimage"];
2149
+
2150
+ /// The value of the payment in satoshis
2151
+ int64 value_sat = 7 [json_name = "value_sat"];
2152
+
2153
+ /// The value of the payment in milli-satoshis
2154
+ int64 value_msat = 8 [json_name = "value_msat"];
2155
+ }
2156
+
2157
+ message ListPaymentsRequest {
2158
+ }
2159
+
2160
+ message ListPaymentsResponse {
2161
+ /// The list of payments
2162
+ repeated Payment payments = 1 [json_name = "payments"];
2163
+ }
2164
+
2165
+ message DeleteAllPaymentsRequest {
2166
+ }
2167
+
2168
+ message DeleteAllPaymentsResponse {
2169
+ }
2170
+
2171
+ message AbandonChannelRequest {
2172
+ ChannelPoint channel_point = 1;
2173
+ }
2174
+
2175
+ message AbandonChannelResponse {
2176
+ }
2177
+
2178
+
2179
+ message DebugLevelRequest {
2180
+ bool show = 1;
2181
+ string level_spec = 2;
2182
+ }
2183
+ message DebugLevelResponse {
2184
+ string sub_systems = 1 [json_name = "sub_systems"];
2185
+ }
2186
+
2187
+ message PayReqString {
2188
+ /// The payment request string to be decoded
2189
+ string pay_req = 1;
2190
+ }
2191
+ message PayReq {
2192
+ string destination = 1 [json_name = "destination"];
2193
+ string payment_hash = 2 [json_name = "payment_hash"];
2194
+ int64 num_satoshis = 3 [json_name = "num_satoshis"];
2195
+ int64 timestamp = 4 [json_name = "timestamp"];
2196
+ int64 expiry = 5 [json_name = "expiry"];
2197
+ string description = 6 [json_name = "description"];
2198
+ string description_hash = 7 [json_name = "description_hash"];
2199
+ string fallback_addr = 8 [json_name = "fallback_addr"];
2200
+ int64 cltv_expiry = 9 [json_name = "cltv_expiry"];
2201
+ repeated RouteHint route_hints = 10 [json_name = "route_hints"];
2202
+ }
2203
+
2204
+ message FeeReportRequest {}
2205
+ message ChannelFeeReport {
2206
+ /// The channel that this fee report belongs to.
2207
+ string chan_point = 1 [json_name = "channel_point"];
2208
+
2209
+ /// The base fee charged regardless of the number of milli-satoshis sent.
2210
+ int64 base_fee_msat = 2 [json_name = "base_fee_msat"];
2211
+
2212
+ /// The amount charged per milli-satoshis transferred expressed in millionths of a satoshi.
2213
+ int64 fee_per_mil = 3 [json_name = "fee_per_mil"];
2214
+
2215
+ /// The effective fee rate in milli-satoshis. Computed by dividing the fee_per_mil value by 1 million.
2216
+ double fee_rate = 4 [json_name = "fee_rate"];
2217
+ }
2218
+ message FeeReportResponse {
2219
+ /// An array of channel fee reports which describes the current fee schedule for each channel.
2220
+ repeated ChannelFeeReport channel_fees = 1 [json_name = "channel_fees"];
2221
+
2222
+ /// The total amount of fee revenue (in satoshis) the switch has collected over the past 24 hrs.
2223
+ uint64 day_fee_sum = 2 [json_name = "day_fee_sum"];
2224
+
2225
+ /// The total amount of fee revenue (in satoshis) the switch has collected over the past 1 week.
2226
+ uint64 week_fee_sum = 3 [json_name = "week_fee_sum"];
2227
+
2228
+ /// The total amount of fee revenue (in satoshis) the switch has collected over the past 1 month.
2229
+ uint64 month_fee_sum = 4 [json_name = "month_fee_sum"];
2230
+ }
2231
+
2232
+ message PolicyUpdateRequest {
2233
+ oneof scope {
2234
+ /// If set, then this update applies to all currently active channels.
2235
+ bool global = 1 [json_name = "global"] ;
2236
+
2237
+ /// If set, this update will target a specific channel.
2238
+ ChannelPoint chan_point = 2 [json_name = "chan_point"];
2239
+ }
2240
+
2241
+ /// The base fee charged regardless of the number of milli-satoshis sent.
2242
+ int64 base_fee_msat = 3 [json_name = "base_fee_msat"];
2243
+
2244
+ /// The effective fee rate in milli-satoshis. The precision of this value goes up to 6 decimal places, so 1e-6.
2245
+ double fee_rate = 4 [json_name = "fee_rate"];
2246
+
2247
+ /// The required timelock delta for HTLCs forwarded over the channel.
2248
+ uint32 time_lock_delta = 5 [json_name = "time_lock_delta"];
2249
+ }
2250
+ message PolicyUpdateResponse {
2251
+ }
2252
+
2253
+ message ForwardingHistoryRequest {
2254
+ /// Start time is the starting point of the forwarding history request. All records beyond this point will be included, respecting the end time, and the index offset.
2255
+ uint64 start_time = 1 [json_name = "start_time"];
2256
+
2257
+ /// End time is the end point of the forwarding history request. The response will carry at most 50k records between the start time and the end time. The index offset can be used to implement pagination.
2258
+ uint64 end_time = 2 [json_name = "end_time"];
2259
+
2260
+ /// Index offset is the offset in the time series to start at. As each response can only contain 50k records, callers can use this to skip around within a packed time series.
2261
+ uint32 index_offset = 3 [json_name = "index_offset"];
2262
+
2263
+ /// The max number of events to return in the response to this query.
2264
+ uint32 num_max_events = 4 [json_name = "num_max_events"];
2265
+ }
2266
+ message ForwardingEvent {
2267
+ /// Timestamp is the time (unix epoch offset) that this circuit was completed.
2268
+ uint64 timestamp = 1 [json_name = "timestamp"];
2269
+
2270
+ /// The incoming channel ID that carried the HTLC that created the circuit.
2271
+ uint64 chan_id_in = 2 [json_name = "chan_id_in"];
2272
+
2273
+ /// The outgoing channel ID that carried the preimage that completed the circuit.
2274
+ uint64 chan_id_out = 4 [json_name = "chan_id_out"];
2275
+
2276
+ /// The total amount (in satoshis) of the incoming HTLC that created half the circuit.
2277
+ uint64 amt_in = 5 [json_name = "amt_in"];
2278
+
2279
+ /// The total amount (in satoshis) of the outgoing HTLC that created the second half of the circuit.
2280
+ uint64 amt_out = 6 [json_name = "amt_out"];
2281
+
2282
+ /// The total fee (in satoshis) that this payment circuit carried.
2283
+ uint64 fee = 7 [json_name = "fee"];
2284
+
2285
+ /// The total fee (in milli-satoshis) that this payment circuit carried.
2286
+ uint64 fee_msat = 8 [json_name = "fee_msat"];
2287
+
2288
+ // TODO(roasbeef): add settlement latency?
2289
+ // * use FPE on the chan id?
2290
+ // * also list failures?
2291
+ }
2292
+ message ForwardingHistoryResponse {
2293
+ /// A list of forwarding events from the time slice of the time series specified in the request.
2294
+ repeated ForwardingEvent forwarding_events = 1 [json_name = "forwarding_events"];
2295
+
2296
+ /// The index of the last time in the set of returned forwarding events. Can be used to seek further, pagination style.
2297
+ uint32 last_offset_index = 2 [json_name = "last_offset_index"];
2298
+ }
2299
+
2300
+ message ExportChannelBackupRequest {
2301
+ /// The target chanenl point to obtain a back up for.
2302
+ ChannelPoint chan_point = 1;
2303
+ }
2304
+
2305
+ message ChannelBackup {
2306
+ /**
2307
+ Identifies the channel that this backup belongs to.
2308
+ */
2309
+ ChannelPoint chan_point = 1 [ json_name = "chan_point" ];
2310
+
2311
+ /**
2312
+ Is an encrypted single-chan backup. this can be passed to
2313
+ RestoreChannelBackups, or the WalletUnlocker Innit and Unlock methods in
2314
+ order to trigger the recovery protocol.
2315
+ */
2316
+ bytes chan_backup = 2 [ json_name = "chan_backup" ];
2317
+ }
2318
+
2319
+ message MultiChanBackup {
2320
+ /**
2321
+ Is the set of all channels that are included in this multi-channel backup.
2322
+ */
2323
+ repeated ChannelPoint chan_points = 1 [ json_name = "chan_points" ];
2324
+
2325
+ /**
2326
+ A single encrypted blob containing all the static channel backups of the
2327
+ channel listed above. This can be stored as a single file or blob, and
2328
+ safely be replaced with any prior/future versions.
2329
+ */
2330
+ bytes multi_chan_backup = 2 [ json_name = "multi_chan_backup" ];
2331
+ }
2332
+
2333
+ message ChanBackupExportRequest {}
2334
+ message ChanBackupSnapshot {
2335
+ /**
2336
+ The set of new channels that have been added since the last channel backup
2337
+ snapshot was requested.
2338
+ */
2339
+ ChannelBackups single_chan_backups = 1 [ json_name = "single_chan_backups" ];
2340
+
2341
+ /**
2342
+ A multi-channel backup that covers all open channels currently known to
2343
+ lnd.
2344
+ */
2345
+ MultiChanBackup multi_chan_backup = 2 [ json_name = "multi_chan_backup" ];
2346
+ }
2347
+
2348
+ message ChannelBackups {
2349
+ /**
2350
+ A set of single-chan static channel backups.
2351
+ */
2352
+ repeated ChannelBackup chan_backups = 1 [ json_name = "chan_backups" ];
2353
+ }
2354
+
2355
+ message RestoreChanBackupRequest {
2356
+ oneof backup {
2357
+ ChannelBackups chan_backups = 1 [ json_name = "chan_backups" ];
2358
+
2359
+ bytes multi_chan_backup = 2 [ json_name = "multi_chan_backup" ];
2360
+ }
2361
+ }
2362
+ message RestoreBackupResponse {}
2363
+
2364
+ message ChannelBackupSubscription {}
2365
+
2366
+ message VerifyChanBackupResponse {
2367
+ }