faraday_ln_paywall 0.1.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e4b36c056ecb79191ceb42493b4672204e987df6
4
- data.tar.gz: 239fcea1e9093d674879cad9ff9280e41ed21431
2
+ SHA256:
3
+ metadata.gz: 84b0361af6c8e3cb6b8b06148946df494ff62ee6255846d4c3e4a42e4a08d617
4
+ data.tar.gz: 72870afc92a2179c240af8b09c369c06ab69d3c6ff64b6736300be2cde484d8a
5
5
  SHA512:
6
- metadata.gz: af6d7c79810f155208ca721122449d9a2be992ecba5297036a4c5be26c162f2044449472aec862abf567eaed063031ade574946a14e8606c41bd3549daf968f1
7
- data.tar.gz: a83bbe7be6d258fcd0931b55afb3383ab99056b32a123b9433a86461020360c66e0cdc073d2eda74104a704222997eb90abbd461ab428de25180155ae42e629f
6
+ metadata.gz: f2c05fe1910fd6ae34d45c28110c7206443951aebb8099921b735616f783318bd8e1721b0cc37dcb52af0f749cf2a1762d4bd894288b474f00e0139020ae42bc
7
+ data.tar.gz: ca3d78fab9a18d89ef5671955900f2edd01ce72143bdc49603126c4b39e4a874e0b8f98965e416d696a52ab15b0eb8a65ddff452eed04ca3eef1139120028655
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Faraday middleware for lightning paywalls
1
+ # Faraday middleware to send lightning payments
2
2
 
3
3
  This is a [Faraday](https://github.com/lostisland/faraday#readme) middleware that handles payment requests by the server
4
4
  and sends Bitcoin [lightning payments](https://lightning.network/).
@@ -54,6 +54,7 @@ The middleware accepts the following configuration options:
54
54
  * `credentials`: instead of configuring a `credentials_path` you can pass the content of the tls.cert directly
55
55
  * `macaroon`: instead of configuring a `macaroon_path` you can pass the hex content of the macaroon directly
56
56
  you can get the macaroon content like this:
57
+ `xxd -p -c2000 admin.macaroon` or:
57
58
  ```ruby
58
59
  ::File.read(::File.expand_path("/path/to/admin.macaroon")).each_byte.map { |b| b.to_s(16).rjust(2,'0') }.join
59
60
  ```
@@ -68,6 +69,11 @@ Thanks to this properties it can be used to monetize APIs.
68
69
 
69
70
  Bug reports and pull requests are welcome on GitHub at https://github.com/bumi/faraday_ln_paywall.
70
71
 
72
+ ## ToDo
73
+
74
+ - [ ] namespace the grpc client
75
+ - [ ] tests!!
76
+
71
77
  ## License
72
78
 
73
79
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/example.rb CHANGED
@@ -2,13 +2,11 @@ require "bundler/setup"
2
2
  require "faraday_ln_paywall"
3
3
  require "faraday"
4
4
 
5
- conn = Faraday.new(:url => 'https://lightning-2pdf.herokuapp.com/') do |faraday|
6
- #conn = Faraday.new(:url => 'https://fourohtwo.herokuapp.com') do |faraday|
5
+ conn = Faraday.new(:url => 'https://fourohtwo.herokuapp.com') do |faraday|
7
6
  faraday.use FaradayLnPaywall::Middleware, {
8
- max_amount: 100,
7
+ max_amount: 1000,
9
8
  timeout: 300
10
9
  }
11
10
  faraday.adapter Faraday.default_adapter
12
11
  end
13
- puts conn.post("/html", "# hallo").body
14
- # puts conn.get("/402").body
12
+ puts conn.get("/402").body
@@ -28,5 +28,5 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  spec.add_dependency "lightning-invoice", "~> 0.1.2"
30
30
  spec.add_dependency "faraday", "> 0.8"
31
- spec.add_dependency "grpc", ">= 1.16.0"
31
+ spec.add_dependency "lnrpc", "~> 0.6.1"
32
32
  end
@@ -2,8 +2,6 @@ require "faraday"
2
2
  require "faraday_ln_paywall/version"
3
3
  require "faraday_ln_paywall/middleware"
4
4
 
5
- require 'faraday_ln_paywall/rpc_services_pb'
6
-
7
5
  module FaradayLnPaywall
8
6
 
9
7
  end
@@ -1,8 +1,6 @@
1
- require 'grpc'
1
+ require 'lnrpc'
2
2
  require 'lightning/invoice'
3
3
 
4
- ENV['GRPC_SSL_CIPHER_SUITES'] = "HIGH+ECDSA"
5
-
6
4
  module FaradayLnPaywall
7
5
  class PaymentError < StandardError; end
8
6
 
@@ -11,14 +9,8 @@ module FaradayLnPaywall
11
9
  def initialize(app, options = {})
12
10
  super(app)
13
11
  @options = options
14
- @options[:address] ||= 'localhost:10009'
15
- @options[:timeout] ||= 5
16
- @options[:credentials] ||= File.read(File.expand_path(@options[:credentials_path] || "~/.lnd/tls.cert"))
17
- @options[:macaroon] ||= begin
18
- macaroon_binary = ::File.read(::File.expand_path(@options[:macaroon_path] || "~/.lnd/data/chain/bitcoin/testnet/admin.macaroon"))
19
- macaroon_binary.each_byte.map { |b| b.to_s(16).rjust(2,'0') }.join
20
- end
21
- @lnd_client = Lnrpc::Lightning::Stub.new(@options[:address], GRPC::Core::ChannelCredentials.new(@options[:credentials]))
12
+ @options[:timeout] ||= 30
13
+ @lnd_client = Lnrpc::Client.new(@options)
22
14
  end
23
15
 
24
16
  def payment_requested?(env)
@@ -36,13 +28,12 @@ module FaradayLnPaywall
36
28
 
37
29
  def pay(env)
38
30
  invoice = Lightning::Invoice.parse(env.body)
31
+ log(:info, "amount: #{invoice_amount_in_satoshi(invoice)} description: #{invoice.description} payment_hash: #{invoice.payment_hash}")
39
32
  validate_invoice!(invoice)
40
33
 
41
34
  Timeout::timeout(@options[:timeout], PaymentError, "payment execution expired") do
42
- @lnd_client.send_payment_sync(
43
- Lnrpc::SendRequest.new(payment_request: env.body),
44
- { metadata: { macaroon: @options[:macaroon] }}
45
- )
35
+ log(:info, "sending payment")
36
+ @lnd_client.send_payment_sync(payment_request: env.body)
46
37
  end
47
38
  end
48
39
 
@@ -51,12 +42,16 @@ module FaradayLnPaywall
51
42
  response = @app.call(request_env)
52
43
  response.on_complete do |response_env|
53
44
  if payment_requested?(response_env)
45
+ log(:info, "payment requested")
54
46
  payment = pay(response_env)
55
47
  if payment && payment.payment_error == ""
56
- preimage = payment.payment_preimage.each_byte.map { |b| b.to_s(16).rjust(2, '0') }.join
48
+ preimage = payment.payment_preimage.each_byte.map { |b| b.to_s(16).rjust(2, '0') }.join # .unpack("H*")
49
+ log(:info, "paid preimage: #{preimage}")
57
50
  original_call[:request_headers].merge!('X-Preimage' => preimage)
51
+ log(:info, "sending original request with preimage header")
58
52
  response = @app.call(original_call)
59
53
  else
54
+ log(:error, "payment error #{payment.payment_error}")
60
55
  raise PaymentError, payment.payment_error
61
56
  end
62
57
  end
@@ -76,6 +71,10 @@ module FaradayLnPaywall
76
71
 
77
72
  (invoice.amount * multi * 100000000).to_i # amount in bitcoin * 100000000
78
73
  end
74
+
75
+ def log(level, message)
76
+ @options[:logger].send(level, message) if @options[:logger]
77
+ end
79
78
  end
80
79
  end
81
80
 
@@ -1,3 +1,3 @@
1
1
  module FaradayLnPaywall
2
- VERSION = "0.1.1"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday_ln_paywall
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - bumi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-22 00:00:00.000000000 Z
11
+ date: 2019-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -81,19 +81,19 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.8'
83
83
  - !ruby/object:Gem::Dependency
84
- name: grpc
84
+ name: lnrpc
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 1.16.0
89
+ version: 0.6.1
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 1.16.0
96
+ version: 0.6.1
97
97
  description: Sends payments
98
98
  email:
99
99
  - hello@michaelbumann.com
@@ -114,9 +114,6 @@ files:
114
114
  - faraday_ln_paywall.gemspec
115
115
  - lib/faraday_ln_paywall.rb
116
116
  - lib/faraday_ln_paywall/middleware.rb
117
- - lib/faraday_ln_paywall/rpc.proto
118
- - lib/faraday_ln_paywall/rpc_pb.rb
119
- - lib/faraday_ln_paywall/rpc_services_pb.rb
120
117
  - lib/faraday_ln_paywall/version.rb
121
118
  homepage: https://github.com/bumi/faraday_ln_paywall
122
119
  licenses:
@@ -137,8 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
134
  - !ruby/object:Gem::Version
138
135
  version: '0'
139
136
  requirements: []
140
- rubyforge_project:
141
- rubygems_version: 2.6.11
137
+ rubygems_version: 3.0.1
142
138
  signing_key:
143
139
  specification_version: 4
144
140
  summary: Faraday middleware to send lightning payments for requests
@@ -1,1967 +0,0 @@
1
- syntax = "proto3";
2
-
3
- import "google/api/annotations.proto";
4
-
5
- package lnrpc;
6
- /**
7
- * Comments in this file will be directly parsed into the API
8
- * Documentation as descriptions of the associated method, message, or field.
9
- * These descriptions should go right above the definition of the object, and
10
- * can be in either block or /// comment format.
11
- *
12
- * One edge case exists where a // comment followed by a /// comment in the
13
- * next line will cause the description not to show up in the documentation. In
14
- * that instance, simply separate the two comments with a blank line.
15
- *
16
- * An RPC method can be matched to an lncli command by placing a line in the
17
- * beginning of the description in exactly the following format:
18
- * lncli: `methodname`
19
- *
20
- * Failure to specify the exact name of the command will cause documentation
21
- * generation to fail.
22
- *
23
- * More information on how exactly the gRPC documentation is generated from
24
- * this proto file can be found here:
25
- * https://github.com/lightninglabs/lightning-api
26
- */
27
-
28
- // The WalletUnlocker service is used to set up a wallet password for
29
- // lnd at first startup, and unlock a previously set up wallet.
30
- service WalletUnlocker {
31
- /**
32
- GenSeed is the first method that should be used to instantiate a new lnd
33
- instance. This method allows a caller to generate a new aezeed cipher seed
34
- given an optional passphrase. If provided, the passphrase will be necessary
35
- to decrypt the cipherseed to expose the internal wallet seed.
36
-
37
- Once the cipherseed is obtained and verified by the user, the InitWallet
38
- method should be used to commit the newly generated seed, and create the
39
- wallet.
40
- */
41
- rpc GenSeed(GenSeedRequest) returns (GenSeedResponse) {
42
- option (google.api.http) = {
43
- get: "/v1/genseed"
44
- };
45
- }
46
-
47
- /**
48
- InitWallet is used when lnd is starting up for the first time to fully
49
- initialize the daemon and its internal wallet. At the very least a wallet
50
- password must be provided. This will be used to encrypt sensitive material
51
- on disk.
52
-
53
- In the case of a recovery scenario, the user can also specify their aezeed
54
- mnemonic and passphrase. If set, then the daemon will use this prior state
55
- to initialize its internal wallet.
56
-
57
- Alternatively, this can be used along with the GenSeed RPC to obtain a
58
- seed, then present it to the user. Once it has been verified by the user,
59
- the seed can be fed into this RPC in order to commit the new wallet.
60
- */
61
- rpc InitWallet(InitWalletRequest) returns (InitWalletResponse) {
62
- option (google.api.http) = {
63
- post: "/v1/initwallet"
64
- body: "*"
65
- };
66
- }
67
-
68
- /** lncli: `unlock`
69
- UnlockWallet is used at startup of lnd to provide a password to unlock
70
- the wallet database.
71
- */
72
- rpc UnlockWallet(UnlockWalletRequest) returns (UnlockWalletResponse) {
73
- option (google.api.http) = {
74
- post: "/v1/unlockwallet"
75
- body: "*"
76
- };
77
- }
78
-
79
- /** lncli: `changepassword`
80
- ChangePassword changes the password of the encrypted wallet. This will
81
- automatically unlock the wallet database if successful.
82
- */
83
- rpc ChangePassword (ChangePasswordRequest) returns (ChangePasswordResponse) {
84
- option (google.api.http) = {
85
- post: "/v1/changepassword"
86
- body: "*"
87
- };
88
- }
89
- }
90
-
91
- message GenSeedRequest {
92
- /**
93
- aezeed_passphrase is an optional user provided passphrase that will be used
94
- to encrypt the generated aezeed cipher seed.
95
- */
96
- bytes aezeed_passphrase = 1;
97
-
98
- /**
99
- seed_entropy is an optional 16-bytes generated via CSPRNG. If not
100
- specified, then a fresh set of randomness will be used to create the seed.
101
- */
102
- bytes seed_entropy = 2;
103
- }
104
- message GenSeedResponse {
105
- /**
106
- cipher_seed_mnemonic is a 24-word mnemonic that encodes a prior aezeed
107
- cipher seed obtained by the user. This field is optional, as if not
108
- provided, then the daemon will generate a new cipher seed for the user.
109
- Otherwise, then the daemon will attempt to recover the wallet state linked
110
- to this cipher seed.
111
- */
112
- repeated string cipher_seed_mnemonic = 1;
113
-
114
- /**
115
- enciphered_seed are the raw aezeed cipher seed bytes. This is the raw
116
- cipher text before run through our mnemonic encoding scheme.
117
- */
118
- bytes enciphered_seed = 2;
119
- }
120
-
121
- message InitWalletRequest {
122
- /**
123
- wallet_password is the passphrase that should be used to encrypt the
124
- wallet. This MUST be at least 8 chars in length. After creation, this
125
- password is required to unlock the daemon.
126
- */
127
- bytes wallet_password = 1;
128
-
129
- /**
130
- cipher_seed_mnemonic is a 24-word mnemonic that encodes a prior aezeed
131
- cipher seed obtained by the user. This may have been generated by the
132
- GenSeed method, or be an existing seed.
133
- */
134
- repeated string cipher_seed_mnemonic = 2;
135
-
136
- /**
137
- aezeed_passphrase is an optional user provided passphrase that will be used
138
- to encrypt the generated aezeed cipher seed.
139
- */
140
- bytes aezeed_passphrase = 3;
141
-
142
- /**
143
- recovery_window is an optional argument specifying the address lookahead
144
- when restoring a wallet seed. The recovery window applies to each
145
- invdividual branch of the BIP44 derivation paths. Supplying a recovery
146
- window of zero indicates that no addresses should be recovered, such after
147
- the first initialization of the wallet.
148
- */
149
- int32 recovery_window = 4;
150
- }
151
- message InitWalletResponse {
152
- }
153
-
154
- message UnlockWalletRequest {
155
- /**
156
- wallet_password should be the current valid passphrase for the daemon. This
157
- will be required to decrypt on-disk material that the daemon requires to
158
- function properly.
159
- */
160
- bytes wallet_password = 1;
161
-
162
- /**
163
- recovery_window is an optional argument specifying the address lookahead
164
- when restoring a wallet seed. The recovery window applies to each
165
- invdividual branch of the BIP44 derivation paths. Supplying a recovery
166
- window of zero indicates that no addresses should be recovered, such after
167
- the first initialization of the wallet.
168
- */
169
- int32 recovery_window = 2;
170
- }
171
- message UnlockWalletResponse {}
172
-
173
- message ChangePasswordRequest {
174
- /**
175
- current_password should be the current valid passphrase used to unlock the
176
- daemon.
177
- */
178
- bytes current_password = 1;
179
-
180
- /**
181
- new_password should be the new passphrase that will be needed to unlock the
182
- daemon.
183
- */
184
- bytes new_password = 2;
185
- }
186
- message ChangePasswordResponse {}
187
-
188
- service Lightning {
189
- /** lncli: `walletbalance`
190
- WalletBalance returns total unspent outputs(confirmed and unconfirmed), all
191
- confirmed unspent outputs and all unconfirmed unspent outputs under control
192
- of the wallet.
193
- */
194
- rpc WalletBalance (WalletBalanceRequest) returns (WalletBalanceResponse) {
195
- option (google.api.http) = {
196
- get: "/v1/balance/blockchain"
197
- };
198
- }
199
-
200
- /** lncli: `channelbalance`
201
- ChannelBalance returns the total funds available across all open channels
202
- in satoshis.
203
- */
204
- rpc ChannelBalance (ChannelBalanceRequest) returns (ChannelBalanceResponse) {
205
- option (google.api.http) = {
206
- get: "/v1/balance/channels"
207
- };
208
- }
209
-
210
- /** lncli: `listchaintxns`
211
- GetTransactions returns a list describing all the known transactions
212
- relevant to the wallet.
213
- */
214
- rpc GetTransactions (GetTransactionsRequest) returns (TransactionDetails) {
215
- option (google.api.http) = {
216
- get: "/v1/transactions"
217
- };
218
- }
219
-
220
- /** lncli: `sendcoins`
221
- SendCoins executes a request to send coins to a particular address. Unlike
222
- SendMany, this RPC call only allows creating a single output at a time. If
223
- neither target_conf, or sat_per_byte are set, then the internal wallet will
224
- consult its fee model to determine a fee for the default confirmation
225
- target.
226
- */
227
- rpc SendCoins (SendCoinsRequest) returns (SendCoinsResponse) {
228
- option (google.api.http) = {
229
- post: "/v1/transactions"
230
- body: "*"
231
- };
232
- }
233
-
234
- /**
235
- SubscribeTransactions creates a uni-directional stream from the server to
236
- the client in which any newly discovered transactions relevant to the
237
- wallet are sent over.
238
- */
239
- rpc SubscribeTransactions (GetTransactionsRequest) returns (stream Transaction);
240
-
241
- /** lncli: `sendmany`
242
- SendMany handles a request for a transaction that creates multiple specified
243
- outputs in parallel. If neither target_conf, or sat_per_byte are set, then
244
- the internal wallet will consult its fee model to determine a fee for the
245
- default confirmation target.
246
- */
247
- rpc SendMany (SendManyRequest) returns (SendManyResponse);
248
-
249
- /** lncli: `newaddress`
250
- NewAddress creates a new address under control of the local wallet.
251
- */
252
- rpc NewAddress (NewAddressRequest) returns (NewAddressResponse) {
253
- option (google.api.http) = {
254
- get: "/v1/newaddress"
255
- };
256
- }
257
-
258
- /** lncli: `signmessage`
259
- SignMessage signs a message with this node's private key. The returned
260
- signature string is `zbase32` encoded and pubkey recoverable, meaning that
261
- only the message digest and signature are needed for verification.
262
- */
263
- rpc SignMessage (SignMessageRequest) returns (SignMessageResponse);
264
-
265
- /** lncli: `verifymessage`
266
- VerifyMessage verifies a signature over a msg. The signature must be
267
- zbase32 encoded and signed by an active node in the resident node's
268
- channel database. In addition to returning the validity of the signature,
269
- VerifyMessage also returns the recovered pubkey from the signature.
270
- */
271
- rpc VerifyMessage (VerifyMessageRequest) returns (VerifyMessageResponse);
272
-
273
- /** lncli: `connect`
274
- ConnectPeer attempts to establish a connection to a remote peer. This is at
275
- the networking level, and is used for communication between nodes. This is
276
- distinct from establishing a channel with a peer.
277
- */
278
- rpc ConnectPeer (ConnectPeerRequest) returns (ConnectPeerResponse) {
279
- option (google.api.http) = {
280
- post: "/v1/peers"
281
- body: "*"
282
- };
283
- }
284
-
285
- /** lncli: `disconnect`
286
- DisconnectPeer attempts to disconnect one peer from another identified by a
287
- given pubKey. In the case that we currently have a pending or active channel
288
- with the target peer, then this action will be not be allowed.
289
- */
290
- rpc DisconnectPeer (DisconnectPeerRequest) returns (DisconnectPeerResponse) {
291
- option (google.api.http) = {
292
- delete: "/v1/peers/{pub_key}"
293
- };
294
- }
295
-
296
- /** lncli: `listpeers`
297
- ListPeers returns a verbose listing of all currently active peers.
298
- */
299
- rpc ListPeers (ListPeersRequest) returns (ListPeersResponse) {
300
- option (google.api.http) = {
301
- get: "/v1/peers"
302
- };
303
- }
304
-
305
- /** lncli: `getinfo`
306
- GetInfo returns general information concerning the lightning node including
307
- it's identity pubkey, alias, the chains it is connected to, and information
308
- concerning the number of open+pending channels.
309
- */
310
- rpc GetInfo (GetInfoRequest) returns (GetInfoResponse) {
311
- option (google.api.http) = {
312
- get: "/v1/getinfo"
313
- };
314
- }
315
-
316
- // TODO(roasbeef): merge with below with bool?
317
- /** lncli: `pendingchannels`
318
- PendingChannels returns a list of all the channels that are currently
319
- considered "pending". A channel is pending if it has finished the funding
320
- workflow and is waiting for confirmations for the funding txn, or is in the
321
- process of closure, either initiated cooperatively or non-cooperatively.
322
- */
323
- rpc PendingChannels (PendingChannelsRequest) returns (PendingChannelsResponse) {
324
- option (google.api.http) = {
325
- get: "/v1/channels/pending"
326
- };
327
- }
328
-
329
- /** lncli: `listchannels`
330
- ListChannels returns a description of all the open channels that this node
331
- is a participant in.
332
- */
333
- rpc ListChannels (ListChannelsRequest) returns (ListChannelsResponse) {
334
- option (google.api.http) = {
335
- get: "/v1/channels"
336
- };
337
- }
338
-
339
- /** lncli: `closedchannels`
340
- ClosedChannels returns a description of all the closed channels that
341
- this node was a participant in.
342
- */
343
- rpc ClosedChannels (ClosedChannelsRequest) returns (ClosedChannelsResponse) {
344
- option (google.api.http) = {
345
- get: "/v1/channels/closed"
346
- };
347
- }
348
-
349
-
350
- /**
351
- OpenChannelSync is a synchronous version of the OpenChannel RPC call. This
352
- call is meant to be consumed by clients to the REST proxy. As with all
353
- other sync calls, all byte slices are intended to be populated as hex
354
- encoded strings.
355
- */
356
- rpc OpenChannelSync (OpenChannelRequest) returns (ChannelPoint) {
357
- option (google.api.http) = {
358
- post: "/v1/channels"
359
- body: "*"
360
- };
361
- }
362
-
363
- /** lncli: `openchannel`
364
- OpenChannel attempts to open a singly funded channel specified in the
365
- request to a remote peer. Users are able to specify a target number of
366
- blocks that the funding transaction should be confirmed in, or a manual fee
367
- rate to us for the funding transaction. If neither are specified, then a
368
- lax block confirmation target is used.
369
- */
370
- rpc OpenChannel (OpenChannelRequest) returns (stream OpenStatusUpdate);
371
-
372
- /** lncli: `closechannel`
373
- CloseChannel attempts to close an active channel identified by its channel
374
- outpoint (ChannelPoint). The actions of this method can additionally be
375
- augmented to attempt a force close after a timeout period in the case of an
376
- inactive peer. If a non-force close (cooperative closure) is requested,
377
- then the user can specify either a target number of blocks until the
378
- closure transaction is confirmed, or a manual fee rate. If neither are
379
- specified, then a default lax, block confirmation target is used.
380
- */
381
- rpc CloseChannel (CloseChannelRequest) returns (stream CloseStatusUpdate) {
382
- option (google.api.http) = {
383
- delete: "/v1/channels/{channel_point.funding_txid_str}/{channel_point.output_index}"
384
- };
385
- }
386
-
387
- /** lncli: `abandonchannel`
388
- AbandonChannel removes all channel state from the database except for a
389
- close summary. This method can be used to get rid of permanently unusable
390
- channels due to bugs fixed in newer versions of lnd. Only available
391
- when in debug builds of lnd.
392
- */
393
- rpc AbandonChannel (AbandonChannelRequest) returns (AbandonChannelResponse) {
394
- option (google.api.http) = {
395
- delete: "/v1/channels/{channel_point.funding_txid_str}/{channel_point.output_index}"
396
- };
397
- }
398
-
399
-
400
- /** lncli: `sendpayment`
401
- SendPayment dispatches a bi-directional streaming RPC for sending payments
402
- through the Lightning Network. A single RPC invocation creates a persistent
403
- bi-directional stream allowing clients to rapidly send payments through the
404
- Lightning Network with a single persistent connection.
405
- */
406
- rpc SendPayment (stream SendRequest) returns (stream SendResponse);
407
-
408
- /**
409
- SendPaymentSync is the synchronous non-streaming version of SendPayment.
410
- This RPC is intended to be consumed by clients of the REST proxy.
411
- Additionally, this RPC expects the destination's public key and the payment
412
- hash (if any) to be encoded as hex strings.
413
- */
414
- rpc SendPaymentSync (SendRequest) returns (SendResponse) {
415
- option (google.api.http) = {
416
- post: "/v1/channels/transactions"
417
- body: "*"
418
- };
419
- }
420
-
421
- /** lncli: `sendtoroute`
422
- SendToRoute is a bi-directional streaming RPC for sending payment through
423
- the Lightning Network. This method differs from SendPayment in that it
424
- allows users to specify a full route manually. This can be used for things
425
- like rebalancing, and atomic swaps.
426
- */
427
- rpc SendToRoute(stream SendToRouteRequest) returns (stream SendResponse);
428
-
429
- /**
430
- SendToRouteSync is a synchronous version of SendToRoute. It Will block
431
- until the payment either fails or succeeds.
432
- */
433
- rpc SendToRouteSync (SendToRouteRequest) returns (SendResponse) {
434
- option (google.api.http) = {
435
- post: "/v1/channels/transactions/route"
436
- body: "*"
437
- };
438
- }
439
-
440
- /** lncli: `addinvoice`
441
- AddInvoice attempts to add a new invoice to the invoice database. Any
442
- duplicated invoices are rejected, therefore all invoices *must* have a
443
- unique payment preimage.
444
- */
445
- rpc AddInvoice (Invoice) returns (AddInvoiceResponse) {
446
- option (google.api.http) = {
447
- post: "/v1/invoices"
448
- body: "*"
449
- };
450
- }
451
-
452
- /** lncli: `listinvoices`
453
- ListInvoices returns a list of all the invoices currently stored within the
454
- database. Any active debug invoices are ignored. It has full support for
455
- paginated responses, allowing users to query for specific invoices through
456
- their add_index. This can be done by using either the first_index_offset or
457
- last_index_offset fields included in the response as the index_offset of the
458
- next request. The reversed flag is set by default in order to paginate
459
- backwards. If you wish to paginate forwards, you must explicitly set the
460
- flag to false. If none of the parameters are specified, then the last 100
461
- invoices will be returned.
462
- */
463
- rpc ListInvoices (ListInvoiceRequest) returns (ListInvoiceResponse) {
464
- option (google.api.http) = {
465
- get: "/v1/invoices"
466
- };
467
- }
468
-
469
- /** lncli: `lookupinvoice`
470
- LookupInvoice attempts to look up an invoice according to its payment hash.
471
- The passed payment hash *must* be exactly 32 bytes, if not, an error is
472
- returned.
473
- */
474
- rpc LookupInvoice (PaymentHash) returns (Invoice) {
475
- option (google.api.http) = {
476
- get: "/v1/invoice/{r_hash_str}"
477
- };
478
- }
479
-
480
- /**
481
- SubscribeInvoices returns a uni-directional stream (server -> client) for
482
- notifying the client of newly added/settled invoices. The caller can
483
- optionally specify the add_index and/or the settle_index. If the add_index
484
- is specified, then we'll first start by sending add invoice events for all
485
- invoices with an add_index greater than the specified value. If the
486
- settle_index is specified, the next, we'll send out all settle events for
487
- invoices with a settle_index greater than the specified value. One or both
488
- of these fields can be set. If no fields are set, then we'll only send out
489
- the latest add/settle events.
490
- */
491
- rpc SubscribeInvoices (InvoiceSubscription) returns (stream Invoice) {
492
- option (google.api.http) = {
493
- get: "/v1/invoices/subscribe"
494
- };
495
- }
496
-
497
- /** lncli: `decodepayreq`
498
- DecodePayReq takes an encoded payment request string and attempts to decode
499
- it, returning a full description of the conditions encoded within the
500
- payment request.
501
- */
502
- rpc DecodePayReq (PayReqString) returns (PayReq) {
503
- option (google.api.http) = {
504
- get: "/v1/payreq/{pay_req}"
505
- };
506
- }
507
-
508
- /** lncli: `listpayments`
509
- ListPayments returns a list of all outgoing payments.
510
- */
511
- rpc ListPayments (ListPaymentsRequest) returns (ListPaymentsResponse) {
512
- option (google.api.http) = {
513
- get: "/v1/payments"
514
- };
515
- };
516
-
517
- /**
518
- DeleteAllPayments deletes all outgoing payments from DB.
519
- */
520
- rpc DeleteAllPayments (DeleteAllPaymentsRequest) returns (DeleteAllPaymentsResponse) {
521
- option (google.api.http) = {
522
- delete: "/v1/payments"
523
- };
524
- };
525
-
526
- /** lncli: `describegraph`
527
- DescribeGraph returns a description of the latest graph state from the
528
- point of view of the node. The graph information is partitioned into two
529
- components: all the nodes/vertexes, and all the edges that connect the
530
- vertexes themselves. As this is a directed graph, the edges also contain
531
- the node directional specific routing policy which includes: the time lock
532
- delta, fee information, etc.
533
- */
534
- rpc DescribeGraph (ChannelGraphRequest) returns (ChannelGraph) {
535
- option (google.api.http) = {
536
- get: "/v1/graph"
537
- };
538
- }
539
-
540
- /** lncli: `getchaninfo`
541
- GetChanInfo returns the latest authenticated network announcement for the
542
- given channel identified by its channel ID: an 8-byte integer which
543
- uniquely identifies the location of transaction's funding output within the
544
- blockchain.
545
- */
546
- rpc GetChanInfo (ChanInfoRequest) returns (ChannelEdge) {
547
- option (google.api.http) = {
548
- get: "/v1/graph/edge/{chan_id}"
549
- };
550
- }
551
-
552
- /** lncli: `getnodeinfo`
553
- GetNodeInfo returns the latest advertised, aggregated, and authenticated
554
- channel information for the specified node identified by its public key.
555
- */
556
- rpc GetNodeInfo (NodeInfoRequest) returns (NodeInfo) {
557
- option (google.api.http) = {
558
- get: "/v1/graph/node/{pub_key}"
559
- };
560
- }
561
-
562
- /** lncli: `queryroutes`
563
- QueryRoutes attempts to query the daemon's Channel Router for a possible
564
- route to a target destination capable of carrying a specific amount of
565
- satoshis. The retuned route contains the full details required to craft and
566
- send an HTLC, also including the necessary information that should be
567
- present within the Sphinx packet encapsulated within the HTLC.
568
- */
569
- rpc QueryRoutes(QueryRoutesRequest) returns (QueryRoutesResponse) {
570
- option (google.api.http) = {
571
- get: "/v1/graph/routes/{pub_key}/{amt}"
572
- };
573
- }
574
-
575
- /** lncli: `getnetworkinfo`
576
- GetNetworkInfo returns some basic stats about the known channel graph from
577
- the point of view of the node.
578
- */
579
- rpc GetNetworkInfo (NetworkInfoRequest) returns (NetworkInfo) {
580
- option (google.api.http) = {
581
- get: "/v1/graph/info"
582
- };
583
- }
584
-
585
- /** lncli: `stop`
586
- StopDaemon will send a shutdown request to the interrupt handler, triggering
587
- a graceful shutdown of the daemon.
588
- */
589
- rpc StopDaemon(StopRequest) returns (StopResponse);
590
-
591
- /**
592
- SubscribeChannelGraph launches a streaming RPC that allows the caller to
593
- receive notifications upon any changes to the channel graph topology from
594
- the point of view of the responding node. Events notified include: new
595
- nodes coming online, nodes updating their authenticated attributes, new
596
- channels being advertised, updates in the routing policy for a directional
597
- channel edge, and when channels are closed on-chain.
598
- */
599
- rpc SubscribeChannelGraph(GraphTopologySubscription) returns (stream GraphTopologyUpdate);
600
-
601
- /** lncli: `debuglevel`
602
- DebugLevel allows a caller to programmatically set the logging verbosity of
603
- lnd. The logging can be targeted according to a coarse daemon-wide logging
604
- level, or in a granular fashion to specify the logging for a target
605
- sub-system.
606
- */
607
- rpc DebugLevel (DebugLevelRequest) returns (DebugLevelResponse);
608
-
609
- /** lncli: `feereport`
610
- FeeReport allows the caller to obtain a report detailing the current fee
611
- schedule enforced by the node globally for each channel.
612
- */
613
- rpc FeeReport(FeeReportRequest) returns (FeeReportResponse) {
614
- option (google.api.http) = {
615
- get: "/v1/fees"
616
- };
617
- }
618
-
619
- /** lncli: `updatechanpolicy`
620
- UpdateChannelPolicy allows the caller to update the fee schedule and
621
- channel policies for all channels globally, or a particular channel.
622
- */
623
- rpc UpdateChannelPolicy(PolicyUpdateRequest) returns (PolicyUpdateResponse) {
624
- option (google.api.http) = {
625
- post: "/v1/chanpolicy"
626
- body: "*"
627
- };
628
- }
629
-
630
- /** lncli: `fwdinghistory`
631
- ForwardingHistory allows the caller to query the htlcswitch for a record of
632
- all HTLC's forwarded within the target time range, and integer offset
633
- within that time range. If no time-range is specified, then the first chunk
634
- of the past 24 hrs of forwarding history are returned.
635
-
636
- A list of forwarding events are returned. The size of each forwarding event
637
- is 40 bytes, and the max message size able to be returned in gRPC is 4 MiB.
638
- As a result each message can only contain 50k entries. Each response has
639
- the index offset of the last entry. The index offset can be provided to the
640
- request to allow the caller to skip a series of records.
641
- */
642
- rpc ForwardingHistory(ForwardingHistoryRequest) returns (ForwardingHistoryResponse) {
643
- option (google.api.http) = {
644
- post: "/v1/switch"
645
- body: "*"
646
- };
647
- };
648
- }
649
-
650
- message Transaction {
651
- /// The transaction hash
652
- string tx_hash = 1 [ json_name = "tx_hash" ];
653
-
654
- /// The transaction amount, denominated in satoshis
655
- int64 amount = 2 [ json_name = "amount" ];
656
-
657
- /// The number of confirmations
658
- int32 num_confirmations = 3 [ json_name = "num_confirmations" ];
659
-
660
- /// The hash of the block this transaction was included in
661
- string block_hash = 4 [ json_name = "block_hash" ];
662
-
663
- /// The height of the block this transaction was included in
664
- int32 block_height = 5 [ json_name = "block_height" ];
665
-
666
- /// Timestamp of this transaction
667
- int64 time_stamp = 6 [ json_name = "time_stamp" ];
668
-
669
- /// Fees paid for this transaction
670
- int64 total_fees = 7 [ json_name = "total_fees" ];
671
-
672
- /// Addresses that received funds for this transaction
673
- repeated string dest_addresses = 8 [ json_name = "dest_addresses" ];
674
- }
675
- message GetTransactionsRequest {
676
- }
677
- message TransactionDetails {
678
- /// The list of transactions relevant to the wallet.
679
- repeated Transaction transactions = 1 [json_name = "transactions"];
680
- }
681
-
682
- message FeeLimit {
683
- oneof limit {
684
- /// The fee limit expressed as a fixed amount of satoshis.
685
- int64 fixed = 1;
686
-
687
- /// The fee limit expressed as a percentage of the payment amount.
688
- int64 percent = 2;
689
- }
690
- }
691
-
692
- message SendRequest {
693
- /// The identity pubkey of the payment recipient
694
- bytes dest = 1;
695
-
696
- /// The hex-encoded identity pubkey of the payment recipient
697
- string dest_string = 2;
698
-
699
- /// Number of satoshis to send.
700
- int64 amt = 3;
701
-
702
- /// The hash to use within the payment's HTLC
703
- bytes payment_hash = 4;
704
-
705
- /// The hex-encoded hash to use within the payment's HTLC
706
- string payment_hash_string = 5;
707
-
708
- /**
709
- A bare-bones invoice for a payment within the Lightning Network. With the
710
- details of the invoice, the sender has all the data necessary to send a
711
- payment to the recipient.
712
- */
713
- string payment_request = 6;
714
-
715
- /**
716
- The CLTV delta from the current height that should be used to set the
717
- timelock for the final hop.
718
- */
719
- int32 final_cltv_delta = 7;
720
-
721
- /**
722
- The maximum number of satoshis that will be paid as a fee of the payment.
723
- This value can be represented either as a percentage of the amount being
724
- sent, or as a fixed amount of the maximum fee the user is willing the pay to
725
- send the payment.
726
- */
727
- FeeLimit fee_limit = 8;
728
- }
729
- message SendResponse {
730
- string payment_error = 1 [json_name = "payment_error"];
731
- bytes payment_preimage = 2 [json_name = "payment_preimage"];
732
- Route payment_route = 3 [json_name = "payment_route"];
733
- }
734
-
735
- message SendToRouteRequest {
736
- /// The payment hash to use for the HTLC.
737
- bytes payment_hash = 1;
738
-
739
- /// An optional hex-encoded payment hash to be used for the HTLC.
740
- string payment_hash_string = 2;
741
-
742
- /// The set of routes that should be used to attempt to complete the payment.
743
- repeated Route routes = 3;
744
- }
745
-
746
- message ChannelPoint {
747
- oneof funding_txid {
748
- /// Txid of the funding transaction
749
- bytes funding_txid_bytes = 1 [json_name = "funding_txid_bytes"];
750
-
751
- /// Hex-encoded string representing the funding transaction
752
- string funding_txid_str = 2 [json_name = "funding_txid_str"];
753
- }
754
-
755
- /// The index of the output of the funding transaction
756
- uint32 output_index = 3 [json_name = "output_index"];
757
- }
758
-
759
- message LightningAddress {
760
- /// The identity pubkey of the Lightning node
761
- string pubkey = 1 [json_name = "pubkey"];
762
-
763
- /// The network location of the lightning node, e.g. `69.69.69.69:1337` or `localhost:10011`
764
- string host = 2 [json_name = "host"];
765
- }
766
-
767
- message SendManyRequest {
768
- /// The map from addresses to amounts
769
- map<string, int64> AddrToAmount = 1;
770
-
771
- /// The target number of blocks that this transaction should be confirmed by.
772
- int32 target_conf = 3;
773
-
774
- /// A manual fee rate set in sat/byte that should be used when crafting the transaction.
775
- int64 sat_per_byte = 5;
776
- }
777
- message SendManyResponse {
778
- /// The id of the transaction
779
- string txid = 1 [json_name = "txid"];
780
- }
781
-
782
- message SendCoinsRequest {
783
- /// The address to send coins to
784
- string addr = 1;
785
-
786
- /// The amount in satoshis to send
787
- int64 amount = 2;
788
-
789
- /// The target number of blocks that this transaction should be confirmed by.
790
- int32 target_conf = 3;
791
-
792
- /// A manual fee rate set in sat/byte that should be used when crafting the transaction.
793
- int64 sat_per_byte = 5;
794
- }
795
- message SendCoinsResponse {
796
- /// The transaction ID of the transaction
797
- string txid = 1 [json_name = "txid"];
798
- }
799
-
800
- /**
801
- `AddressType` has to be one of:
802
-
803
- - `p2wkh`: Pay to witness key hash (`WITNESS_PUBKEY_HASH` = 0)
804
- - `np2wkh`: Pay to nested witness key hash (`NESTED_PUBKEY_HASH` = 1)
805
- */
806
- message NewAddressRequest {
807
- enum AddressType {
808
- WITNESS_PUBKEY_HASH = 0;
809
- NESTED_PUBKEY_HASH = 1;
810
- }
811
-
812
- /// The address type
813
- AddressType type = 1;
814
- }
815
- message NewAddressResponse {
816
- /// The newly generated wallet address
817
- string address = 1 [json_name = "address"];
818
- }
819
-
820
- message SignMessageRequest {
821
- /// The message to be signed
822
- bytes msg = 1 [ json_name = "msg" ];
823
- }
824
- message SignMessageResponse {
825
- /// The signature for the given message
826
- string signature = 1 [ json_name = "signature" ];
827
- }
828
-
829
- message VerifyMessageRequest {
830
- /// The message over which the signature is to be verified
831
- bytes msg = 1 [ json_name = "msg" ];
832
-
833
- /// The signature to be verified over the given message
834
- string signature = 2 [ json_name = "signature" ];
835
- }
836
- message VerifyMessageResponse {
837
- /// Whether the signature was valid over the given message
838
- bool valid = 1 [ json_name = "valid" ];
839
-
840
- /// The pubkey recovered from the signature
841
- string pubkey = 2 [ json_name = "pubkey" ];
842
- }
843
-
844
- message ConnectPeerRequest {
845
- /// Lightning address of the peer, in the format `<pubkey>@host`
846
- LightningAddress addr = 1;
847
-
848
- /** If set, the daemon will attempt to persistently connect to the target
849
- * peer. Otherwise, the call will be synchronous. */
850
- bool perm = 2;
851
- }
852
- message ConnectPeerResponse {
853
- }
854
-
855
- message DisconnectPeerRequest {
856
- /// The pubkey of the node to disconnect from
857
- string pub_key = 1 [json_name = "pub_key"];
858
- }
859
- message DisconnectPeerResponse {
860
- }
861
-
862
- message HTLC {
863
- bool incoming = 1 [json_name = "incoming"];
864
- int64 amount = 2 [json_name = "amount"];
865
- bytes hash_lock = 3 [json_name = "hash_lock"];
866
- uint32 expiration_height = 4 [json_name = "expiration_height"];
867
- }
868
-
869
- message Channel {
870
- /// Whether this channel is active or not
871
- bool active = 1 [json_name = "active"];
872
-
873
- /// The identity pubkey of the remote node
874
- string remote_pubkey = 2 [json_name = "remote_pubkey"];
875
-
876
- /**
877
- The outpoint (txid:index) of the funding transaction. With this value, Bob
878
- will be able to generate a signature for Alice's version of the commitment
879
- transaction.
880
- */
881
- string channel_point = 3 [json_name = "channel_point"];
882
-
883
- /**
884
- The unique channel ID for the channel. The first 3 bytes are the block
885
- height, the next 3 the index within the block, and the last 2 bytes are the
886
- output index for the channel.
887
- */
888
- uint64 chan_id = 4 [json_name = "chan_id"];
889
-
890
- /// The total amount of funds held in this channel
891
- int64 capacity = 5 [json_name = "capacity"];
892
-
893
- /// This node's current balance in this channel
894
- int64 local_balance = 6 [json_name = "local_balance"];
895
-
896
- /// The counterparty's current balance in this channel
897
- int64 remote_balance = 7 [json_name = "remote_balance"];
898
-
899
- /**
900
- The amount calculated to be paid in fees for the current set of commitment
901
- transactions. The fee amount is persisted with the channel in order to
902
- allow the fee amount to be removed and recalculated with each channel state
903
- update, including updates that happen after a system restart.
904
- */
905
- int64 commit_fee = 8 [json_name = "commit_fee"];
906
-
907
- /// The weight of the commitment transaction
908
- int64 commit_weight = 9 [json_name = "commit_weight"];
909
-
910
- /**
911
- The required number of satoshis per kilo-weight that the requester will pay
912
- at all times, for both the funding transaction and commitment transaction.
913
- This value can later be updated once the channel is open.
914
- */
915
- int64 fee_per_kw = 10 [json_name = "fee_per_kw"];
916
-
917
- /// The unsettled balance in this channel
918
- int64 unsettled_balance = 11 [json_name = "unsettled_balance"];
919
-
920
- /**
921
- The total number of satoshis we've sent within this channel.
922
- */
923
- int64 total_satoshis_sent = 12 [json_name = "total_satoshis_sent"];
924
-
925
- /**
926
- The total number of satoshis we've received within this channel.
927
- */
928
- int64 total_satoshis_received = 13 [json_name = "total_satoshis_received"];
929
-
930
- /**
931
- The total number of updates conducted within this channel.
932
- */
933
- uint64 num_updates = 14 [json_name = "num_updates"];
934
-
935
- /**
936
- The list of active, uncleared HTLCs currently pending within the channel.
937
- */
938
- repeated HTLC pending_htlcs = 15 [json_name = "pending_htlcs"];
939
-
940
- /**
941
- The CSV delay expressed in relative blocks. If the channel is force
942
- closed, we'll need to wait for this many blocks before we can regain our
943
- funds.
944
- */
945
- uint32 csv_delay = 16 [json_name = "csv_delay"];
946
-
947
- /// Whether this channel is advertised to the network or not
948
- bool private = 17 [json_name = "private"];
949
- }
950
-
951
-
952
- message ListChannelsRequest {
953
- bool active_only = 1;
954
- bool inactive_only = 2;
955
- bool public_only = 3;
956
- bool private_only = 4;
957
- }
958
- message ListChannelsResponse {
959
- /// The list of active channels
960
- repeated Channel channels = 11 [json_name = "channels"];
961
- }
962
-
963
- message ChannelCloseSummary {
964
- /// The outpoint (txid:index) of the funding transaction.
965
- string channel_point = 1 [json_name = "channel_point"];
966
-
967
- /// The unique channel ID for the channel.
968
- uint64 chan_id = 2 [json_name = "chan_id"];
969
-
970
- /// The hash of the genesis block that this channel resides within.
971
- string chain_hash = 3 [json_name = "chain_hash"];
972
-
973
- /// The txid of the transaction which ultimately closed this channel.
974
- string closing_tx_hash = 4 [json_name = "closing_tx_hash"];
975
-
976
- /// Public key of the remote peer that we formerly had a channel with.
977
- string remote_pubkey = 5 [json_name = "remote_pubkey"];
978
-
979
- /// Total capacity of the channel.
980
- int64 capacity = 6 [json_name = "capacity"];
981
-
982
- /// Height at which the funding transaction was spent.
983
- uint32 close_height = 7 [json_name = "close_height"];
984
-
985
- /// Settled balance at the time of channel closure
986
- int64 settled_balance = 8 [json_name = "settled_balance"];
987
-
988
- /// The sum of all the time-locked outputs at the time of channel closure
989
- int64 time_locked_balance = 9 [json_name = "time_locked_balance"];
990
-
991
- enum ClosureType {
992
- COOPERATIVE_CLOSE = 0;
993
- LOCAL_FORCE_CLOSE = 1;
994
- REMOTE_FORCE_CLOSE = 2;
995
- BREACH_CLOSE = 3;
996
- FUNDING_CANCELED = 4;
997
- ABANDONED = 5;
998
- }
999
-
1000
- /// Details on how the channel was closed.
1001
- ClosureType close_type = 10 [json_name = "close_type"];
1002
- }
1003
-
1004
- message ClosedChannelsRequest {
1005
- bool cooperative = 1;
1006
- bool local_force = 2;
1007
- bool remote_force = 3;
1008
- bool breach = 4;
1009
- bool funding_canceled = 5;
1010
- bool abandoned = 6;
1011
- }
1012
-
1013
- message ClosedChannelsResponse {
1014
- repeated ChannelCloseSummary channels = 1 [json_name = "channels"];
1015
- }
1016
-
1017
- message Peer {
1018
- /// The identity pubkey of the peer
1019
- string pub_key = 1 [json_name = "pub_key"];
1020
-
1021
- /// Network address of the peer; eg `127.0.0.1:10011`
1022
- string address = 3 [json_name = "address"];
1023
-
1024
- /// Bytes of data transmitted to this peer
1025
- uint64 bytes_sent = 4 [json_name = "bytes_sent"];
1026
-
1027
- /// Bytes of data transmitted from this peer
1028
- uint64 bytes_recv = 5 [json_name = "bytes_recv"];
1029
-
1030
- /// Satoshis sent to this peer
1031
- int64 sat_sent = 6 [json_name = "sat_sent"];
1032
-
1033
- /// Satoshis received from this peer
1034
- int64 sat_recv = 7 [json_name = "sat_recv"];
1035
-
1036
- /// A channel is inbound if the counterparty initiated the channel
1037
- bool inbound = 8 [json_name = "inbound"];
1038
-
1039
- /// Ping time to this peer
1040
- int64 ping_time = 9 [json_name = "ping_time"];
1041
- }
1042
-
1043
- message ListPeersRequest {
1044
- }
1045
- message ListPeersResponse {
1046
- /// The list of currently connected peers
1047
- repeated Peer peers = 1 [json_name = "peers"];
1048
- }
1049
-
1050
- message GetInfoRequest {
1051
- }
1052
- message GetInfoResponse {
1053
-
1054
- /// The identity pubkey of the current node.
1055
- string identity_pubkey = 1 [json_name = "identity_pubkey"];
1056
-
1057
- /// If applicable, the alias of the current node, e.g. "bob"
1058
- string alias = 2 [json_name = "alias"];
1059
-
1060
- /// Number of pending channels
1061
- uint32 num_pending_channels = 3 [json_name = "num_pending_channels"];
1062
-
1063
- /// Number of active channels
1064
- uint32 num_active_channels = 4 [json_name = "num_active_channels"];
1065
-
1066
- /// Number of peers
1067
- uint32 num_peers = 5 [json_name = "num_peers"];
1068
-
1069
- /// The node's current view of the height of the best block
1070
- uint32 block_height = 6 [json_name = "block_height"];
1071
-
1072
- /// The node's current view of the hash of the best block
1073
- string block_hash = 8 [json_name = "block_hash"];
1074
-
1075
- /// Whether the wallet's view is synced to the main chain
1076
- bool synced_to_chain = 9 [json_name = "synced_to_chain"];
1077
-
1078
- /// Whether the current node is connected to testnet
1079
- bool testnet = 10 [json_name = "testnet"];
1080
-
1081
- /// A list of active chains the node is connected to
1082
- repeated string chains = 11 [json_name = "chains"];
1083
-
1084
- /// The URIs of the current node.
1085
- repeated string uris = 12 [json_name = "uris"];
1086
-
1087
- /// Timestamp of the block best known to the wallet
1088
- int64 best_header_timestamp = 13 [ json_name = "best_header_timestamp" ];
1089
-
1090
- /// The version of the LND software that the node is running.
1091
- string version = 14 [ json_name = "version" ];
1092
-
1093
- }
1094
-
1095
- message ConfirmationUpdate {
1096
- bytes block_sha = 1;
1097
- int32 block_height = 2;
1098
-
1099
- uint32 num_confs_left = 3;
1100
- }
1101
-
1102
- message ChannelOpenUpdate {
1103
- ChannelPoint channel_point = 1 [json_name = "channel_point"];
1104
- }
1105
-
1106
- message ChannelCloseUpdate {
1107
- bytes closing_txid = 1 [json_name = "closing_txid"];
1108
-
1109
- bool success = 2 [json_name = "success"];
1110
- }
1111
-
1112
- message CloseChannelRequest {
1113
- /**
1114
- The outpoint (txid:index) of the funding transaction. With this value, Bob
1115
- will be able to generate a signature for Alice's version of the commitment
1116
- transaction.
1117
- */
1118
- ChannelPoint channel_point = 1;
1119
-
1120
- /// If true, then the channel will be closed forcibly. This means the current commitment transaction will be signed and broadcast.
1121
- bool force = 2;
1122
-
1123
- /// The target number of blocks that the closure transaction should be confirmed by.
1124
- int32 target_conf = 3;
1125
-
1126
- /// A manual fee rate set in sat/byte that should be used when crafting the closure transaction.
1127
- int64 sat_per_byte = 4;
1128
- }
1129
-
1130
- message CloseStatusUpdate {
1131
- oneof update {
1132
- PendingUpdate close_pending = 1 [json_name = "close_pending"];
1133
- ConfirmationUpdate confirmation = 2 [json_name = "confirmation"];
1134
- ChannelCloseUpdate chan_close = 3 [json_name = "chan_close"];
1135
- }
1136
- }
1137
-
1138
- message PendingUpdate {
1139
- bytes txid = 1 [json_name = "txid"];
1140
- uint32 output_index = 2 [json_name = "output_index"];
1141
- }
1142
-
1143
- message OpenChannelRequest {
1144
- /// The pubkey of the node to open a channel with
1145
- bytes node_pubkey = 2 [json_name = "node_pubkey"];
1146
-
1147
- /// The hex encoded pubkey of the node to open a channel with
1148
- string node_pubkey_string = 3 [json_name = "node_pubkey_string"];
1149
-
1150
- /// The number of satoshis the wallet should commit to the channel
1151
- int64 local_funding_amount = 4 [json_name = "local_funding_amount"];
1152
-
1153
- /// The number of satoshis to push to the remote side as part of the initial commitment state
1154
- int64 push_sat = 5 [json_name = "push_sat"];
1155
-
1156
- /// The target number of blocks that the funding transaction should be confirmed by.
1157
- int32 target_conf = 6;
1158
-
1159
- /// A manual fee rate set in sat/byte that should be used when crafting the funding transaction.
1160
- int64 sat_per_byte = 7;
1161
-
1162
- /// Whether this channel should be private, not announced to the greater network.
1163
- bool private = 8 [json_name = "private"];
1164
-
1165
- /// The minimum value in millisatoshi we will require for incoming HTLCs on the channel.
1166
- int64 min_htlc_msat = 9 [json_name = "min_htlc_msat"];
1167
-
1168
- /// The delay we require on the remote's commitment transaction. If this is not set, it will be scaled automatically with the channel size.
1169
- uint32 remote_csv_delay = 10 [json_name = "remote_csv_delay"];
1170
-
1171
- /// The minimum number of confirmations each one of your outputs used for the funding transaction must satisfy.
1172
- int32 min_confs = 11 [json_name = "min_confs"];
1173
-
1174
- /// Whether unconfirmed outputs should be used as inputs for the funding transaction.
1175
- bool spend_unconfirmed = 12 [json_name = "spend_unconfirmed"];
1176
- }
1177
- message OpenStatusUpdate {
1178
- oneof update {
1179
- PendingUpdate chan_pending = 1 [json_name = "chan_pending"];
1180
- ConfirmationUpdate confirmation = 2 [json_name = "confirmation"];
1181
- ChannelOpenUpdate chan_open = 3 [json_name = "chan_open"];
1182
- }
1183
- }
1184
-
1185
- message PendingHTLC {
1186
-
1187
- /// The direction within the channel that the htlc was sent
1188
- bool incoming = 1 [ json_name = "incoming" ];
1189
-
1190
- /// The total value of the htlc
1191
- int64 amount = 2 [ json_name = "amount" ];
1192
-
1193
- /// The final output to be swept back to the user's wallet
1194
- string outpoint = 3 [ json_name = "outpoint" ];
1195
-
1196
- /// The next block height at which we can spend the current stage
1197
- uint32 maturity_height = 4 [ json_name = "maturity_height" ];
1198
-
1199
- /**
1200
- The number of blocks remaining until the current stage can be swept.
1201
- Negative values indicate how many blocks have passed since becoming
1202
- mature.
1203
- */
1204
- int32 blocks_til_maturity = 5 [ json_name = "blocks_til_maturity" ];
1205
-
1206
- /// Indicates whether the htlc is in its first or second stage of recovery
1207
- uint32 stage = 6 [ json_name = "stage" ];
1208
- }
1209
-
1210
- message PendingChannelsRequest {}
1211
- message PendingChannelsResponse {
1212
- message PendingChannel {
1213
- string remote_node_pub = 1 [ json_name = "remote_node_pub" ];
1214
- string channel_point = 2 [ json_name = "channel_point" ];
1215
-
1216
- int64 capacity = 3 [ json_name = "capacity" ];
1217
-
1218
- int64 local_balance = 4 [ json_name = "local_balance" ];
1219
- int64 remote_balance = 5 [ json_name = "remote_balance" ];
1220
- }
1221
-
1222
- message PendingOpenChannel {
1223
- /// The pending channel
1224
- PendingChannel channel = 1 [ json_name = "channel" ];
1225
-
1226
- /// The height at which this channel will be confirmed
1227
- uint32 confirmation_height = 2 [ json_name = "confirmation_height" ];
1228
-
1229
- /**
1230
- The amount calculated to be paid in fees for the current set of
1231
- commitment transactions. The fee amount is persisted with the channel
1232
- in order to allow the fee amount to be removed and recalculated with
1233
- each channel state update, including updates that happen after a system
1234
- restart.
1235
- */
1236
- int64 commit_fee = 4 [json_name = "commit_fee" ];
1237
-
1238
- /// The weight of the commitment transaction
1239
- int64 commit_weight = 5 [ json_name = "commit_weight" ];
1240
-
1241
- /**
1242
- The required number of satoshis per kilo-weight that the requester will
1243
- pay at all times, for both the funding transaction and commitment
1244
- transaction. This value can later be updated once the channel is open.
1245
- */
1246
- int64 fee_per_kw = 6 [ json_name = "fee_per_kw" ];
1247
- }
1248
-
1249
- message WaitingCloseChannel {
1250
- /// The pending channel waiting for closing tx to confirm
1251
- PendingChannel channel = 1;
1252
-
1253
- /// The balance in satoshis encumbered in this channel
1254
- int64 limbo_balance = 2 [ json_name = "limbo_balance" ];
1255
- }
1256
-
1257
- message ClosedChannel {
1258
- /// The pending channel to be closed
1259
- PendingChannel channel = 1;
1260
-
1261
- /// The transaction id of the closing transaction
1262
- string closing_txid = 2 [ json_name = "closing_txid" ];
1263
- }
1264
-
1265
- message ForceClosedChannel {
1266
- /// The pending channel to be force closed
1267
- PendingChannel channel = 1 [ json_name = "channel" ];
1268
-
1269
- /// The transaction id of the closing transaction
1270
- string closing_txid = 2 [ json_name = "closing_txid" ];
1271
-
1272
- /// The balance in satoshis encumbered in this pending channel
1273
- int64 limbo_balance = 3 [ json_name = "limbo_balance" ];
1274
-
1275
- /// The height at which funds can be sweeped into the wallet
1276
- uint32 maturity_height = 4 [ json_name = "maturity_height" ];
1277
-
1278
- /*
1279
- Remaining # of blocks until the commitment output can be swept.
1280
- Negative values indicate how many blocks have passed since becoming
1281
- mature.
1282
- */
1283
- int32 blocks_til_maturity = 5 [ json_name = "blocks_til_maturity" ];
1284
-
1285
- /// The total value of funds successfully recovered from this channel
1286
- int64 recovered_balance = 6 [ json_name = "recovered_balance" ];
1287
-
1288
- repeated PendingHTLC pending_htlcs = 8 [ json_name = "pending_htlcs" ];
1289
- }
1290
-
1291
- /// The balance in satoshis encumbered in pending channels
1292
- int64 total_limbo_balance = 1 [ json_name = "total_limbo_balance" ];
1293
-
1294
- /// Channels pending opening
1295
- repeated PendingOpenChannel pending_open_channels = 2 [ json_name = "pending_open_channels" ];
1296
-
1297
- /// Channels pending closing
1298
- repeated ClosedChannel pending_closing_channels = 3 [ json_name = "pending_closing_channels" ];
1299
-
1300
- /// Channels pending force closing
1301
- repeated ForceClosedChannel pending_force_closing_channels = 4 [ json_name = "pending_force_closing_channels" ];
1302
-
1303
- /// Channels waiting for closing tx to confirm
1304
- repeated WaitingCloseChannel waiting_close_channels = 5 [ json_name = "waiting_close_channels" ];
1305
- }
1306
-
1307
- message WalletBalanceRequest {
1308
- }
1309
- message WalletBalanceResponse {
1310
- /// The balance of the wallet
1311
- int64 total_balance = 1 [json_name = "total_balance"];
1312
-
1313
- /// The confirmed balance of a wallet(with >= 1 confirmations)
1314
- int64 confirmed_balance = 2 [json_name = "confirmed_balance"];
1315
-
1316
- /// The unconfirmed balance of a wallet(with 0 confirmations)
1317
- int64 unconfirmed_balance = 3 [json_name = "unconfirmed_balance"];
1318
- }
1319
-
1320
- message ChannelBalanceRequest {
1321
- }
1322
- message ChannelBalanceResponse {
1323
- /// Sum of channels balances denominated in satoshis
1324
- int64 balance = 1 [json_name = "balance"];
1325
-
1326
- /// Sum of channels pending balances denominated in satoshis
1327
- int64 pending_open_balance = 2 [json_name = "pending_open_balance"];
1328
- }
1329
-
1330
- message QueryRoutesRequest {
1331
- /// The 33-byte hex-encoded public key for the payment destination
1332
- string pub_key = 1;
1333
-
1334
- /// The amount to send expressed in satoshis
1335
- int64 amt = 2;
1336
-
1337
- /// The max number of routes to return.
1338
- int32 num_routes = 3;
1339
-
1340
- /// An optional CLTV delta from the current height that should be used for the timelock of the final hop
1341
- int32 final_cltv_delta = 4;
1342
-
1343
- /**
1344
- The maximum number of satoshis that will be paid as a fee of the payment.
1345
- This value can be represented either as a percentage of the amount being
1346
- sent, or as a fixed amount of the maximum fee the user is willing the pay to
1347
- send the payment.
1348
- */
1349
- FeeLimit fee_limit = 5;
1350
- }
1351
- message QueryRoutesResponse {
1352
- repeated Route routes = 1 [json_name = "routes"];
1353
- }
1354
-
1355
- message Hop {
1356
- /**
1357
- The unique channel ID for the channel. The first 3 bytes are the block
1358
- height, the next 3 the index within the block, and the last 2 bytes are the
1359
- output index for the channel.
1360
- */
1361
- uint64 chan_id = 1 [json_name = "chan_id"];
1362
- int64 chan_capacity = 2 [json_name = "chan_capacity"];
1363
- int64 amt_to_forward = 3 [json_name = "amt_to_forward", deprecated = true];
1364
- int64 fee = 4 [json_name = "fee", deprecated = true];
1365
- uint32 expiry = 5 [json_name = "expiry"];
1366
- int64 amt_to_forward_msat = 6 [json_name = "amt_to_forward_msat"];
1367
- int64 fee_msat = 7 [json_name = "fee_msat"];
1368
- }
1369
-
1370
- /**
1371
- A path through the channel graph which runs over one or more channels in
1372
- succession. This struct carries all the information required to craft the
1373
- Sphinx onion packet, and send the payment along the first hop in the path. A
1374
- route is only selected as valid if all the channels have sufficient capacity to
1375
- carry the initial payment amount after fees are accounted for.
1376
- */
1377
- message Route {
1378
-
1379
- /**
1380
- The cumulative (final) time lock across the entire route. This is the CLTV
1381
- value that should be extended to the first hop in the route. All other hops
1382
- will decrement the time-lock as advertised, leaving enough time for all
1383
- hops to wait for or present the payment preimage to complete the payment.
1384
- */
1385
- uint32 total_time_lock = 1 [json_name = "total_time_lock"];
1386
-
1387
- /**
1388
- The sum of the fees paid at each hop within the final route. In the case
1389
- of a one-hop payment, this value will be zero as we don't need to pay a fee
1390
- it ourself.
1391
- */
1392
- int64 total_fees = 2 [json_name = "total_fees", deprecated = true];
1393
-
1394
- /**
1395
- The total amount of funds required to complete a payment over this route.
1396
- This value includes the cumulative fees at each hop. As a result, the HTLC
1397
- extended to the first-hop in the route will need to have at least this many
1398
- satoshis, otherwise the route will fail at an intermediate node due to an
1399
- insufficient amount of fees.
1400
- */
1401
- int64 total_amt = 3 [json_name = "total_amt", deprecated = true];
1402
-
1403
- /**
1404
- Contains details concerning the specific forwarding details at each hop.
1405
- */
1406
- repeated Hop hops = 4 [json_name = "hops"];
1407
-
1408
- /**
1409
- The total fees in millisatoshis.
1410
- */
1411
- int64 total_fees_msat = 5 [json_name = "total_fees_msat"];
1412
-
1413
- /**
1414
- The total amount in millisatoshis.
1415
- */
1416
- int64 total_amt_msat = 6 [json_name = "total_amt_msat"];
1417
- }
1418
-
1419
- message NodeInfoRequest {
1420
- /// The 33-byte hex-encoded compressed public of the target node
1421
- string pub_key = 1;
1422
- }
1423
-
1424
- message NodeInfo {
1425
-
1426
- /**
1427
- An individual vertex/node within the channel graph. A node is
1428
- connected to other nodes by one or more channel edges emanating from it. As
1429
- the graph is directed, a node will also have an incoming edge attached to
1430
- it for each outgoing edge.
1431
- */
1432
- LightningNode node = 1 [json_name = "node"];
1433
-
1434
- uint32 num_channels = 2 [json_name = "num_channels"];
1435
- int64 total_capacity = 3 [json_name = "total_capacity"];
1436
- }
1437
-
1438
- /**
1439
- An individual vertex/node within the channel graph. A node is
1440
- connected to other nodes by one or more channel edges emanating from it. As the
1441
- graph is directed, a node will also have an incoming edge attached to it for
1442
- each outgoing edge.
1443
- */
1444
- message LightningNode {
1445
- uint32 last_update = 1 [ json_name = "last_update" ];
1446
- string pub_key = 2 [ json_name = "pub_key" ];
1447
- string alias = 3 [ json_name = "alias" ];
1448
- repeated NodeAddress addresses = 4 [ json_name = "addresses" ];
1449
- string color = 5 [ json_name = "color" ];
1450
- }
1451
-
1452
- message NodeAddress {
1453
- string network = 1 [ json_name = "network" ];
1454
- string addr = 2 [ json_name = "addr" ];
1455
- }
1456
-
1457
- message RoutingPolicy {
1458
- uint32 time_lock_delta = 1 [json_name = "time_lock_delta"];
1459
- int64 min_htlc = 2 [json_name = "min_htlc"];
1460
- int64 fee_base_msat = 3 [json_name = "fee_base_msat"];
1461
- int64 fee_rate_milli_msat = 4 [json_name = "fee_rate_milli_msat"];
1462
- bool disabled = 5 [json_name = "disabled"];
1463
- }
1464
-
1465
- /**
1466
- A fully authenticated channel along with all its unique attributes.
1467
- Once an authenticated channel announcement has been processed on the network,
1468
- then an instance of ChannelEdgeInfo encapsulating the channels attributes is
1469
- stored. The other portions relevant to routing policy of a channel are stored
1470
- within a ChannelEdgePolicy for each direction of the channel.
1471
- */
1472
- message ChannelEdge {
1473
-
1474
- /**
1475
- The unique channel ID for the channel. The first 3 bytes are the block
1476
- height, the next 3 the index within the block, and the last 2 bytes are the
1477
- output index for the channel.
1478
- */
1479
- uint64 channel_id = 1 [json_name = "channel_id"];
1480
- string chan_point = 2 [json_name = "chan_point"];
1481
-
1482
- uint32 last_update = 3 [json_name = "last_update"];
1483
-
1484
- string node1_pub = 4 [json_name = "node1_pub"];
1485
- string node2_pub = 5 [json_name = "node2_pub"];
1486
-
1487
- int64 capacity = 6 [json_name = "capacity"];
1488
-
1489
- RoutingPolicy node1_policy = 7 [json_name = "node1_policy"];
1490
- RoutingPolicy node2_policy = 8 [json_name = "node2_policy"];
1491
- }
1492
-
1493
- message ChannelGraphRequest {
1494
- /**
1495
- Whether unannounced channels are included in the response or not. If set,
1496
- unannounced channels are included. Unannounced channels are both private
1497
- channels, and public channels that are not yet announced to the network.
1498
- */
1499
- bool include_unannounced = 1 [json_name = "include_unannounced"];
1500
- }
1501
-
1502
- /// Returns a new instance of the directed channel graph.
1503
- message ChannelGraph {
1504
- /// The list of `LightningNode`s in this channel graph
1505
- repeated LightningNode nodes = 1 [json_name = "nodes"];
1506
-
1507
- /// The list of `ChannelEdge`s in this channel graph
1508
- repeated ChannelEdge edges = 2 [json_name = "edges"];
1509
- }
1510
-
1511
- message ChanInfoRequest {
1512
- /**
1513
- The unique channel ID for the channel. The first 3 bytes are the block
1514
- height, the next 3 the index within the block, and the last 2 bytes are the
1515
- output index for the channel.
1516
- */
1517
- uint64 chan_id = 1;
1518
- }
1519
-
1520
- message NetworkInfoRequest {
1521
- }
1522
- message NetworkInfo {
1523
- uint32 graph_diameter = 1 [json_name = "graph_diameter"];
1524
- double avg_out_degree = 2 [json_name = "avg_out_degree"];
1525
- uint32 max_out_degree = 3 [json_name = "max_out_degree"];
1526
-
1527
- uint32 num_nodes = 4 [json_name = "num_nodes"];
1528
- uint32 num_channels = 5 [json_name = "num_channels"];
1529
-
1530
- int64 total_network_capacity = 6 [json_name = "total_network_capacity"];
1531
-
1532
- double avg_channel_size = 7 [json_name = "avg_channel_size"];
1533
- int64 min_channel_size = 8 [json_name = "min_channel_size"];
1534
- int64 max_channel_size = 9 [json_name = "max_channel_size"];
1535
-
1536
- // TODO(roasbeef): fee rate info, expiry
1537
- // * also additional RPC for tracking fee info once in
1538
- }
1539
-
1540
- message StopRequest{}
1541
- message StopResponse{}
1542
-
1543
- message GraphTopologySubscription {}
1544
- message GraphTopologyUpdate {
1545
- repeated NodeUpdate node_updates = 1;
1546
- repeated ChannelEdgeUpdate channel_updates = 2;
1547
- repeated ClosedChannelUpdate closed_chans = 3;
1548
- }
1549
- message NodeUpdate {
1550
- repeated string addresses = 1;
1551
- string identity_key = 2;
1552
- bytes global_features = 3;
1553
- string alias = 4;
1554
- }
1555
- message ChannelEdgeUpdate {
1556
- /**
1557
- The unique channel ID for the channel. The first 3 bytes are the block
1558
- height, the next 3 the index within the block, and the last 2 bytes are the
1559
- output index for the channel.
1560
- */
1561
- uint64 chan_id = 1;
1562
-
1563
- ChannelPoint chan_point = 2;
1564
-
1565
- int64 capacity = 3;
1566
-
1567
- RoutingPolicy routing_policy = 4;
1568
-
1569
- string advertising_node = 5;
1570
- string connecting_node = 6;
1571
- }
1572
- message ClosedChannelUpdate {
1573
- /**
1574
- The unique channel ID for the channel. The first 3 bytes are the block
1575
- height, the next 3 the index within the block, and the last 2 bytes are the
1576
- output index for the channel.
1577
- */
1578
- uint64 chan_id = 1;
1579
- int64 capacity = 2;
1580
- uint32 closed_height = 3;
1581
- ChannelPoint chan_point = 4;
1582
- }
1583
-
1584
- message HopHint {
1585
- /// The public key of the node at the start of the channel.
1586
- string node_id = 1 [json_name = "node_id"];
1587
-
1588
- /// The unique identifier of the channel.
1589
- uint64 chan_id = 2 [json_name = "chan_id"];
1590
-
1591
- /// The base fee of the channel denominated in millisatoshis.
1592
- uint32 fee_base_msat = 3 [json_name = "fee_base_msat"];
1593
-
1594
- /**
1595
- The fee rate of the channel for sending one satoshi across it denominated in
1596
- millionths of a satoshi.
1597
- */
1598
- uint32 fee_proportional_millionths = 4 [json_name = "fee_proportional_millionths"];
1599
-
1600
- /// The time-lock delta of the channel.
1601
- uint32 cltv_expiry_delta = 5 [json_name = "cltv_expiry_delta"];
1602
- }
1603
-
1604
- message RouteHint {
1605
- /**
1606
- A list of hop hints that when chained together can assist in reaching a
1607
- specific destination.
1608
- */
1609
- repeated HopHint hop_hints = 1 [json_name = "hop_hints"];
1610
- }
1611
-
1612
- message Invoice {
1613
- /**
1614
- An optional memo to attach along with the invoice. Used for record keeping
1615
- purposes for the invoice's creator, and will also be set in the description
1616
- field of the encoded payment request if the description_hash field is not
1617
- being used.
1618
- */
1619
- string memo = 1 [json_name = "memo"];
1620
-
1621
- /// An optional cryptographic receipt of payment
1622
- bytes receipt = 2 [json_name = "receipt"];
1623
-
1624
- /**
1625
- The hex-encoded preimage (32 byte) which will allow settling an incoming
1626
- HTLC payable to this preimage
1627
- */
1628
- bytes r_preimage = 3 [json_name = "r_preimage"];
1629
-
1630
- /// The hash of the preimage
1631
- bytes r_hash = 4 [json_name = "r_hash"];
1632
-
1633
- /// The value of this invoice in satoshis
1634
- int64 value = 5 [json_name = "value"];
1635
-
1636
- /// Whether this invoice has been fulfilled
1637
- bool settled = 6 [json_name = "settled"];
1638
-
1639
- /// When this invoice was created
1640
- int64 creation_date = 7 [json_name = "creation_date"];
1641
-
1642
- /// When this invoice was settled
1643
- int64 settle_date = 8 [json_name = "settle_date"];
1644
-
1645
- /**
1646
- A bare-bones invoice for a payment within the Lightning Network. With the
1647
- details of the invoice, the sender has all the data necessary to send a
1648
- payment to the recipient.
1649
- */
1650
- string payment_request = 9 [json_name = "payment_request"];
1651
-
1652
- /**
1653
- Hash (SHA-256) of a description of the payment. Used if the description of
1654
- payment (memo) is too long to naturally fit within the description field
1655
- of an encoded payment request.
1656
- */
1657
- bytes description_hash = 10 [json_name = "description_hash"];
1658
-
1659
- /// Payment request expiry time in seconds. Default is 3600 (1 hour).
1660
- int64 expiry = 11 [json_name = "expiry"];
1661
-
1662
- /// Fallback on-chain address.
1663
- string fallback_addr = 12 [json_name = "fallback_addr"];
1664
-
1665
- /// Delta to use for the time-lock of the CLTV extended to the final hop.
1666
- uint64 cltv_expiry = 13 [json_name = "cltv_expiry"];
1667
-
1668
- /**
1669
- Route hints that can each be individually used to assist in reaching the
1670
- invoice's destination.
1671
- */
1672
- repeated RouteHint route_hints = 14 [json_name = "route_hints"];
1673
-
1674
- /// Whether this invoice should include routing hints for private channels.
1675
- bool private = 15 [json_name = "private"];
1676
-
1677
- /**
1678
- The "add" index of this invoice. Each newly created invoice will increment
1679
- this index making it monotonically increasing. Callers to the
1680
- SubscribeInvoices call can use this to instantly get notified of all added
1681
- invoices with an add_index greater than this one.
1682
- */
1683
- uint64 add_index = 16 [json_name = "add_index"];
1684
-
1685
- /**
1686
- The "settle" index of this invoice. Each newly settled invoice will
1687
- increment this index making it monotonically increasing. Callers to the
1688
- SubscribeInvoices call can use this to instantly get notified of all
1689
- settled invoices with an settle_index greater than this one.
1690
- */
1691
- uint64 settle_index = 17 [json_name = "settle_index"];
1692
-
1693
- /// Deprecated, use amt_paid_sat or amt_paid_msat.
1694
- int64 amt_paid = 18 [json_name = "amt_paid", deprecated = true];
1695
-
1696
- /**
1697
- The amount that was accepted for this invoice, in satoshis. This will ONLY
1698
- be set if this invoice has been settled. We provide this field as if the
1699
- invoice was created with a zero value, then we need to record what amount
1700
- was ultimately accepted. Additionally, it's possible that the sender paid
1701
- MORE that was specified in the original invoice. So we'll record that here
1702
- as well.
1703
- */
1704
- int64 amt_paid_sat = 19 [json_name = "amt_paid_sat"];
1705
-
1706
- /**
1707
- The amount that was accepted for this invoice, in millisatoshis. This will
1708
- ONLY be set if this invoice has been settled. We provide this field as if
1709
- the invoice was created with a zero value, then we need to record what
1710
- amount was ultimately accepted. Additionally, it's possible that the sender
1711
- paid MORE that was specified in the original invoice. So we'll record that
1712
- here as well.
1713
- */
1714
- int64 amt_paid_msat = 20 [json_name = "amt_paid_msat"];
1715
- }
1716
- message AddInvoiceResponse {
1717
- bytes r_hash = 1 [json_name = "r_hash"];
1718
-
1719
- /**
1720
- A bare-bones invoice for a payment within the Lightning Network. With the
1721
- details of the invoice, the sender has all the data necessary to send a
1722
- payment to the recipient.
1723
- */
1724
- string payment_request = 2 [json_name = "payment_request"];
1725
-
1726
- /**
1727
- The "add" index of this invoice. Each newly created invoice will increment
1728
- this index making it monotonically increasing. Callers to the
1729
- SubscribeInvoices call can use this to instantly get notified of all added
1730
- invoices with an add_index greater than this one.
1731
- */
1732
- uint64 add_index = 16 [json_name = "add_index"];
1733
- }
1734
- message PaymentHash {
1735
- /**
1736
- The hex-encoded payment hash of the invoice to be looked up. The passed
1737
- payment hash must be exactly 32 bytes, otherwise an error is returned.
1738
- */
1739
- string r_hash_str = 1 [json_name = "r_hash_str"];
1740
-
1741
- /// The payment hash of the invoice to be looked up.
1742
- bytes r_hash = 2 [json_name = "r_hash"];
1743
- }
1744
-
1745
- message ListInvoiceRequest {
1746
- /// If set, only unsettled invoices will be returned in the response.
1747
- bool pending_only = 1 [json_name = "pending_only"];
1748
-
1749
- /**
1750
- The index of an invoice that will be used as either the start or end of a
1751
- query to determine which invoices should be returned in the response.
1752
- */
1753
- uint64 index_offset = 4 [json_name = "index_offset"];
1754
-
1755
- /// The max number of invoices to return in the response to this query.
1756
- uint64 num_max_invoices = 5 [json_name = "num_max_invoices"];
1757
-
1758
- /**
1759
- If set, the invoices returned will result from seeking backwards from the
1760
- specified index offset. This can be used to paginate backwards.
1761
- */
1762
- bool reversed = 6 [json_name = "reversed"];
1763
- }
1764
- message ListInvoiceResponse {
1765
- /**
1766
- A list of invoices from the time slice of the time series specified in the
1767
- request.
1768
- */
1769
- repeated Invoice invoices = 1 [json_name = "invoices"];
1770
-
1771
- /**
1772
- The index of the last item in the set of returned invoices. This can be used
1773
- to seek further, pagination style.
1774
- */
1775
- uint64 last_index_offset = 2 [json_name = "last_index_offset"];
1776
-
1777
- /**
1778
- The index of the last item in the set of returned invoices. This can be used
1779
- to seek backwards, pagination style.
1780
- */
1781
- uint64 first_index_offset = 3 [json_name = "first_index_offset"];
1782
- }
1783
-
1784
- message InvoiceSubscription {
1785
- /**
1786
- If specified (non-zero), then we'll first start by sending out
1787
- notifications for all added indexes with an add_index greater than this
1788
- value. This allows callers to catch up on any events they missed while they
1789
- weren't connected to the streaming RPC.
1790
- */
1791
- uint64 add_index = 1 [json_name = "add_index"];
1792
-
1793
- /**
1794
- If specified (non-zero), then we'll first start by sending out
1795
- notifications for all settled indexes with an settle_index greater than
1796
- this value. This allows callers to catch up on any events they missed while
1797
- they weren't connected to the streaming RPC.
1798
- */
1799
- uint64 settle_index = 2 [json_name = "settle_index"];
1800
- }
1801
-
1802
-
1803
- message Payment {
1804
- /// The payment hash
1805
- string payment_hash = 1 [json_name = "payment_hash"];
1806
-
1807
- /// Deprecated, use value_sat or value_msat.
1808
- int64 value = 2 [json_name = "value", deprecated = true];
1809
-
1810
- /// The date of this payment
1811
- int64 creation_date = 3 [json_name = "creation_date"];
1812
-
1813
- /// The path this payment took
1814
- repeated string path = 4 [ json_name = "path" ];
1815
-
1816
- /// The fee paid for this payment in satoshis
1817
- int64 fee = 5 [json_name = "fee"];
1818
-
1819
- /// The payment preimage
1820
- string payment_preimage = 6 [json_name = "payment_preimage"];
1821
-
1822
- /// The value of the payment in satoshis
1823
- int64 value_sat = 7 [json_name = "value_sat"];
1824
-
1825
- /// The value of the payment in milli-satoshis
1826
- int64 value_msat = 8 [json_name = "value_msat"];
1827
- }
1828
-
1829
- message ListPaymentsRequest {
1830
- }
1831
-
1832
- message ListPaymentsResponse {
1833
- /// The list of payments
1834
- repeated Payment payments = 1 [json_name = "payments"];
1835
- }
1836
-
1837
- message DeleteAllPaymentsRequest {
1838
- }
1839
-
1840
- message DeleteAllPaymentsResponse {
1841
- }
1842
-
1843
- message AbandonChannelRequest {
1844
- ChannelPoint channel_point = 1;
1845
- }
1846
-
1847
- message AbandonChannelResponse {
1848
- }
1849
-
1850
-
1851
- message DebugLevelRequest {
1852
- bool show = 1;
1853
- string level_spec = 2;
1854
- }
1855
- message DebugLevelResponse {
1856
- string sub_systems = 1 [json_name = "sub_systems"];
1857
- }
1858
-
1859
- message PayReqString {
1860
- /// The payment request string to be decoded
1861
- string pay_req = 1;
1862
- }
1863
- message PayReq {
1864
- string destination = 1 [json_name = "destination"];
1865
- string payment_hash = 2 [json_name = "payment_hash"];
1866
- int64 num_satoshis = 3 [json_name = "num_satoshis"];
1867
- int64 timestamp = 4 [json_name = "timestamp"];
1868
- int64 expiry = 5 [json_name = "expiry"];
1869
- string description = 6 [json_name = "description"];
1870
- string description_hash = 7 [json_name = "description_hash"];
1871
- string fallback_addr = 8 [json_name = "fallback_addr"];
1872
- int64 cltv_expiry = 9 [json_name = "cltv_expiry"];
1873
- repeated RouteHint route_hints = 10 [json_name = "route_hints"];
1874
- }
1875
-
1876
- message FeeReportRequest {}
1877
- message ChannelFeeReport {
1878
- /// The channel that this fee report belongs to.
1879
- string chan_point = 1 [json_name = "channel_point"];
1880
-
1881
- /// The base fee charged regardless of the number of milli-satoshis sent.
1882
- int64 base_fee_msat = 2 [json_name = "base_fee_msat"];
1883
-
1884
- /// The amount charged per milli-satoshis transferred expressed in millionths of a satoshi.
1885
- int64 fee_per_mil = 3 [json_name = "fee_per_mil"];
1886
-
1887
- /// The effective fee rate in milli-satoshis. Computed by dividing the fee_per_mil value by 1 million.
1888
- double fee_rate = 4 [json_name = "fee_rate"];
1889
- }
1890
- message FeeReportResponse {
1891
- /// An array of channel fee reports which describes the current fee schedule for each channel.
1892
- repeated ChannelFeeReport channel_fees = 1 [json_name = "channel_fees"];
1893
-
1894
- /// The total amount of fee revenue (in satoshis) the switch has collected over the past 24 hrs.
1895
- uint64 day_fee_sum = 2 [json_name = "day_fee_sum"];
1896
-
1897
- /// The total amount of fee revenue (in satoshis) the switch has collected over the past 1 week.
1898
- uint64 week_fee_sum = 3 [json_name = "week_fee_sum"];
1899
-
1900
- /// The total amount of fee revenue (in satoshis) the switch has collected over the past 1 month.
1901
- uint64 month_fee_sum = 4 [json_name = "month_fee_sum"];
1902
- }
1903
-
1904
- message PolicyUpdateRequest {
1905
- oneof scope {
1906
- /// If set, then this update applies to all currently active channels.
1907
- bool global = 1 [json_name = "global"] ;
1908
-
1909
- /// If set, this update will target a specific channel.
1910
- ChannelPoint chan_point = 2 [json_name = "chan_point"];
1911
- }
1912
-
1913
- /// The base fee charged regardless of the number of milli-satoshis sent.
1914
- int64 base_fee_msat = 3 [json_name = "base_fee_msat"];
1915
-
1916
- /// The effective fee rate in milli-satoshis. The precision of this value goes up to 6 decimal places, so 1e-6.
1917
- double fee_rate = 4 [json_name = "fee_rate"];
1918
-
1919
- /// The required timelock delta for HTLCs forwarded over the channel.
1920
- uint32 time_lock_delta = 5 [json_name = "time_lock_delta"];
1921
- }
1922
- message PolicyUpdateResponse {
1923
- }
1924
-
1925
- message ForwardingHistoryRequest {
1926
- /// 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.
1927
- uint64 start_time = 1 [json_name = "start_time"];
1928
-
1929
- /// 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.
1930
- uint64 end_time = 2 [json_name = "end_time"];
1931
-
1932
- /// 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.
1933
- uint32 index_offset = 3 [json_name = "index_offset"];
1934
-
1935
- /// The max number of events to return in the response to this query.
1936
- uint32 num_max_events = 4 [json_name = "num_max_events"];
1937
- }
1938
- message ForwardingEvent {
1939
- /// Timestamp is the time (unix epoch offset) that this circuit was completed.
1940
- uint64 timestamp = 1 [json_name = "timestamp"];
1941
-
1942
- /// The incoming channel ID that carried the HTLC that created the circuit.
1943
- uint64 chan_id_in = 2 [json_name = "chan_id_in"];
1944
-
1945
- /// The outgoing channel ID that carried the preimage that completed the circuit.
1946
- uint64 chan_id_out = 4 [json_name = "chan_id_out"];
1947
-
1948
- /// The total amount of the incoming HTLC that created half the circuit.
1949
- uint64 amt_in = 5 [json_name = "amt_in"];
1950
-
1951
- /// The total amount of the outgoign HTLC that created the second half of the circuit.
1952
- uint64 amt_out = 6 [json_name = "amt_out"];
1953
-
1954
- /// The total fee that this payment circuit carried.
1955
- uint64 fee = 7 [json_name = "fee"];
1956
-
1957
- // TODO(roasbeef): add settlement latency?
1958
- // * use FPE on the chan id?
1959
- // * also list failures?
1960
- }
1961
- message ForwardingHistoryResponse {
1962
- /// A list of forwarding events from the time slice of the time series specified in the request.
1963
- repeated ForwardingEvent forwarding_events = 1 [json_name = "forwarding_events"];
1964
-
1965
- /// The index of the last time in the set of returned forwarding events. Can be used to seek further, pagination style.
1966
- uint32 last_offset_index = 2 [json_name = "last_offset_index"];
1967
- }