lnrpc 0.9.0 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/Gemfile.lock +24 -24
  4. data/README.md +30 -16
  5. data/examples.rb +13 -6
  6. data/generate-grpc-service-files.sh +29 -0
  7. data/lib/grpc_services/autopilotrpc/autopilot_pb.rb +48 -0
  8. data/lib/grpc_services/autopilotrpc/autopilot_services_pb.rb +40 -0
  9. data/lib/grpc_services/chainrpc/chainnotifier_pb.rb +67 -0
  10. data/lib/grpc_services/chainrpc/chainnotifier_services_pb.rb +51 -0
  11. data/lib/grpc_services/invoicesrpc/invoices_pb.rb +48 -0
  12. data/lib/grpc_services/invoicesrpc/invoices_services_pb.rb +41 -0
  13. data/lib/grpc_services/lnclipb/lncli_pb.rb +18 -0
  14. data/lib/grpc_services/routerrpc/router_pb.rb +277 -0
  15. data/lib/grpc_services/routerrpc/router_services_pb.rb +105 -0
  16. data/lib/grpc_services/rpc_pb.rb +1388 -0
  17. data/lib/{lnrpc → grpc_services}/rpc_services_pb.rb +165 -178
  18. data/lib/grpc_services/signrpc/signer_pb.rb +84 -0
  19. data/lib/grpc_services/signrpc/signer_services_pb.rb +69 -0
  20. data/lib/grpc_services/verrpc/verrpc_pb.rb +27 -0
  21. data/lib/grpc_services/verrpc/verrpc_services_pb.rb +27 -0
  22. data/lib/grpc_services/walletrpc/walletkit_pb.rb +254 -0
  23. data/lib/grpc_services/walletrpc/walletkit_services_pb.rb +188 -0
  24. data/lib/grpc_services/walletunlocker_pb.rb +57 -0
  25. data/lib/grpc_services/walletunlocker_services_pb.rb +72 -0
  26. data/lib/grpc_services/watchtowerrpc/watchtower_pb.rb +21 -0
  27. data/lib/grpc_services/watchtowerrpc/watchtower_services_pb.rb +28 -0
  28. data/lib/grpc_services/wtclientrpc/wtclient_pb.rb +83 -0
  29. data/lib/grpc_services/wtclientrpc/wtclient_services_pb.rb +43 -0
  30. data/lib/lnrpc.rb +19 -3
  31. data/lib/lnrpc/client.rb +62 -46
  32. data/lib/lnrpc/grpc_wrapper.rb +43 -0
  33. data/lib/lnrpc/version.rb +1 -1
  34. data/lnrpc.gemspec +7 -5
  35. metadata +41 -17
  36. data/lib/lnrpc/rpc.proto +0 -3075
  37. data/lib/lnrpc/rpc_pb.rb +0 -1082
@@ -0,0 +1,43 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: wtclientrpc/wtclient.proto for package 'wtclientrpc'
3
+
4
+ require 'grpc'
5
+ require 'wtclientrpc/wtclient_pb'
6
+
7
+ module Wtclientrpc
8
+ module WatchtowerClient
9
+ # WatchtowerClient is a service that grants access to the watchtower client
10
+ # functionality of the daemon.
11
+ class Service
12
+
13
+ include ::GRPC::GenericService
14
+
15
+ self.marshal_class_method = :encode
16
+ self.unmarshal_class_method = :decode
17
+ self.service_name = 'wtclientrpc.WatchtowerClient'
18
+
19
+ #
20
+ # AddTower adds a new watchtower reachable at the given address and
21
+ # considers it for new sessions. If the watchtower already exists, then
22
+ # any new addresses included will be considered when dialing it for
23
+ # session negotiations and backups.
24
+ rpc :AddTower, ::Wtclientrpc::AddTowerRequest, ::Wtclientrpc::AddTowerResponse
25
+ #
26
+ # RemoveTower removes a watchtower from being considered for future session
27
+ # negotiations and from being used for any subsequent backups until it's added
28
+ # again. If an address is provided, then this RPC only serves as a way of
29
+ # removing the address from the watchtower instead.
30
+ rpc :RemoveTower, ::Wtclientrpc::RemoveTowerRequest, ::Wtclientrpc::RemoveTowerResponse
31
+ # ListTowers returns the list of watchtowers registered with the client.
32
+ rpc :ListTowers, ::Wtclientrpc::ListTowersRequest, ::Wtclientrpc::ListTowersResponse
33
+ # GetTowerInfo retrieves information for a registered watchtower.
34
+ rpc :GetTowerInfo, ::Wtclientrpc::GetTowerInfoRequest, ::Wtclientrpc::Tower
35
+ # Stats returns the in-memory statistics of the client since startup.
36
+ rpc :Stats, ::Wtclientrpc::StatsRequest, ::Wtclientrpc::StatsResponse
37
+ # Policy returns the active watchtower client policy configuration.
38
+ rpc :Policy, ::Wtclientrpc::PolicyRequest, ::Wtclientrpc::PolicyResponse
39
+ end
40
+
41
+ Stub = Service.rpc_stub_class
42
+ end
43
+ end
data/lib/lnrpc.rb CHANGED
@@ -1,10 +1,26 @@
1
- require "lnrpc/version"
2
- require "lnrpc/rpc_services_pb"
1
+ require 'lnrpc/version'
2
+
3
+ # require GRPC services
4
+ Dir[File.join(File.expand_path(File.dirname(__FILE__)), 'grpc_services/**/*_services_pb.rb')].each do |file|
5
+ require file
6
+ end
7
+
8
+ require 'securerandom'
3
9
 
4
10
  module Lnrpc
5
11
  class Error < StandardError; end
6
12
  autoload :Client, 'lnrpc/client'
13
+ autoload :GrpcWrapper, 'lnrpc/grpc_wrapper'
7
14
  autoload :MacaroonInterceptor, 'lnrpc/macaroon_interceptor'
8
- end
9
15
 
16
+ PREIMAGE_BYTE_LENGTH = 32
17
+ KEY_SEND_PREIMAGE_TYPE = 5482373484
18
+
19
+ def self.create_preimage
20
+ SecureRandom.random_bytes(PREIMAGE_BYTE_LENGTH)
21
+ end
10
22
 
23
+ def self.to_byte_array(str)
24
+ [str].pack("H*")
25
+ end
26
+ end
data/lib/lnrpc/client.rb CHANGED
@@ -3,37 +3,18 @@ require "lnrpc/macaroon_interceptor"
3
3
  module Lnrpc
4
4
  class Client
5
5
  attr_accessor :address, :credentials, :macaroon
6
- attr_writer :grpc_client
7
6
 
8
7
  LND_HOME_DIR = ENV['LND_HOME'] || "~/.lnd"
9
8
  DEFAULT_ADDRESS = 'localhost:10009'
10
9
  DEFAULT_CREDENTIALS_PATH = "#{LND_HOME_DIR}/tls.cert"
11
10
  DEFAULT_MACAROON_PATH = "#{LND_HOME_DIR}/data/chain/bitcoin/mainnet/admin.macaroon"
12
11
 
13
- NON_CONVENTION_REQUEST_CLASSES = {
14
- add_invoice: Lnrpc::Invoice,
15
- send_payment: Lnrpc::SendRequest,
16
- send_payment_sync: Lnrpc::SendRequest,
17
- open_channel_sync: Lnrpc::OpenChannelRequest,
18
- send_to_route_sync: Lnrpc::SendToRouteRequest,
19
- lookup_invoice: Lnrpc::PaymentHash,
20
- decode_pay_req: Lnrpc::PayReqString,
21
- describe_graph: Lnrpc::ChannelGraphRequest,
22
- get_chan_info: Lnrpc::ChanInfoRequest,
23
- get_node_info: Lnrpc::NodeInfoRequest,
24
- get_network_info: Lnrpc::NetworkInfoRequest,
25
- stop_daemon: Lnrpc::StopRequest,
26
- update_channel_policy: Lnrpc::PolicyUpdateResponse,
27
- subscribe_channel_graph: Lnrpc::GraphTopologySubscription,
28
- subscribe_invoices: Lnrpc::InvoiceSubscription,
29
- subscribe_transactions: Lnrpc::GetTransactionsRequest
30
- }
31
-
32
12
  def initialize(options={})
33
13
  self.address = options[:address] || DEFAULT_ADDRESS
34
14
 
35
15
  if options.has_key?(:credentials)
36
- self.credentials = options[:credentials]
16
+ # if there are non hex values prvided we assume it's the certificate file as string otherwise we assume it's the hex value
17
+ self.credentials = options[:credentials].match?(/\H/) ? options[:credentials] : [options[:credentials]].pack('H*')
37
18
  elsif File.exists?(::File.expand_path(options[:credentials_path] || DEFAULT_CREDENTIALS_PATH))
38
19
  self.credentials = ::File.read(::File.expand_path(options[:credentials_path] || DEFAULT_CREDENTIALS_PATH))
39
20
  else
@@ -46,42 +27,77 @@ module Lnrpc
46
27
  self.macaroon = options[:macaroon]
47
28
  end
48
29
 
49
- def grpc_client
50
- @grpc_client ||= Lnrpc::Lightning::Stub.new(self.address,
51
- GRPC::Core::ChannelCredentials.new(self.credentials),
52
- interceptors: [Lnrpc::MacaroonInterceptor.new(self.macaroon)]
53
- )
30
+ def lightning
31
+ @lightning ||= grpc_wrapper_for(Lnrpc::Lightning)
54
32
  end
55
33
 
56
- def pay(payreq)
57
- self.send_payment_sync(Lnrpc::SendRequest.new(payment_request: payreq))
34
+ def autopilot
35
+ @autopilot ||= grpc_wrapper_for(Autopilotrpc::Autopilot)
58
36
  end
59
37
 
60
- def method_missing(m, *args, &block)
61
- if self.grpc_client.respond_to?(m)
62
- params = args[0]
38
+ def chain_notifier
39
+ @chain_notifier ||= grpc_wrapper_for(Chainrpc::ChainNotifier)
40
+ end
63
41
 
64
- args[0] = params.nil? ? request_class_for(m).new : request_class_for(m).new(params)
65
- self.grpc_client.send(m, *args, &block)
66
- else
67
- super
68
- end
42
+ def invoices
43
+ @invoices ||= grpc_wrapper_for(Invoicesrpc::Invoices)
44
+ end
45
+
46
+ def router
47
+ @router ||= grpc_wrapper_for(Routerrpc::Router)
48
+ end
49
+
50
+ def signer
51
+ @signer ||= grpc_wrapper_for(Signrpc::Signer)
52
+ end
53
+
54
+ def versioner
55
+ @versioner ||= grpc_wrapper_for(Verrpc::Versioner)
56
+ end
57
+
58
+ def wallet_kit
59
+ @wallet_kit ||= grpc_wrapper_for(Walletrpc::WalletKit)
60
+ end
61
+
62
+ def wallet_unlocker
63
+ @wallet_unlocker ||= grpc_wrapper_for(Lnrpc::WalletUnlocker)
64
+ end
65
+
66
+ def watchtower
67
+ @watchtower ||= grpc_wrapper_for(Watchtowerrpc::Watchtower)
68
+ end
69
+
70
+ def watchtower_client
71
+ @watchtower_client ||= grpc_wrapper_for(Wtclientrpc::WatchtowerClient)
72
+ end
73
+
74
+ def keysend(args)
75
+ args[:dest_custom_records] ||= {}
76
+ args[:dest_custom_records][Lnrpc::KEY_SEND_PREIMAGE_TYPE] ||= Lnrpc.create_preimage
77
+ args[:payment_hash] ||= Digest::SHA256.digest(args[:dest_custom_records][Lnrpc::KEY_SEND_PREIMAGE_TYPE])
78
+ args[:timeout_seconds] ||= 60
79
+ router.send_payment_v2(args)
80
+ end
81
+
82
+ def pay(args)
83
+ args[:timeout_seconds] ||= 60
84
+ router.send_payment_v2(args)
69
85
  end
70
86
 
71
87
  def inspect
72
- "#{self.to_s} @address=\"#{self.address}\""
88
+ "#{self} @address=\"#{address}\""
73
89
  end
74
90
 
75
91
  private
76
- def request_class_for(method_name)
77
- if NON_CONVENTION_REQUEST_CLASSES.key?(method_name.to_sym)
78
- NON_CONVENTION_REQUEST_CLASSES[method_name.to_sym]
79
- else
80
- klass = method_name.to_s.sub(/^[a-z\d]*/) { |match| match.capitalize }
81
- klass.gsub!(/(?:_|(\/))([a-z\d]*)/i) { "#{$1}#{$2.capitalize}" }
82
- Lnrpc.const_get("#{klass}Request")
83
- end
92
+
93
+ def grpc_wrapper_for(grpc_module)
94
+ stub = grpc_module.const_get(:Stub)
95
+ service = grpc_module.const_get(:Service)
96
+ GrpcWrapper.new(service: service,
97
+ grpc: stub.new(address,
98
+ GRPC::Core::ChannelCredentials.new(credentials),
99
+ interceptors: [Lnrpc::MacaroonInterceptor.new(macaroon)]
100
+ ))
84
101
  end
85
102
  end
86
103
  end
87
-
@@ -0,0 +1,43 @@
1
+ module Lnrpc
2
+ class GrpcWrapper
3
+ attr_reader :grpc, :service
4
+
5
+ def initialize(service:, grpc:)
6
+ @grpc = grpc
7
+ @service = service
8
+ end
9
+
10
+ def method_missing(m, *args, &block)
11
+ if grpc.respond_to?(m)
12
+ params = args[0]
13
+
14
+ args[0] = params.nil? ? request_class_for(m).new : request_class_for(m).new(params)
15
+ grpc.send(m, *args, &block)
16
+ else
17
+ super
18
+ end
19
+ end
20
+
21
+ def inspect
22
+ "#{self} @grpc=\"#{grpc}\""
23
+ end
24
+
25
+ private
26
+
27
+ def request_class_for(method_name)
28
+ rpc_desc = service.rpc_descs[camelize(method_name).to_sym]
29
+ raise "Request class not found for: #{method_name}" unless rpc_desc
30
+
31
+ rpc_desc.input
32
+ end
33
+
34
+ def camelize(name)
35
+ str = name.to_s
36
+ separators = ['_', '\s']
37
+ separators.each do |s|
38
+ str = str.gsub(/(?:#{s}+)([a-z])/) { $1.upcase }
39
+ end
40
+ str.gsub(/(\A|\s)([a-z])/) { $1 + $2.upcase }
41
+ end
42
+ end
43
+ end
data/lib/lnrpc/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lnrpc
2
- VERSION = "0.9.0"
2
+ VERSION = "0.13.0"
3
3
  end
data/lnrpc.gemspec CHANGED
@@ -14,6 +14,8 @@ Gem::Specification.new do |spec|
14
14
  spec.homepage = "https://github.com/bumi/lnrpc"
15
15
  spec.license = "MIT"
16
16
 
17
+ spec.metadata['funding'] = 'lightning:02ad33d99d0bb3bf3bb8ec8e089cbefa8fd7de23a13cfa59aec9af9730816be76f'
18
+
17
19
  # Specify which files should be added to the gem when it is released.
18
20
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
21
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
@@ -21,12 +23,12 @@ Gem::Specification.new do |spec|
21
23
  end
22
24
  spec.bindir = "exe"
23
25
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
- spec.require_paths = ["lib"]
26
+ spec.require_paths = ["lib", "lib/grpc_services"]
25
27
 
26
- spec.add_development_dependency "bundler", "~> 1.17"
27
- spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "bundler", "> 2.0"
29
+ spec.add_development_dependency "rake", "~> 13.0"
28
30
  spec.add_development_dependency "rspec", "~> 3.0"
29
31
 
30
- spec.add_dependency "grpc", ">= 1.19.0"
31
- spec.add_dependency "google-protobuf", ">=3.7"
32
+ spec.add_dependency "grpc", ">= 1.28.0"
33
+ spec.add_dependency "google-protobuf", ">=3.12"
32
34
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lnrpc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bumann
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-19 00:00:00.000000000 Z
11
+ date: 2021-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.17'
19
+ version: '2.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.17'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '13.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '13.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,28 +58,28 @@ dependencies:
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 1.19.0
61
+ version: 1.28.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 1.19.0
68
+ version: 1.28.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: google-protobuf
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '3.7'
75
+ version: '3.12'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '3.7'
82
+ version: '3.12'
83
83
  description: gRPC service definitions for the Lightning Network Daemon (lnd) gRPC
84
84
  interface packed as ruby gem
85
85
  email:
@@ -98,22 +98,46 @@ files:
98
98
  - bin/console
99
99
  - bin/setup
100
100
  - examples.rb
101
+ - generate-grpc-service-files.sh
102
+ - lib/grpc_services/autopilotrpc/autopilot_pb.rb
103
+ - lib/grpc_services/autopilotrpc/autopilot_services_pb.rb
104
+ - lib/grpc_services/chainrpc/chainnotifier_pb.rb
105
+ - lib/grpc_services/chainrpc/chainnotifier_services_pb.rb
106
+ - lib/grpc_services/invoicesrpc/invoices_pb.rb
107
+ - lib/grpc_services/invoicesrpc/invoices_services_pb.rb
108
+ - lib/grpc_services/lnclipb/lncli_pb.rb
109
+ - lib/grpc_services/routerrpc/router_pb.rb
110
+ - lib/grpc_services/routerrpc/router_services_pb.rb
111
+ - lib/grpc_services/rpc_pb.rb
112
+ - lib/grpc_services/rpc_services_pb.rb
113
+ - lib/grpc_services/signrpc/signer_pb.rb
114
+ - lib/grpc_services/signrpc/signer_services_pb.rb
115
+ - lib/grpc_services/verrpc/verrpc_pb.rb
116
+ - lib/grpc_services/verrpc/verrpc_services_pb.rb
117
+ - lib/grpc_services/walletrpc/walletkit_pb.rb
118
+ - lib/grpc_services/walletrpc/walletkit_services_pb.rb
119
+ - lib/grpc_services/walletunlocker_pb.rb
120
+ - lib/grpc_services/walletunlocker_services_pb.rb
121
+ - lib/grpc_services/watchtowerrpc/watchtower_pb.rb
122
+ - lib/grpc_services/watchtowerrpc/watchtower_services_pb.rb
123
+ - lib/grpc_services/wtclientrpc/wtclient_pb.rb
124
+ - lib/grpc_services/wtclientrpc/wtclient_services_pb.rb
101
125
  - lib/lnrpc.rb
102
126
  - lib/lnrpc/client.rb
127
+ - lib/lnrpc/grpc_wrapper.rb
103
128
  - lib/lnrpc/macaroon_interceptor.rb
104
- - lib/lnrpc/rpc.proto
105
- - lib/lnrpc/rpc_pb.rb
106
- - lib/lnrpc/rpc_services_pb.rb
107
129
  - lib/lnrpc/version.rb
108
130
  - lnrpc.gemspec
109
131
  homepage: https://github.com/bumi/lnrpc
110
132
  licenses:
111
133
  - MIT
112
- metadata: {}
134
+ metadata:
135
+ funding: lightning:02ad33d99d0bb3bf3bb8ec8e089cbefa8fd7de23a13cfa59aec9af9730816be76f
113
136
  post_install_message:
114
137
  rdoc_options: []
115
138
  require_paths:
116
139
  - lib
140
+ - lib/grpc_services
117
141
  required_ruby_version: !ruby/object:Gem::Requirement
118
142
  requirements:
119
143
  - - ">="
@@ -125,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
149
  - !ruby/object:Gem::Version
126
150
  version: '0'
127
151
  requirements: []
128
- rubygems_version: 3.0.6
152
+ rubygems_version: 3.1.4
129
153
  signing_key:
130
154
  specification_version: 4
131
155
  summary: gRPC interface for lnd packed as ruby gem
data/lib/lnrpc/rpc.proto DELETED
@@ -1,3075 +0,0 @@
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. When using REST, this field
98
- must be encoded as base64.
99
- */
100
- bytes aezeed_passphrase = 1;
101
-
102
- /**
103
- seed_entropy is an optional 16-bytes generated via CSPRNG. If not
104
- specified, then a fresh set of randomness will be used to create the seed.
105
- When using REST, this field must be encoded as base64.
106
- */
107
- bytes seed_entropy = 2;
108
- }
109
- message GenSeedResponse {
110
- /**
111
- cipher_seed_mnemonic is a 24-word mnemonic that encodes a prior aezeed
112
- cipher seed obtained by the user. This field is optional, as if not
113
- provided, then the daemon will generate a new cipher seed for the user.
114
- Otherwise, then the daemon will attempt to recover the wallet state linked
115
- to this cipher seed.
116
- */
117
- repeated string cipher_seed_mnemonic = 1;
118
-
119
- /**
120
- enciphered_seed are the raw aezeed cipher seed bytes. This is the raw
121
- cipher text before run through our mnemonic encoding scheme.
122
- */
123
- bytes enciphered_seed = 2;
124
- }
125
-
126
- message InitWalletRequest {
127
- /**
128
- wallet_password is the passphrase that should be used to encrypt the
129
- wallet. This MUST be at least 8 chars in length. After creation, this
130
- password is required to unlock the daemon. When using REST, this field
131
- must be encoded as base64.
132
- */
133
- bytes wallet_password = 1;
134
-
135
- /**
136
- cipher_seed_mnemonic is a 24-word mnemonic that encodes a prior aezeed
137
- cipher seed obtained by the user. This may have been generated by the
138
- GenSeed method, or be an existing seed.
139
- */
140
- repeated string cipher_seed_mnemonic = 2;
141
-
142
- /**
143
- aezeed_passphrase is an optional user provided passphrase that will be used
144
- to encrypt the generated aezeed cipher seed. When using REST, this field
145
- must be encoded as base64.
146
- */
147
- bytes aezeed_passphrase = 3;
148
-
149
- /**
150
- recovery_window is an optional argument specifying the address lookahead
151
- when restoring a wallet seed. The recovery window applies to each
152
- individual branch of the BIP44 derivation paths. Supplying a recovery
153
- window of zero indicates that no addresses should be recovered, such after
154
- the first initialization of the wallet.
155
- */
156
- int32 recovery_window = 4;
157
-
158
- /**
159
- channel_backups is an optional argument that allows clients to recover the
160
- settled funds within a set of channels. This should be populated if the
161
- user was unable to close out all channels and sweep funds before partial or
162
- total data loss occurred. If specified, then after on-chain recovery of
163
- funds, lnd begin to carry out the data loss recovery protocol in order to
164
- recover the funds in each channel from a remote force closed transaction.
165
- */
166
- ChanBackupSnapshot channel_backups = 5;
167
- }
168
- message InitWalletResponse {
169
- }
170
-
171
- message UnlockWalletRequest {
172
- /**
173
- wallet_password should be the current valid passphrase for the daemon. This
174
- will be required to decrypt on-disk material that the daemon requires to
175
- function properly. When using REST, this field must be encoded as base64.
176
- */
177
- bytes wallet_password = 1;
178
-
179
- /**
180
- recovery_window is an optional argument specifying the address lookahead
181
- when restoring a wallet seed. The recovery window applies to each
182
- individual branch of the BIP44 derivation paths. Supplying a recovery
183
- window of zero indicates that no addresses should be recovered, such after
184
- the first initialization of the wallet.
185
- */
186
- int32 recovery_window = 2;
187
-
188
- /**
189
- channel_backups is an optional argument that allows clients to recover the
190
- settled funds within a set of channels. This should be populated if the
191
- user was unable to close out all channels and sweep funds before partial or
192
- total data loss occurred. If specified, then after on-chain recovery of
193
- funds, lnd begin to carry out the data loss recovery protocol in order to
194
- recover the funds in each channel from a remote force closed transaction.
195
- */
196
- ChanBackupSnapshot channel_backups = 3;
197
- }
198
- message UnlockWalletResponse {}
199
-
200
- message ChangePasswordRequest {
201
- /**
202
- current_password should be the current valid passphrase used to unlock the
203
- daemon. When using REST, this field must be encoded as base64.
204
- */
205
- bytes current_password = 1;
206
-
207
- /**
208
- new_password should be the new passphrase that will be needed to unlock the
209
- daemon. When using REST, this field must be encoded as base64.
210
- */
211
- bytes new_password = 2;
212
- }
213
- message ChangePasswordResponse {}
214
-
215
- service Lightning {
216
- /** lncli: `walletbalance`
217
- WalletBalance returns total unspent outputs(confirmed and unconfirmed), all
218
- confirmed unspent outputs and all unconfirmed unspent outputs under control
219
- of the wallet.
220
- */
221
- rpc WalletBalance (WalletBalanceRequest) returns (WalletBalanceResponse) {
222
- option (google.api.http) = {
223
- get: "/v1/balance/blockchain"
224
- };
225
- }
226
-
227
- /** lncli: `channelbalance`
228
- ChannelBalance returns the total funds available across all open channels
229
- in satoshis.
230
- */
231
- rpc ChannelBalance (ChannelBalanceRequest) returns (ChannelBalanceResponse) {
232
- option (google.api.http) = {
233
- get: "/v1/balance/channels"
234
- };
235
- }
236
-
237
- /** lncli: `listchaintxns`
238
- GetTransactions returns a list describing all the known transactions
239
- relevant to the wallet.
240
- */
241
- rpc GetTransactions (GetTransactionsRequest) returns (TransactionDetails) {
242
- option (google.api.http) = {
243
- get: "/v1/transactions"
244
- };
245
- }
246
-
247
- /** lncli: `estimatefee`
248
- EstimateFee asks the chain backend to estimate the fee rate and total fees
249
- for a transaction that pays to multiple specified outputs.
250
- */
251
- rpc EstimateFee (EstimateFeeRequest) returns (EstimateFeeResponse) {
252
- option (google.api.http) = {
253
- get: "/v1/transactions/fee"
254
- };
255
- }
256
-
257
- /** lncli: `sendcoins`
258
- SendCoins executes a request to send coins to a particular address. Unlike
259
- SendMany, this RPC call only allows creating a single output at a time. If
260
- neither target_conf, or sat_per_byte are set, then the internal wallet will
261
- consult its fee model to determine a fee for the default confirmation
262
- target.
263
- */
264
- rpc SendCoins (SendCoinsRequest) returns (SendCoinsResponse) {
265
- option (google.api.http) = {
266
- post: "/v1/transactions"
267
- body: "*"
268
- };
269
- }
270
-
271
- /** lncli: `listunspent`
272
- ListUnspent returns a list of all utxos spendable by the wallet with a
273
- number of confirmations between the specified minimum and maximum.
274
- */
275
- rpc ListUnspent (ListUnspentRequest) returns (ListUnspentResponse) {
276
- option (google.api.http) = {
277
- get: "/v1/utxos"
278
- };
279
- }
280
-
281
- /**
282
- SubscribeTransactions creates a uni-directional stream from the server to
283
- the client in which any newly discovered transactions relevant to the
284
- wallet are sent over.
285
- */
286
- rpc SubscribeTransactions (GetTransactionsRequest) returns (stream Transaction);
287
-
288
- /** lncli: `sendmany`
289
- SendMany handles a request for a transaction that creates multiple specified
290
- outputs in parallel. If neither target_conf, or sat_per_byte are set, then
291
- the internal wallet will consult its fee model to determine a fee for the
292
- default confirmation target.
293
- */
294
- rpc SendMany (SendManyRequest) returns (SendManyResponse);
295
-
296
- /** lncli: `newaddress`
297
- NewAddress creates a new address under control of the local wallet.
298
- */
299
- rpc NewAddress (NewAddressRequest) returns (NewAddressResponse) {
300
- option (google.api.http) = {
301
- get: "/v1/newaddress"
302
- };
303
- }
304
-
305
- /** lncli: `signmessage`
306
- SignMessage signs a message with this node's private key. The returned
307
- signature string is `zbase32` encoded and pubkey recoverable, meaning that
308
- only the message digest and signature are needed for verification.
309
- */
310
- rpc SignMessage (SignMessageRequest) returns (SignMessageResponse) {
311
- option (google.api.http) = {
312
- post: "/v1/signmessage"
313
- body: "*"
314
- };
315
- }
316
-
317
- /** lncli: `verifymessage`
318
- VerifyMessage verifies a signature over a msg. The signature must be
319
- zbase32 encoded and signed by an active node in the resident node's
320
- channel database. In addition to returning the validity of the signature,
321
- VerifyMessage also returns the recovered pubkey from the signature.
322
- */
323
- rpc VerifyMessage (VerifyMessageRequest) returns (VerifyMessageResponse) {
324
- option (google.api.http) = {
325
- post: "/v1/verifymessage"
326
- body: "*"
327
- };
328
- }
329
-
330
- /** lncli: `connect`
331
- ConnectPeer attempts to establish a connection to a remote peer. This is at
332
- the networking level, and is used for communication between nodes. This is
333
- distinct from establishing a channel with a peer.
334
- */
335
- rpc ConnectPeer (ConnectPeerRequest) returns (ConnectPeerResponse) {
336
- option (google.api.http) = {
337
- post: "/v1/peers"
338
- body: "*"
339
- };
340
- }
341
-
342
- /** lncli: `disconnect`
343
- DisconnectPeer attempts to disconnect one peer from another identified by a
344
- given pubKey. In the case that we currently have a pending or active channel
345
- with the target peer, then this action will be not be allowed.
346
- */
347
- rpc DisconnectPeer (DisconnectPeerRequest) returns (DisconnectPeerResponse) {
348
- option (google.api.http) = {
349
- delete: "/v1/peers/{pub_key}"
350
- };
351
- }
352
-
353
- /** lncli: `listpeers`
354
- ListPeers returns a verbose listing of all currently active peers.
355
- */
356
- rpc ListPeers (ListPeersRequest) returns (ListPeersResponse) {
357
- option (google.api.http) = {
358
- get: "/v1/peers"
359
- };
360
- }
361
-
362
- /**
363
- SubscribePeerEvents creates a uni-directional stream from the server to
364
- the client in which any events relevant to the state of peers are sent
365
- over. Events include peers going online and offline.
366
- */
367
- rpc SubscribePeerEvents (PeerEventSubscription) returns (stream PeerEvent);
368
-
369
- /** lncli: `getinfo`
370
- GetInfo returns general information concerning the lightning node including
371
- it's identity pubkey, alias, the chains it is connected to, and information
372
- concerning the number of open+pending channels.
373
- */
374
- rpc GetInfo (GetInfoRequest) returns (GetInfoResponse) {
375
- option (google.api.http) = {
376
- get: "/v1/getinfo"
377
- };
378
- }
379
-
380
- // TODO(roasbeef): merge with below with bool?
381
- /** lncli: `pendingchannels`
382
- PendingChannels returns a list of all the channels that are currently
383
- considered "pending". A channel is pending if it has finished the funding
384
- workflow and is waiting for confirmations for the funding txn, or is in the
385
- process of closure, either initiated cooperatively or non-cooperatively.
386
- */
387
- rpc PendingChannels (PendingChannelsRequest) returns (PendingChannelsResponse) {
388
- option (google.api.http) = {
389
- get: "/v1/channels/pending"
390
- };
391
- }
392
-
393
- /** lncli: `listchannels`
394
- ListChannels returns a description of all the open channels that this node
395
- is a participant in.
396
- */
397
- rpc ListChannels (ListChannelsRequest) returns (ListChannelsResponse) {
398
- option (google.api.http) = {
399
- get: "/v1/channels"
400
- };
401
- }
402
-
403
- /**
404
- SubscribeChannelEvents creates a uni-directional stream from the server to
405
- the client in which any updates relevant to the state of the channels are
406
- sent over. Events include new active channels, inactive channels, and closed
407
- channels.
408
- */
409
- rpc SubscribeChannelEvents (ChannelEventSubscription) returns (stream ChannelEventUpdate);
410
-
411
- /** lncli: `closedchannels`
412
- ClosedChannels returns a description of all the closed channels that
413
- this node was a participant in.
414
- */
415
- rpc ClosedChannels (ClosedChannelsRequest) returns (ClosedChannelsResponse) {
416
- option (google.api.http) = {
417
- get: "/v1/channels/closed"
418
- };
419
- }
420
-
421
-
422
- /**
423
- OpenChannelSync is a synchronous version of the OpenChannel RPC call. This
424
- call is meant to be consumed by clients to the REST proxy. As with all
425
- other sync calls, all byte slices are intended to be populated as hex
426
- encoded strings.
427
- */
428
- rpc OpenChannelSync (OpenChannelRequest) returns (ChannelPoint) {
429
- option (google.api.http) = {
430
- post: "/v1/channels"
431
- body: "*"
432
- };
433
- }
434
-
435
- /** lncli: `openchannel`
436
- OpenChannel attempts to open a singly funded channel specified in the
437
- request to a remote peer. Users are able to specify a target number of
438
- blocks that the funding transaction should be confirmed in, or a manual fee
439
- rate to us for the funding transaction. If neither are specified, then a
440
- lax block confirmation target is used. Each OpenStatusUpdate will return
441
- the pending channel ID of the in-progress channel. Depending on the
442
- arguments specified in the OpenChannelRequest, this pending channel ID can
443
- then be used to manually progress the channel funding flow.
444
- */
445
- rpc OpenChannel (OpenChannelRequest) returns (stream OpenStatusUpdate);
446
-
447
- /**
448
- FundingStateStep is an advanced funding related call that allows the caller
449
- to either execute some preparatory steps for a funding workflow, or
450
- manually progress a funding workflow. The primary way a funding flow is
451
- identified is via its pending channel ID. As an example, this method can be
452
- used to specify that we're expecting a funding flow for a particular
453
- pending channel ID, for which we need to use specific parameters.
454
- Alternatively, this can be used to interactively drive PSBT signing for
455
- funding for partially complete funding transactions.
456
- */
457
- rpc FundingStateStep(FundingTransitionMsg) returns (FundingStateStepResp);
458
-
459
- /**
460
- ChannelAcceptor dispatches a bi-directional streaming RPC in which
461
- OpenChannel requests are sent to the client and the client responds with
462
- a boolean that tells LND whether or not to accept the channel. This allows
463
- node operators to specify their own criteria for accepting inbound channels
464
- through a single persistent connection.
465
- */
466
- rpc ChannelAcceptor (stream ChannelAcceptResponse) returns (stream ChannelAcceptRequest);
467
-
468
- /** lncli: `closechannel`
469
- CloseChannel attempts to close an active channel identified by its channel
470
- outpoint (ChannelPoint). The actions of this method can additionally be
471
- augmented to attempt a force close after a timeout period in the case of an
472
- inactive peer. If a non-force close (cooperative closure) is requested,
473
- then the user can specify either a target number of blocks until the
474
- closure transaction is confirmed, or a manual fee rate. If neither are
475
- specified, then a default lax, block confirmation target is used.
476
- */
477
- rpc CloseChannel (CloseChannelRequest) returns (stream CloseStatusUpdate) {
478
- option (google.api.http) = {
479
- delete: "/v1/channels/{channel_point.funding_txid_str}/{channel_point.output_index}"
480
- };
481
- }
482
-
483
- /** lncli: `abandonchannel`
484
- AbandonChannel removes all channel state from the database except for a
485
- close summary. This method can be used to get rid of permanently unusable
486
- channels due to bugs fixed in newer versions of lnd. Only available
487
- when in debug builds of lnd.
488
- */
489
- rpc AbandonChannel (AbandonChannelRequest) returns (AbandonChannelResponse) {
490
- option (google.api.http) = {
491
- delete: "/v1/channels/abandon/{channel_point.funding_txid_str}/{channel_point.output_index}"
492
- };
493
- }
494
-
495
-
496
- /** lncli: `sendpayment`
497
- SendPayment dispatches a bi-directional streaming RPC for sending payments
498
- through the Lightning Network. A single RPC invocation creates a persistent
499
- bi-directional stream allowing clients to rapidly send payments through the
500
- Lightning Network with a single persistent connection.
501
- */
502
- rpc SendPayment (stream SendRequest) returns (stream SendResponse);
503
-
504
- /**
505
- SendPaymentSync is the synchronous non-streaming version of SendPayment.
506
- This RPC is intended to be consumed by clients of the REST proxy.
507
- Additionally, this RPC expects the destination's public key and the payment
508
- hash (if any) to be encoded as hex strings.
509
- */
510
- rpc SendPaymentSync (SendRequest) returns (SendResponse) {
511
- option (google.api.http) = {
512
- post: "/v1/channels/transactions"
513
- body: "*"
514
- };
515
- }
516
-
517
- /** lncli: `sendtoroute`
518
- SendToRoute is a bi-directional streaming RPC for sending payment through
519
- the Lightning Network. This method differs from SendPayment in that it
520
- allows users to specify a full route manually. This can be used for things
521
- like rebalancing, and atomic swaps.
522
- */
523
- rpc SendToRoute(stream SendToRouteRequest) returns (stream SendResponse);
524
-
525
- /**
526
- SendToRouteSync is a synchronous version of SendToRoute. It Will block
527
- until the payment either fails or succeeds.
528
- */
529
- rpc SendToRouteSync (SendToRouteRequest) returns (SendResponse) {
530
- option (google.api.http) = {
531
- post: "/v1/channels/transactions/route"
532
- body: "*"
533
- };
534
- }
535
-
536
- /** lncli: `addinvoice`
537
- AddInvoice attempts to add a new invoice to the invoice database. Any
538
- duplicated invoices are rejected, therefore all invoices *must* have a
539
- unique payment preimage.
540
- */
541
- rpc AddInvoice (Invoice) returns (AddInvoiceResponse) {
542
- option (google.api.http) = {
543
- post: "/v1/invoices"
544
- body: "*"
545
- };
546
- }
547
-
548
- /** lncli: `listinvoices`
549
- ListInvoices returns a list of all the invoices currently stored within the
550
- database. Any active debug invoices are ignored. It has full support for
551
- paginated responses, allowing users to query for specific invoices through
552
- their add_index. This can be done by using either the first_index_offset or
553
- last_index_offset fields included in the response as the index_offset of the
554
- next request. By default, the first 100 invoices created will be returned.
555
- Backwards pagination is also supported through the Reversed flag.
556
- */
557
- rpc ListInvoices (ListInvoiceRequest) returns (ListInvoiceResponse) {
558
- option (google.api.http) = {
559
- get: "/v1/invoices"
560
- };
561
- }
562
-
563
- /** lncli: `lookupinvoice`
564
- LookupInvoice attempts to look up an invoice according to its payment hash.
565
- The passed payment hash *must* be exactly 32 bytes, if not, an error is
566
- returned.
567
- */
568
- rpc LookupInvoice (PaymentHash) returns (Invoice) {
569
- option (google.api.http) = {
570
- get: "/v1/invoice/{r_hash_str}"
571
- };
572
- }
573
-
574
- /**
575
- SubscribeInvoices returns a uni-directional stream (server -> client) for
576
- notifying the client of newly added/settled invoices. The caller can
577
- optionally specify the add_index and/or the settle_index. If the add_index
578
- is specified, then we'll first start by sending add invoice events for all
579
- invoices with an add_index greater than the specified value. If the
580
- settle_index is specified, the next, we'll send out all settle events for
581
- invoices with a settle_index greater than the specified value. One or both
582
- of these fields can be set. If no fields are set, then we'll only send out
583
- the latest add/settle events.
584
- */
585
- rpc SubscribeInvoices (InvoiceSubscription) returns (stream Invoice) {
586
- option (google.api.http) = {
587
- get: "/v1/invoices/subscribe"
588
- };
589
- }
590
-
591
- /** lncli: `decodepayreq`
592
- DecodePayReq takes an encoded payment request string and attempts to decode
593
- it, returning a full description of the conditions encoded within the
594
- payment request.
595
- */
596
- rpc DecodePayReq (PayReqString) returns (PayReq) {
597
- option (google.api.http) = {
598
- get: "/v1/payreq/{pay_req}"
599
- };
600
- }
601
-
602
- /** lncli: `listpayments`
603
- ListPayments returns a list of all outgoing payments.
604
- */
605
- rpc ListPayments (ListPaymentsRequest) returns (ListPaymentsResponse) {
606
- option (google.api.http) = {
607
- get: "/v1/payments"
608
- };
609
- };
610
-
611
- /**
612
- DeleteAllPayments deletes all outgoing payments from DB.
613
- */
614
- rpc DeleteAllPayments (DeleteAllPaymentsRequest) returns (DeleteAllPaymentsResponse) {
615
- option (google.api.http) = {
616
- delete: "/v1/payments"
617
- };
618
- };
619
-
620
- /** lncli: `describegraph`
621
- DescribeGraph returns a description of the latest graph state from the
622
- point of view of the node. The graph information is partitioned into two
623
- components: all the nodes/vertexes, and all the edges that connect the
624
- vertexes themselves. As this is a directed graph, the edges also contain
625
- the node directional specific routing policy which includes: the time lock
626
- delta, fee information, etc.
627
- */
628
- rpc DescribeGraph (ChannelGraphRequest) returns (ChannelGraph) {
629
- option (google.api.http) = {
630
- get: "/v1/graph"
631
- };
632
- }
633
-
634
- /** lncli: `getchaninfo`
635
- GetChanInfo returns the latest authenticated network announcement for the
636
- given channel identified by its channel ID: an 8-byte integer which
637
- uniquely identifies the location of transaction's funding output within the
638
- blockchain.
639
- */
640
- rpc GetChanInfo (ChanInfoRequest) returns (ChannelEdge) {
641
- option (google.api.http) = {
642
- get: "/v1/graph/edge/{chan_id}"
643
- };
644
- }
645
-
646
- /** lncli: `getnodeinfo`
647
- GetNodeInfo returns the latest advertised, aggregated, and authenticated
648
- channel information for the specified node identified by its public key.
649
- */
650
- rpc GetNodeInfo (NodeInfoRequest) returns (NodeInfo) {
651
- option (google.api.http) = {
652
- get: "/v1/graph/node/{pub_key}"
653
- };
654
- }
655
-
656
- /** lncli: `queryroutes`
657
- QueryRoutes attempts to query the daemon's Channel Router for a possible
658
- route to a target destination capable of carrying a specific amount of
659
- satoshis. The returned route contains the full details required to craft and
660
- send an HTLC, also including the necessary information that should be
661
- present within the Sphinx packet encapsulated within the HTLC.
662
- */
663
- rpc QueryRoutes(QueryRoutesRequest) returns (QueryRoutesResponse) {
664
- option (google.api.http) = {
665
- get: "/v1/graph/routes/{pub_key}/{amt}"
666
- };
667
- }
668
-
669
- /** lncli: `getnetworkinfo`
670
- GetNetworkInfo returns some basic stats about the known channel graph from
671
- the point of view of the node.
672
- */
673
- rpc GetNetworkInfo (NetworkInfoRequest) returns (NetworkInfo) {
674
- option (google.api.http) = {
675
- get: "/v1/graph/info"
676
- };
677
- }
678
-
679
- /** lncli: `stop`
680
- StopDaemon will send a shutdown request to the interrupt handler, triggering
681
- a graceful shutdown of the daemon.
682
- */
683
- rpc StopDaemon(StopRequest) returns (StopResponse);
684
-
685
- /**
686
- SubscribeChannelGraph launches a streaming RPC that allows the caller to
687
- receive notifications upon any changes to the channel graph topology from
688
- the point of view of the responding node. Events notified include: new
689
- nodes coming online, nodes updating their authenticated attributes, new
690
- channels being advertised, updates in the routing policy for a directional
691
- channel edge, and when channels are closed on-chain.
692
- */
693
- rpc SubscribeChannelGraph(GraphTopologySubscription) returns (stream GraphTopologyUpdate);
694
-
695
- /** lncli: `debuglevel`
696
- DebugLevel allows a caller to programmatically set the logging verbosity of
697
- lnd. The logging can be targeted according to a coarse daemon-wide logging
698
- level, or in a granular fashion to specify the logging for a target
699
- sub-system.
700
- */
701
- rpc DebugLevel (DebugLevelRequest) returns (DebugLevelResponse);
702
-
703
- /** lncli: `feereport`
704
- FeeReport allows the caller to obtain a report detailing the current fee
705
- schedule enforced by the node globally for each channel.
706
- */
707
- rpc FeeReport(FeeReportRequest) returns (FeeReportResponse) {
708
- option (google.api.http) = {
709
- get: "/v1/fees"
710
- };
711
- }
712
-
713
- /** lncli: `updatechanpolicy`
714
- UpdateChannelPolicy allows the caller to update the fee schedule and
715
- channel policies for all channels globally, or a particular channel.
716
- */
717
- rpc UpdateChannelPolicy(PolicyUpdateRequest) returns (PolicyUpdateResponse) {
718
- option (google.api.http) = {
719
- post: "/v1/chanpolicy"
720
- body: "*"
721
- };
722
- }
723
-
724
- /** lncli: `fwdinghistory`
725
- ForwardingHistory allows the caller to query the htlcswitch for a record of
726
- all HTLCs forwarded within the target time range, and integer offset
727
- within that time range. If no time-range is specified, then the first chunk
728
- of the past 24 hrs of forwarding history are returned.
729
-
730
- A list of forwarding events are returned. The size of each forwarding event
731
- is 40 bytes, and the max message size able to be returned in gRPC is 4 MiB.
732
- As a result each message can only contain 50k entries. Each response has
733
- the index offset of the last entry. The index offset can be provided to the
734
- request to allow the caller to skip a series of records.
735
- */
736
- rpc ForwardingHistory(ForwardingHistoryRequest) returns (ForwardingHistoryResponse) {
737
- option (google.api.http) = {
738
- post: "/v1/switch"
739
- body: "*"
740
- };
741
- };
742
-
743
- /** lncli: `exportchanbackup`
744
- ExportChannelBackup attempts to return an encrypted static channel backup
745
- for the target channel identified by it channel point. The backup is
746
- encrypted with a key generated from the aezeed seed of the user. The
747
- returned backup can either be restored using the RestoreChannelBackup
748
- method once lnd is running, or via the InitWallet and UnlockWallet methods
749
- from the WalletUnlocker service.
750
- */
751
- rpc ExportChannelBackup(ExportChannelBackupRequest) returns (ChannelBackup) {
752
- option (google.api.http) = {
753
- get: "/v1/channels/backup/{chan_point.funding_txid_str}/{chan_point.output_index}"
754
- };
755
- };
756
-
757
- /**
758
- ExportAllChannelBackups returns static channel backups for all existing
759
- channels known to lnd. A set of regular singular static channel backups for
760
- each channel are returned. Additionally, a multi-channel backup is returned
761
- as well, which contains a single encrypted blob containing the backups of
762
- each channel.
763
- */
764
- rpc ExportAllChannelBackups(ChanBackupExportRequest) returns (ChanBackupSnapshot) {
765
- option (google.api.http) = {
766
- get: "/v1/channels/backup"
767
- };
768
- };
769
-
770
- /**
771
- VerifyChanBackup allows a caller to verify the integrity of a channel backup
772
- snapshot. This method will accept either a packed Single or a packed Multi.
773
- Specifying both will result in an error.
774
- */
775
- rpc VerifyChanBackup(ChanBackupSnapshot) returns (VerifyChanBackupResponse) {
776
- option (google.api.http) = {
777
- post: "/v1/channels/backup/verify"
778
- body: "*"
779
- };
780
- };
781
-
782
- /** lncli: `restorechanbackup`
783
- RestoreChannelBackups accepts a set of singular channel backups, or a
784
- single encrypted multi-chan backup and attempts to recover any funds
785
- remaining within the channel. If we are able to unpack the backup, then the
786
- new channel will be shown under listchannels, as well as pending channels.
787
- */
788
- rpc RestoreChannelBackups(RestoreChanBackupRequest) returns (RestoreBackupResponse) {
789
- option (google.api.http) = {
790
- post: "/v1/channels/backup/restore"
791
- body: "*"
792
- };
793
- };
794
-
795
- /**
796
- SubscribeChannelBackups allows a client to sub-subscribe to the most up to
797
- date information concerning the state of all channel backups. Each time a
798
- new channel is added, we return the new set of channels, along with a
799
- multi-chan backup containing the backup info for all channels. Each time a
800
- channel is closed, we send a new update, which contains new new chan back
801
- ups, but the updated set of encrypted multi-chan backups with the closed
802
- channel(s) removed.
803
- */
804
- rpc SubscribeChannelBackups(ChannelBackupSubscription) returns (stream ChanBackupSnapshot) {
805
- };
806
-
807
- /** lncli: `bakemacaroon`
808
- BakeMacaroon allows the creation of a new macaroon with custom read and
809
- write permissions. No first-party caveats are added since this can be done
810
- offline.
811
- */
812
- rpc BakeMacaroon(BakeMacaroonRequest) returns (BakeMacaroonResponse) {
813
- option (google.api.http) = {
814
- post: "/v1/macaroon"
815
- body: "*"
816
- };
817
- };
818
- }
819
-
820
- message Utxo {
821
- /// The type of address
822
- AddressType type = 1 [json_name = "address_type"];
823
-
824
- /// The address
825
- string address = 2 [json_name = "address"];
826
-
827
- /// The value of the unspent coin in satoshis
828
- int64 amount_sat = 3 [json_name = "amount_sat"];
829
-
830
- /// The pkscript in hex
831
- string pk_script = 4 [json_name = "pk_script"];
832
-
833
- /// The outpoint in format txid:n
834
- OutPoint outpoint = 5 [json_name = "outpoint"];
835
-
836
- /// The number of confirmations for the Utxo
837
- int64 confirmations = 6 [json_name = "confirmations"];
838
- }
839
-
840
- message Transaction {
841
- /// The transaction hash
842
- string tx_hash = 1 [ json_name = "tx_hash" ];
843
-
844
- /// The transaction amount, denominated in satoshis
845
- int64 amount = 2 [ json_name = "amount" ];
846
-
847
- /// The number of confirmations
848
- int32 num_confirmations = 3 [ json_name = "num_confirmations" ];
849
-
850
- /// The hash of the block this transaction was included in
851
- string block_hash = 4 [ json_name = "block_hash" ];
852
-
853
- /// The height of the block this transaction was included in
854
- int32 block_height = 5 [ json_name = "block_height" ];
855
-
856
- /// Timestamp of this transaction
857
- int64 time_stamp = 6 [ json_name = "time_stamp" ];
858
-
859
- /// Fees paid for this transaction
860
- int64 total_fees = 7 [ json_name = "total_fees" ];
861
-
862
- /// Addresses that received funds for this transaction
863
- repeated string dest_addresses = 8 [ json_name = "dest_addresses" ];
864
-
865
- /// The raw transaction hex.
866
- string raw_tx_hex = 9 [ json_name = "raw_tx_hex" ];
867
- }
868
- message GetTransactionsRequest {
869
- }
870
- message TransactionDetails {
871
- /// The list of transactions relevant to the wallet.
872
- repeated Transaction transactions = 1 [json_name = "transactions"];
873
- }
874
-
875
- message FeeLimit {
876
- oneof limit {
877
- /**
878
- The fee limit expressed as a fixed amount of satoshis.
879
-
880
- The fields fixed and fixed_msat are mutually exclusive.
881
- */
882
- int64 fixed = 1;
883
-
884
- /**
885
- The fee limit expressed as a fixed amount of millisatoshis.
886
-
887
- The fields fixed and fixed_msat are mutually exclusive.
888
- */
889
- int64 fixed_msat = 3;
890
-
891
- /// The fee limit expressed as a percentage of the payment amount.
892
- int64 percent = 2;
893
- }
894
- }
895
-
896
- message SendRequest {
897
- /**
898
- The identity pubkey of the payment recipient. When using REST, this field
899
- must be encoded as base64.
900
- */
901
- bytes dest = 1;
902
-
903
- /**
904
- The hex-encoded identity pubkey of the payment recipient. Deprecated now
905
- that the REST gateway supports base64 encoding of bytes fields.
906
- */
907
- string dest_string = 2 [deprecated = true];
908
-
909
- /**
910
- The amount to send expressed in satoshis.
911
-
912
- The fields amt and amt_msat are mutually exclusive.
913
- */
914
- int64 amt = 3;
915
-
916
- /**
917
- The amount to send expressed in millisatoshis.
918
-
919
- The fields amt and amt_msat are mutually exclusive.
920
- */
921
- int64 amt_msat = 12;
922
-
923
- /**
924
- The hash to use within the payment's HTLC. When using REST, this field
925
- must be encoded as base64.
926
- */
927
- bytes payment_hash = 4;
928
-
929
- /**
930
- The hex-encoded hash to use within the payment's HTLC. Deprecated now
931
- that the REST gateway supports base64 encoding of bytes fields.
932
- */
933
- string payment_hash_string = 5 [deprecated = true];
934
-
935
- /**
936
- A bare-bones invoice for a payment within the Lightning Network. With the
937
- details of the invoice, the sender has all the data necessary to send a
938
- payment to the recipient.
939
- */
940
- string payment_request = 6;
941
-
942
- /**
943
- The CLTV delta from the current height that should be used to set the
944
- timelock for the final hop.
945
- */
946
- int32 final_cltv_delta = 7;
947
-
948
- /**
949
- The maximum number of satoshis that will be paid as a fee of the payment.
950
- This value can be represented either as a percentage of the amount being
951
- sent, or as a fixed amount of the maximum fee the user is willing the pay to
952
- send the payment.
953
- */
954
- FeeLimit fee_limit = 8;
955
-
956
- /**
957
- The channel id of the channel that must be taken to the first hop. If zero,
958
- any channel may be used.
959
- */
960
- uint64 outgoing_chan_id = 9 [jstype = JS_STRING];
961
-
962
- /**
963
- The pubkey of the last hop of the route. If empty, any hop may be used.
964
- */
965
- bytes last_hop_pubkey = 13;
966
-
967
- /**
968
- An optional maximum total time lock for the route. This should not exceed
969
- lnd's `--max-cltv-expiry` setting. If zero, then the value of
970
- `--max-cltv-expiry` is enforced.
971
- */
972
- uint32 cltv_limit = 10;
973
-
974
- /**
975
- An optional field that can be used to pass an arbitrary set of TLV records
976
- to a peer which understands the new records. This can be used to pass
977
- application specific data during the payment attempt. Record types are
978
- required to be in the custom range >= 65536. When using REST, the values
979
- must be encoded as base64.
980
- */
981
- map<uint64, bytes> dest_custom_records = 11;
982
-
983
- /// If set, circular payments to self are permitted.
984
- bool allow_self_payment = 14;
985
-
986
- /**
987
- Features assumed to be supported by the final node. All transitive feature
988
- depdencies must also be set properly. For a given feature bit pair, either
989
- optional or remote may be set, but not both. If this field is nil or empty,
990
- the router will try to load destination features from the graph as a
991
- fallback.
992
- */
993
- repeated FeatureBit dest_features = 15;
994
- }
995
-
996
- message SendResponse {
997
- string payment_error = 1 [json_name = "payment_error"];
998
- bytes payment_preimage = 2 [json_name = "payment_preimage"];
999
- Route payment_route = 3 [json_name = "payment_route"];
1000
- bytes payment_hash = 4 [json_name = "payment_hash"];
1001
- }
1002
-
1003
- message SendToRouteRequest {
1004
- /**
1005
- The payment hash to use for the HTLC. When using REST, this field must be
1006
- encoded as base64.
1007
- */
1008
- bytes payment_hash = 1;
1009
-
1010
- /**
1011
- An optional hex-encoded payment hash to be used for the HTLC. Deprecated now
1012
- that the REST gateway supports base64 encoding of bytes fields.
1013
- */
1014
- string payment_hash_string = 2 [deprecated = true];
1015
-
1016
- reserved 3;
1017
-
1018
- /// Route that should be used to attempt to complete the payment.
1019
- Route route = 4;
1020
- }
1021
-
1022
- message ChannelAcceptRequest {
1023
- /// The pubkey of the node that wishes to open an inbound channel.
1024
- bytes node_pubkey = 1;
1025
-
1026
- /// The hash of the genesis block that the proposed channel resides in.
1027
- bytes chain_hash = 2;
1028
-
1029
- /// The pending channel id.
1030
- bytes pending_chan_id = 3;
1031
-
1032
- /// The funding amount in satoshis that initiator wishes to use in the channel.
1033
- uint64 funding_amt = 4;
1034
-
1035
- /// The push amount of the proposed channel in millisatoshis.
1036
- uint64 push_amt = 5;
1037
-
1038
- /// The dust limit of the initiator's commitment tx.
1039
- uint64 dust_limit = 6;
1040
-
1041
- /// The maximum amount of coins in millisatoshis that can be pending in this channel.
1042
- uint64 max_value_in_flight = 7;
1043
-
1044
- /// The minimum amount of satoshis the initiator requires us to have at all times.
1045
- uint64 channel_reserve = 8;
1046
-
1047
- /// The smallest HTLC in millisatoshis that the initiator will accept.
1048
- uint64 min_htlc = 9;
1049
-
1050
- /// The initial fee rate that the initiator suggests for both commitment transactions.
1051
- uint64 fee_per_kw = 10;
1052
-
1053
- /**
1054
- The number of blocks to use for the relative time lock in the pay-to-self output
1055
- of both commitment transactions.
1056
- */
1057
- uint32 csv_delay = 11;
1058
-
1059
- /// The total number of incoming HTLC's that the initiator will accept.
1060
- uint32 max_accepted_htlcs = 12;
1061
-
1062
- /// A bit-field which the initiator uses to specify proposed channel behavior.
1063
- uint32 channel_flags = 13;
1064
- }
1065
-
1066
- message ChannelAcceptResponse {
1067
- /// Whether or not the client accepts the channel.
1068
- bool accept = 1;
1069
-
1070
- /// The pending channel id to which this response applies.
1071
- bytes pending_chan_id = 2;
1072
- }
1073
-
1074
- message ChannelPoint {
1075
- oneof funding_txid {
1076
- /**
1077
- Txid of the funding transaction. When using REST, this field must be
1078
- encoded as base64.
1079
- */
1080
- bytes funding_txid_bytes = 1 [json_name = "funding_txid_bytes"];
1081
-
1082
- /**
1083
- Hex-encoded string representing the byte-reversed hash of the funding
1084
- transaction.
1085
- */
1086
- string funding_txid_str = 2 [json_name = "funding_txid_str"];
1087
- }
1088
-
1089
- /// The index of the output of the funding transaction
1090
- uint32 output_index = 3 [json_name = "output_index"];
1091
- }
1092
-
1093
- message OutPoint {
1094
- /// Raw bytes representing the transaction id.
1095
- bytes txid_bytes = 1 [json_name = "txid_bytes"];
1096
-
1097
- /// Reversed, hex-encoded string representing the transaction id.
1098
- string txid_str = 2 [json_name = "txid_str"];
1099
-
1100
- /// The index of the output on the transaction.
1101
- uint32 output_index = 3 [json_name = "output_index"];
1102
- }
1103
-
1104
- message LightningAddress {
1105
- /// The identity pubkey of the Lightning node
1106
- string pubkey = 1 [json_name = "pubkey"];
1107
-
1108
- /// The network location of the lightning node, e.g. `69.69.69.69:1337` or `localhost:10011`
1109
- string host = 2 [json_name = "host"];
1110
- }
1111
-
1112
- message EstimateFeeRequest {
1113
- /// The map from addresses to amounts for the transaction.
1114
- map<string, int64> AddrToAmount = 1;
1115
-
1116
- /// The target number of blocks that this transaction should be confirmed by.
1117
- int32 target_conf = 2;
1118
- }
1119
-
1120
- message EstimateFeeResponse {
1121
- /// The total fee in satoshis.
1122
- int64 fee_sat = 1 [json_name = "fee_sat"];
1123
-
1124
- /// The fee rate in satoshi/byte.
1125
- int64 feerate_sat_per_byte = 2 [json_name = "feerate_sat_per_byte"];
1126
- }
1127
-
1128
- message SendManyRequest {
1129
- /// The map from addresses to amounts
1130
- map<string, int64> AddrToAmount = 1;
1131
-
1132
- /// The target number of blocks that this transaction should be confirmed by.
1133
- int32 target_conf = 3;
1134
-
1135
- /// A manual fee rate set in sat/byte that should be used when crafting the transaction.
1136
- int64 sat_per_byte = 5;
1137
- }
1138
- message SendManyResponse {
1139
- /// The id of the transaction
1140
- string txid = 1 [json_name = "txid"];
1141
- }
1142
-
1143
- message SendCoinsRequest {
1144
- /// The address to send coins to
1145
- string addr = 1;
1146
-
1147
- /// The amount in satoshis to send
1148
- int64 amount = 2;
1149
-
1150
- /// The target number of blocks that this transaction should be confirmed by.
1151
- int32 target_conf = 3;
1152
-
1153
- /// A manual fee rate set in sat/byte that should be used when crafting the transaction.
1154
- int64 sat_per_byte = 5;
1155
-
1156
- /**
1157
- If set, then the amount field will be ignored, and lnd will attempt to
1158
- send all the coins under control of the internal wallet to the specified
1159
- address.
1160
- */
1161
- bool send_all = 6;
1162
- }
1163
- message SendCoinsResponse {
1164
- /// The transaction ID of the transaction
1165
- string txid = 1 [json_name = "txid"];
1166
- }
1167
-
1168
- message ListUnspentRequest {
1169
- /// The minimum number of confirmations to be included.
1170
- int32 min_confs = 1;
1171
-
1172
- /// The maximum number of confirmations to be included.
1173
- int32 max_confs = 2;
1174
- }
1175
- message ListUnspentResponse {
1176
- /// A list of utxos
1177
- repeated Utxo utxos = 1 [json_name = "utxos"];
1178
- }
1179
-
1180
- /**
1181
- `AddressType` has to be one of:
1182
-
1183
- - `p2wkh`: Pay to witness key hash (`WITNESS_PUBKEY_HASH` = 0)
1184
- - `np2wkh`: Pay to nested witness key hash (`NESTED_PUBKEY_HASH` = 1)
1185
- */
1186
- enum AddressType {
1187
- WITNESS_PUBKEY_HASH = 0;
1188
- NESTED_PUBKEY_HASH = 1;
1189
- UNUSED_WITNESS_PUBKEY_HASH = 2;
1190
- UNUSED_NESTED_PUBKEY_HASH = 3;
1191
- }
1192
-
1193
- message NewAddressRequest {
1194
- /// The address type
1195
- AddressType type = 1;
1196
- }
1197
- message NewAddressResponse {
1198
- /// The newly generated wallet address
1199
- string address = 1 [json_name = "address"];
1200
- }
1201
-
1202
- message SignMessageRequest {
1203
- /**
1204
- The message to be signed. When using REST, this field must be encoded as
1205
- base64.
1206
- */
1207
- bytes msg = 1 [ json_name = "msg" ];
1208
- }
1209
- message SignMessageResponse {
1210
- /// The signature for the given message
1211
- string signature = 1 [ json_name = "signature" ];
1212
- }
1213
-
1214
- message VerifyMessageRequest {
1215
- /**
1216
- The message over which the signature is to be verified. When using REST,
1217
- this field must be encoded as base64.
1218
- */
1219
- bytes msg = 1 [ json_name = "msg" ];
1220
-
1221
- /// The signature to be verified over the given message
1222
- string signature = 2 [ json_name = "signature" ];
1223
- }
1224
- message VerifyMessageResponse {
1225
- /// Whether the signature was valid over the given message
1226
- bool valid = 1 [ json_name = "valid" ];
1227
-
1228
- /// The pubkey recovered from the signature
1229
- string pubkey = 2 [ json_name = "pubkey" ];
1230
- }
1231
-
1232
- message ConnectPeerRequest {
1233
- /// Lightning address of the peer, in the format `<pubkey>@host`
1234
- LightningAddress addr = 1;
1235
-
1236
- /** If set, the daemon will attempt to persistently connect to the target
1237
- * peer. Otherwise, the call will be synchronous. */
1238
- bool perm = 2;
1239
- }
1240
- message ConnectPeerResponse {
1241
- }
1242
-
1243
- message DisconnectPeerRequest {
1244
- /// The pubkey of the node to disconnect from
1245
- string pub_key = 1 [json_name = "pub_key"];
1246
- }
1247
- message DisconnectPeerResponse {
1248
- }
1249
-
1250
- message HTLC {
1251
- bool incoming = 1 [json_name = "incoming"];
1252
- int64 amount = 2 [json_name = "amount"];
1253
- bytes hash_lock = 3 [json_name = "hash_lock"];
1254
- uint32 expiration_height = 4 [json_name = "expiration_height"];
1255
- }
1256
-
1257
- message Channel {
1258
- /// Whether this channel is active or not
1259
- bool active = 1 [json_name = "active"];
1260
-
1261
- /// The identity pubkey of the remote node
1262
- string remote_pubkey = 2 [json_name = "remote_pubkey"];
1263
-
1264
- /**
1265
- The outpoint (txid:index) of the funding transaction. With this value, Bob
1266
- will be able to generate a signature for Alice's version of the commitment
1267
- transaction.
1268
- */
1269
- string channel_point = 3 [json_name = "channel_point"];
1270
-
1271
- /**
1272
- The unique channel ID for the channel. The first 3 bytes are the block
1273
- height, the next 3 the index within the block, and the last 2 bytes are the
1274
- output index for the channel.
1275
- */
1276
- uint64 chan_id = 4 [json_name = "chan_id", jstype = JS_STRING];
1277
-
1278
- /// The total amount of funds held in this channel
1279
- int64 capacity = 5 [json_name = "capacity"];
1280
-
1281
- /// This node's current balance in this channel
1282
- int64 local_balance = 6 [json_name = "local_balance"];
1283
-
1284
- /// The counterparty's current balance in this channel
1285
- int64 remote_balance = 7 [json_name = "remote_balance"];
1286
-
1287
- /**
1288
- The amount calculated to be paid in fees for the current set of commitment
1289
- transactions. The fee amount is persisted with the channel in order to
1290
- allow the fee amount to be removed and recalculated with each channel state
1291
- update, including updates that happen after a system restart.
1292
- */
1293
- int64 commit_fee = 8 [json_name = "commit_fee"];
1294
-
1295
- /// The weight of the commitment transaction
1296
- int64 commit_weight = 9 [json_name = "commit_weight"];
1297
-
1298
- /**
1299
- The required number of satoshis per kilo-weight that the requester will pay
1300
- at all times, for both the funding transaction and commitment transaction.
1301
- This value can later be updated once the channel is open.
1302
- */
1303
- int64 fee_per_kw = 10 [json_name = "fee_per_kw"];
1304
-
1305
- /// The unsettled balance in this channel
1306
- int64 unsettled_balance = 11 [json_name = "unsettled_balance"];
1307
-
1308
- /**
1309
- The total number of satoshis we've sent within this channel.
1310
- */
1311
- int64 total_satoshis_sent = 12 [json_name = "total_satoshis_sent"];
1312
-
1313
- /**
1314
- The total number of satoshis we've received within this channel.
1315
- */
1316
- int64 total_satoshis_received = 13 [json_name = "total_satoshis_received"];
1317
-
1318
- /**
1319
- The total number of updates conducted within this channel.
1320
- */
1321
- uint64 num_updates = 14 [json_name = "num_updates"];
1322
-
1323
- /**
1324
- The list of active, uncleared HTLCs currently pending within the channel.
1325
- */
1326
- repeated HTLC pending_htlcs = 15 [json_name = "pending_htlcs"];
1327
-
1328
- /**
1329
- The CSV delay expressed in relative blocks. If the channel is force closed,
1330
- we will need to wait for this many blocks before we can regain our funds.
1331
- */
1332
- uint32 csv_delay = 16 [json_name = "csv_delay"];
1333
-
1334
- /// Whether this channel is advertised to the network or not.
1335
- bool private = 17 [json_name = "private"];
1336
-
1337
- /// True if we were the ones that created the channel.
1338
- bool initiator = 18 [json_name = "initiator"];
1339
-
1340
- /// A set of flags showing the current state of the channel.
1341
- string chan_status_flags = 19 [json_name = "chan_status_flags"];
1342
-
1343
- /// The minimum satoshis this node is required to reserve in its balance.
1344
- int64 local_chan_reserve_sat = 20 [json_name = "local_chan_reserve_sat"];
1345
-
1346
- /**
1347
- The minimum satoshis the other node is required to reserve in its balance.
1348
- */
1349
- int64 remote_chan_reserve_sat = 21 [json_name = "remote_chan_reserve_sat"];
1350
-
1351
- /**
1352
- If true, then this channel uses the modern commitment format where the key
1353
- in the output of the remote party does not change each state. This makes
1354
- back up and recovery easier as when the channel is closed, the funds go
1355
- directly to that key.
1356
- */
1357
- bool static_remote_key = 22 [json_name = "static_remote_key"];
1358
-
1359
- /**
1360
- The number of seconds that the channel has been monitored by the channel
1361
- scoring system. Scores are currently not persisted, so this value may be
1362
- less than the lifetime of the channel [EXPERIMENTAL].
1363
- */
1364
- int64 lifetime = 23 [json_name = "lifetime"];
1365
-
1366
- /**
1367
- The number of seconds that the remote peer has been observed as being online
1368
- by the channel scoring system over the lifetime of the channel [EXPERIMENTAL].
1369
- */
1370
- int64 uptime = 24 [json_name = "uptime"];
1371
-
1372
- /**
1373
- Close address is the address that we will enforce payout to on cooperative
1374
- close if the channel was opened utilizing option upfront shutdown. This
1375
- value can be set on channel open by setting close_address in an open channel
1376
- request. If this value is not set, you can still choose a payout address by
1377
- cooperatively closing with the delivery_address field set.
1378
- */
1379
- string close_address = 25 [json_name ="close_address"];
1380
- }
1381
-
1382
-
1383
- message ListChannelsRequest {
1384
- bool active_only = 1;
1385
- bool inactive_only = 2;
1386
- bool public_only = 3;
1387
- bool private_only = 4;
1388
- }
1389
- message ListChannelsResponse {
1390
- /// The list of active channels
1391
- repeated Channel channels = 11 [json_name = "channels"];
1392
- }
1393
-
1394
- message ChannelCloseSummary {
1395
- /// The outpoint (txid:index) of the funding transaction.
1396
- string channel_point = 1 [json_name = "channel_point"];
1397
-
1398
- /// The unique channel ID for the channel.
1399
- uint64 chan_id = 2 [json_name = "chan_id", jstype = JS_STRING];
1400
-
1401
- /// The hash of the genesis block that this channel resides within.
1402
- string chain_hash = 3 [json_name = "chain_hash"];
1403
-
1404
- /// The txid of the transaction which ultimately closed this channel.
1405
- string closing_tx_hash = 4 [json_name = "closing_tx_hash"];
1406
-
1407
- /// Public key of the remote peer that we formerly had a channel with.
1408
- string remote_pubkey = 5 [json_name = "remote_pubkey"];
1409
-
1410
- /// Total capacity of the channel.
1411
- int64 capacity = 6 [json_name = "capacity"];
1412
-
1413
- /// Height at which the funding transaction was spent.
1414
- uint32 close_height = 7 [json_name = "close_height"];
1415
-
1416
- /// Settled balance at the time of channel closure
1417
- int64 settled_balance = 8 [json_name = "settled_balance"];
1418
-
1419
- /// The sum of all the time-locked outputs at the time of channel closure
1420
- int64 time_locked_balance = 9 [json_name = "time_locked_balance"];
1421
-
1422
- enum ClosureType {
1423
- COOPERATIVE_CLOSE = 0;
1424
- LOCAL_FORCE_CLOSE = 1;
1425
- REMOTE_FORCE_CLOSE = 2;
1426
- BREACH_CLOSE = 3;
1427
- FUNDING_CANCELED = 4;
1428
- ABANDONED = 5;
1429
- }
1430
-
1431
- /// Details on how the channel was closed.
1432
- ClosureType close_type = 10 [json_name = "close_type"];
1433
- }
1434
-
1435
- message ClosedChannelsRequest {
1436
- bool cooperative = 1;
1437
- bool local_force = 2;
1438
- bool remote_force = 3;
1439
- bool breach = 4;
1440
- bool funding_canceled = 5;
1441
- bool abandoned = 6;
1442
- }
1443
-
1444
- message ClosedChannelsResponse {
1445
- repeated ChannelCloseSummary channels = 1 [json_name = "channels"];
1446
- }
1447
-
1448
- message Peer {
1449
- /// The identity pubkey of the peer
1450
- string pub_key = 1 [json_name = "pub_key"];
1451
-
1452
- /// Network address of the peer; eg `127.0.0.1:10011`
1453
- string address = 3 [json_name = "address"];
1454
-
1455
- /// Bytes of data transmitted to this peer
1456
- uint64 bytes_sent = 4 [json_name = "bytes_sent"];
1457
-
1458
- /// Bytes of data transmitted from this peer
1459
- uint64 bytes_recv = 5 [json_name = "bytes_recv"];
1460
-
1461
- /// Satoshis sent to this peer
1462
- int64 sat_sent = 6 [json_name = "sat_sent"];
1463
-
1464
- /// Satoshis received from this peer
1465
- int64 sat_recv = 7 [json_name = "sat_recv"];
1466
-
1467
- /// A channel is inbound if the counterparty initiated the channel
1468
- bool inbound = 8 [json_name = "inbound"];
1469
-
1470
- /// Ping time to this peer
1471
- int64 ping_time = 9 [json_name = "ping_time"];
1472
-
1473
- enum SyncType {
1474
- /**
1475
- Denotes that we cannot determine the peer's current sync type.
1476
- */
1477
- UNKNOWN_SYNC = 0;
1478
-
1479
- /**
1480
- Denotes that we are actively receiving new graph updates from the peer.
1481
- */
1482
- ACTIVE_SYNC = 1;
1483
-
1484
- /**
1485
- Denotes that we are not receiving new graph updates from the peer.
1486
- */
1487
- PASSIVE_SYNC = 2;
1488
- }
1489
-
1490
- // The type of sync we are currently performing with this peer.
1491
- SyncType sync_type = 10 [json_name = "sync_type"];
1492
-
1493
- /// Features advertised by the remote peer in their init message.
1494
- map<uint32, Feature> features = 11 [json_name = "features"];
1495
- }
1496
-
1497
- message ListPeersRequest {
1498
- }
1499
- message ListPeersResponse {
1500
- /// The list of currently connected peers
1501
- repeated Peer peers = 1 [json_name = "peers"];
1502
- }
1503
-
1504
- message PeerEventSubscription {
1505
- }
1506
-
1507
- message PeerEvent {
1508
- /// The identity pubkey of the peer.
1509
- string pub_key = 1 [json_name = "pub_key"];
1510
-
1511
- enum EventType {
1512
- PEER_ONLINE = 0;
1513
- PEER_OFFLINE = 1;
1514
- }
1515
-
1516
- EventType type = 2 [ json_name = "type" ];
1517
- }
1518
-
1519
- message GetInfoRequest {
1520
- }
1521
- message GetInfoResponse {
1522
-
1523
- /// The version of the LND software that the node is running.
1524
- string version = 14 [ json_name = "version" ];
1525
-
1526
- /// The identity pubkey of the current node.
1527
- string identity_pubkey = 1 [json_name = "identity_pubkey"];
1528
-
1529
- /// If applicable, the alias of the current node, e.g. "bob"
1530
- string alias = 2 [json_name = "alias"];
1531
-
1532
- /// The color of the current node in hex code format
1533
- string color = 17 [json_name = "color"];
1534
-
1535
- /// Number of pending channels
1536
- uint32 num_pending_channels = 3 [json_name = "num_pending_channels"];
1537
-
1538
- /// Number of active channels
1539
- uint32 num_active_channels = 4 [json_name = "num_active_channels"];
1540
-
1541
- /// Number of inactive channels
1542
- uint32 num_inactive_channels = 15 [json_name = "num_inactive_channels"];
1543
-
1544
- /// Number of peers
1545
- uint32 num_peers = 5 [json_name = "num_peers"];
1546
-
1547
- /// The node's current view of the height of the best block
1548
- uint32 block_height = 6 [json_name = "block_height"];
1549
-
1550
- /// The node's current view of the hash of the best block
1551
- string block_hash = 8 [json_name = "block_hash"];
1552
-
1553
- /// Timestamp of the block best known to the wallet
1554
- int64 best_header_timestamp = 13 [ json_name = "best_header_timestamp" ];
1555
-
1556
- /// Whether the wallet's view is synced to the main chain
1557
- bool synced_to_chain = 9 [json_name = "synced_to_chain"];
1558
-
1559
- // Whether we consider ourselves synced with the public channel graph.
1560
- bool synced_to_graph = 18 [json_name = "synced_to_graph"];
1561
-
1562
- /**
1563
- Whether the current node is connected to testnet. This field is
1564
- deprecated and the network field should be used instead
1565
- **/
1566
- bool testnet = 10 [json_name = "testnet", deprecated = true];
1567
-
1568
- reserved 11;
1569
-
1570
- /// A list of active chains the node is connected to
1571
- repeated Chain chains = 16 [json_name = "chains"];
1572
-
1573
- /// The URIs of the current node.
1574
- repeated string uris = 12 [json_name = "uris"];
1575
-
1576
- /*
1577
- Features that our node has advertised in our init message, node
1578
- announcements and invoices.
1579
- */
1580
- map<uint32, Feature> features = 19 [json_name = "features"];
1581
- }
1582
-
1583
- message Chain {
1584
- /// The blockchain the node is on (eg bitcoin, litecoin)
1585
- string chain = 1 [json_name = "chain"];
1586
-
1587
- /// The network the node is on (eg regtest, testnet, mainnet)
1588
- string network = 2 [json_name = "network"];
1589
- }
1590
-
1591
- message ConfirmationUpdate {
1592
- bytes block_sha = 1;
1593
- int32 block_height = 2;
1594
-
1595
- uint32 num_confs_left = 3;
1596
- }
1597
-
1598
- message ChannelOpenUpdate {
1599
- ChannelPoint channel_point = 1 [json_name = "channel_point"];
1600
- }
1601
-
1602
- message ChannelCloseUpdate {
1603
- bytes closing_txid = 1 [json_name = "closing_txid"];
1604
-
1605
- bool success = 2 [json_name = "success"];
1606
- }
1607
-
1608
- message CloseChannelRequest {
1609
- /**
1610
- The outpoint (txid:index) of the funding transaction. With this value, Bob
1611
- will be able to generate a signature for Alice's version of the commitment
1612
- transaction.
1613
- */
1614
- ChannelPoint channel_point = 1;
1615
-
1616
- /// If true, then the channel will be closed forcibly. This means the current commitment transaction will be signed and broadcast.
1617
- bool force = 2;
1618
-
1619
- /// The target number of blocks that the closure transaction should be confirmed by.
1620
- int32 target_conf = 3;
1621
-
1622
- /// A manual fee rate set in sat/byte that should be used when crafting the closure transaction.
1623
- int64 sat_per_byte = 4;
1624
-
1625
- /*
1626
- An optional address to send funds to in the case of a cooperative close.
1627
- If the channel was opened with an upfront shutdown script and this field
1628
- is set, the request to close will fail because the channel must pay out
1629
- to the upfront shutdown addresss.
1630
- */
1631
- string delivery_address = 5 [json_name = "delivery_address"];
1632
- }
1633
-
1634
- message CloseStatusUpdate {
1635
- oneof update {
1636
- PendingUpdate close_pending = 1 [json_name = "close_pending"];
1637
- ChannelCloseUpdate chan_close = 3 [json_name = "chan_close"];
1638
- }
1639
- }
1640
-
1641
- message PendingUpdate {
1642
- bytes txid = 1 [json_name = "txid"];
1643
- uint32 output_index = 2 [json_name = "output_index"];
1644
- }
1645
-
1646
- message OpenChannelRequest {
1647
- /**
1648
- The pubkey of the node to open a channel with. When using REST, this field
1649
- must be encoded as base64.
1650
- */
1651
- bytes node_pubkey = 2 [json_name = "node_pubkey"];
1652
-
1653
- /**
1654
- The hex encoded pubkey of the node to open a channel with. Deprecated now
1655
- that the REST gateway supports base64 encoding of bytes fields.
1656
- */
1657
- string node_pubkey_string = 3 [json_name = "node_pubkey_string", deprecated = true];
1658
-
1659
- /// The number of satoshis the wallet should commit to the channel
1660
- int64 local_funding_amount = 4 [json_name = "local_funding_amount"];
1661
-
1662
- /// The number of satoshis to push to the remote side as part of the initial commitment state
1663
- int64 push_sat = 5 [json_name = "push_sat"];
1664
-
1665
- /// The target number of blocks that the funding transaction should be confirmed by.
1666
- int32 target_conf = 6;
1667
-
1668
- /// A manual fee rate set in sat/byte that should be used when crafting the funding transaction.
1669
- int64 sat_per_byte = 7;
1670
-
1671
- /// Whether this channel should be private, not announced to the greater network.
1672
- bool private = 8 [json_name = "private"];
1673
-
1674
- /// The minimum value in millisatoshi we will require for incoming HTLCs on the channel.
1675
- int64 min_htlc_msat = 9 [json_name = "min_htlc_msat"];
1676
-
1677
- /// The delay we require on the remote's commitment transaction. If this is not set, it will be scaled automatically with the channel size.
1678
- uint32 remote_csv_delay = 10 [json_name = "remote_csv_delay"];
1679
-
1680
- /// The minimum number of confirmations each one of your outputs used for the funding transaction must satisfy.
1681
- int32 min_confs = 11 [json_name = "min_confs"];
1682
-
1683
- /// Whether unconfirmed outputs should be used as inputs for the funding transaction.
1684
- bool spend_unconfirmed = 12 [json_name = "spend_unconfirmed"];
1685
-
1686
- /*
1687
- Close address is an optional address which specifies the address to which
1688
- funds should be paid out to upon cooperative close. This field may only be
1689
- set if the peer supports the option upfront feature bit (call listpeers
1690
- to check). The remote peer will only accept cooperative closes to this
1691
- address if it is set.
1692
-
1693
- Note: If this value is set on channel creation, you will *not* be able to
1694
- cooperatively close out to a different address.
1695
- */
1696
- string close_address = 13 [json_name = "close_address"];
1697
-
1698
- /**
1699
- Funding shims are an optional argument that allow the caller to intercept
1700
- certain funding functionality. For example, a shim can be provided to use a
1701
- particular key for the commitment key (ideally cold) rather than use one
1702
- that is generated by the wallet as normal, or signal that signing will be
1703
- carried out in an interactive manner (PSBT based).
1704
- */
1705
- FundingShim funding_shim = 14 [json_name = "funding_shim"];
1706
- }
1707
- message OpenStatusUpdate {
1708
- oneof update {
1709
- PendingUpdate chan_pending = 1 [json_name = "chan_pending"];
1710
- ChannelOpenUpdate chan_open = 3 [json_name = "chan_open"];
1711
- }
1712
-
1713
- /**
1714
- The pending channel ID of the created channel. This value may be used to
1715
- further the funding flow manually via the FundingStateStep method.
1716
- */
1717
- bytes pending_chan_id = 4 [json_name = "pending_chan_id"];
1718
- }
1719
-
1720
- message KeyLocator {
1721
- /// The family of key being identified.
1722
- int32 key_family = 1;
1723
-
1724
- /// The precise index of the key being identified.
1725
- int32 key_index = 2;
1726
- }
1727
-
1728
- message KeyDescriptor {
1729
- /**
1730
- The raw bytes of the key being identified.
1731
- */
1732
- bytes raw_key_bytes = 1;
1733
-
1734
- /**
1735
- The key locator that identifies which key to use for signing.
1736
- */
1737
- KeyLocator key_loc = 2;
1738
- }
1739
-
1740
- message ChanPointShim {
1741
- /**
1742
- The size of the pre-crafted output to be used as the channel point for this
1743
- channel funding.
1744
- */
1745
- int64 amt = 1;
1746
-
1747
- /// The target channel point to refrence in created commitment transactions.
1748
- ChannelPoint chan_point = 2;
1749
-
1750
- /// Our local key to use when creating the multi-sig output.
1751
- KeyDescriptor local_key = 3;
1752
-
1753
- /// The key of the remote party to use when creating the multi-sig output.
1754
- bytes remote_key = 4;
1755
-
1756
- /**
1757
- If non-zero, then this will be used as the pending channel ID on the wire
1758
- protocol to initate the funding request. This is an optional field, and
1759
- should only be set if the responder is already expecting a specific pending
1760
- channel ID.
1761
- */
1762
- bytes pending_chan_id = 5;
1763
- }
1764
-
1765
- message FundingShim {
1766
- oneof shim {
1767
- ChanPointShim chan_point_shim = 1;
1768
- }
1769
- }
1770
-
1771
- message FundingShimCancel {
1772
- /// The pending channel ID of the channel to cancel the funding shim for.
1773
- bytes pending_chan_id = 1;
1774
- }
1775
-
1776
- message FundingTransitionMsg {
1777
- oneof trigger {
1778
- /**
1779
- The funding shim to regsiter. This should be used before any
1780
- channel funding has began by the remote party, as it is intended as a
1781
- prepatory step for the full channel funding.
1782
- */
1783
- FundingShim shim_register = 1;
1784
-
1785
- /// Used to cancel an existing registered funding shim.
1786
- FundingShimCancel shim_cancel = 2;
1787
- }
1788
- }
1789
-
1790
- message FundingStateStepResp {
1791
- }
1792
-
1793
- message PendingHTLC {
1794
-
1795
- /// The direction within the channel that the htlc was sent
1796
- bool incoming = 1 [ json_name = "incoming" ];
1797
-
1798
- /// The total value of the htlc
1799
- int64 amount = 2 [ json_name = "amount" ];
1800
-
1801
- /// The final output to be swept back to the user's wallet
1802
- string outpoint = 3 [ json_name = "outpoint" ];
1803
-
1804
- /// The next block height at which we can spend the current stage
1805
- uint32 maturity_height = 4 [ json_name = "maturity_height" ];
1806
-
1807
- /**
1808
- The number of blocks remaining until the current stage can be swept.
1809
- Negative values indicate how many blocks have passed since becoming
1810
- mature.
1811
- */
1812
- int32 blocks_til_maturity = 5 [ json_name = "blocks_til_maturity" ];
1813
-
1814
- /// Indicates whether the htlc is in its first or second stage of recovery
1815
- uint32 stage = 6 [ json_name = "stage" ];
1816
- }
1817
-
1818
- message PendingChannelsRequest {}
1819
- message PendingChannelsResponse {
1820
- message PendingChannel {
1821
- string remote_node_pub = 1 [ json_name = "remote_node_pub" ];
1822
- string channel_point = 2 [ json_name = "channel_point" ];
1823
-
1824
- int64 capacity = 3 [ json_name = "capacity" ];
1825
-
1826
- int64 local_balance = 4 [ json_name = "local_balance" ];
1827
- int64 remote_balance = 5 [ json_name = "remote_balance" ];
1828
-
1829
- /// The minimum satoshis this node is required to reserve in its balance.
1830
- int64 local_chan_reserve_sat = 6 [json_name = "local_chan_reserve_sat"];
1831
-
1832
- /**
1833
- The minimum satoshis the other node is required to reserve in its
1834
- balance.
1835
- */
1836
- int64 remote_chan_reserve_sat = 7 [json_name = "remote_chan_reserve_sat"];
1837
- }
1838
-
1839
- message PendingOpenChannel {
1840
- /// The pending channel
1841
- PendingChannel channel = 1 [ json_name = "channel" ];
1842
-
1843
- /// The height at which this channel will be confirmed
1844
- uint32 confirmation_height = 2 [ json_name = "confirmation_height" ];
1845
-
1846
- /**
1847
- The amount calculated to be paid in fees for the current set of
1848
- commitment transactions. The fee amount is persisted with the channel
1849
- in order to allow the fee amount to be removed and recalculated with
1850
- each channel state update, including updates that happen after a system
1851
- restart.
1852
- */
1853
- int64 commit_fee = 4 [json_name = "commit_fee" ];
1854
-
1855
- /// The weight of the commitment transaction
1856
- int64 commit_weight = 5 [ json_name = "commit_weight" ];
1857
-
1858
- /**
1859
- The required number of satoshis per kilo-weight that the requester will
1860
- pay at all times, for both the funding transaction and commitment
1861
- transaction. This value can later be updated once the channel is open.
1862
- */
1863
- int64 fee_per_kw = 6 [ json_name = "fee_per_kw" ];
1864
- }
1865
-
1866
- message WaitingCloseChannel {
1867
- /// The pending channel waiting for closing tx to confirm
1868
- PendingChannel channel = 1;
1869
-
1870
- /// The balance in satoshis encumbered in this channel
1871
- int64 limbo_balance = 2 [ json_name = "limbo_balance" ];
1872
- }
1873
-
1874
- message ClosedChannel {
1875
- /// The pending channel to be closed
1876
- PendingChannel channel = 1;
1877
-
1878
- /// The transaction id of the closing transaction
1879
- string closing_txid = 2 [ json_name = "closing_txid" ];
1880
- }
1881
-
1882
- message ForceClosedChannel {
1883
- /// The pending channel to be force closed
1884
- PendingChannel channel = 1 [ json_name = "channel" ];
1885
-
1886
- /// The transaction id of the closing transaction
1887
- string closing_txid = 2 [ json_name = "closing_txid" ];
1888
-
1889
- /// The balance in satoshis encumbered in this pending channel
1890
- int64 limbo_balance = 3 [ json_name = "limbo_balance" ];
1891
-
1892
- /// The height at which funds can be swept into the wallet
1893
- uint32 maturity_height = 4 [ json_name = "maturity_height" ];
1894
-
1895
- /*
1896
- Remaining # of blocks until the commitment output can be swept.
1897
- Negative values indicate how many blocks have passed since becoming
1898
- mature.
1899
- */
1900
- int32 blocks_til_maturity = 5 [ json_name = "blocks_til_maturity" ];
1901
-
1902
- /// The total value of funds successfully recovered from this channel
1903
- int64 recovered_balance = 6 [ json_name = "recovered_balance" ];
1904
-
1905
- repeated PendingHTLC pending_htlcs = 8 [ json_name = "pending_htlcs" ];
1906
- }
1907
-
1908
- /// The balance in satoshis encumbered in pending channels
1909
- int64 total_limbo_balance = 1 [ json_name = "total_limbo_balance" ];
1910
-
1911
- /// Channels pending opening
1912
- repeated PendingOpenChannel pending_open_channels = 2 [ json_name = "pending_open_channels" ];
1913
-
1914
- /// Channels pending closing
1915
- repeated ClosedChannel pending_closing_channels = 3 [ json_name = "pending_closing_channels" ];
1916
-
1917
- /// Channels pending force closing
1918
- repeated ForceClosedChannel pending_force_closing_channels = 4 [ json_name = "pending_force_closing_channels" ];
1919
-
1920
- /// Channels waiting for closing tx to confirm
1921
- repeated WaitingCloseChannel waiting_close_channels = 5 [ json_name = "waiting_close_channels" ];
1922
- }
1923
-
1924
- message ChannelEventSubscription {
1925
- }
1926
-
1927
- message ChannelEventUpdate {
1928
- oneof channel {
1929
- Channel open_channel = 1 [ json_name = "open_channel" ];
1930
- ChannelCloseSummary closed_channel = 2 [ json_name = "closed_channel" ];
1931
- ChannelPoint active_channel = 3 [ json_name = "active_channel" ];
1932
- ChannelPoint inactive_channel = 4 [ json_name = "inactive_channel" ];
1933
- }
1934
-
1935
- enum UpdateType {
1936
- OPEN_CHANNEL = 0;
1937
- CLOSED_CHANNEL = 1;
1938
- ACTIVE_CHANNEL = 2;
1939
- INACTIVE_CHANNEL = 3;
1940
- }
1941
-
1942
- UpdateType type = 5 [ json_name = "type" ];
1943
- }
1944
-
1945
- message WalletBalanceRequest {
1946
- }
1947
- message WalletBalanceResponse {
1948
- /// The balance of the wallet
1949
- int64 total_balance = 1 [json_name = "total_balance"];
1950
-
1951
- /// The confirmed balance of a wallet(with >= 1 confirmations)
1952
- int64 confirmed_balance = 2 [json_name = "confirmed_balance"];
1953
-
1954
- /// The unconfirmed balance of a wallet(with 0 confirmations)
1955
- int64 unconfirmed_balance = 3 [json_name = "unconfirmed_balance"];
1956
- }
1957
-
1958
- message ChannelBalanceRequest {
1959
- }
1960
- message ChannelBalanceResponse {
1961
- /// Sum of channels balances denominated in satoshis
1962
- int64 balance = 1 [json_name = "balance"];
1963
-
1964
- /// Sum of channels pending balances denominated in satoshis
1965
- int64 pending_open_balance = 2 [json_name = "pending_open_balance"];
1966
- }
1967
-
1968
- message QueryRoutesRequest {
1969
- /// The 33-byte hex-encoded public key for the payment destination
1970
- string pub_key = 1;
1971
-
1972
- /**
1973
- The amount to send expressed in satoshis.
1974
-
1975
- The fields amt and amt_msat are mutually exclusive.
1976
- */
1977
- int64 amt = 2;
1978
-
1979
- /**
1980
- The amount to send expressed in millisatoshis.
1981
-
1982
- The fields amt and amt_msat are mutually exclusive.
1983
- */
1984
- int64 amt_msat = 12;
1985
-
1986
- reserved 3;
1987
-
1988
- /**
1989
- An optional CLTV delta from the current height that should be used for the
1990
- timelock of the final hop. Note that unlike SendPayment, QueryRoutes does
1991
- not add any additional block padding on top of final_ctlv_delta. This
1992
- padding of a few blocks needs to be added manually or otherwise failures may
1993
- happen when a block comes in while the payment is in flight.
1994
- */
1995
- int32 final_cltv_delta = 4;
1996
-
1997
- /**
1998
- The maximum number of satoshis that will be paid as a fee of the payment.
1999
- This value can be represented either as a percentage of the amount being
2000
- sent, or as a fixed amount of the maximum fee the user is willing the pay to
2001
- send the payment.
2002
- */
2003
- FeeLimit fee_limit = 5;
2004
-
2005
- /**
2006
- A list of nodes to ignore during path finding. When using REST, these fields
2007
- must be encoded as base64.
2008
- */
2009
- repeated bytes ignored_nodes = 6;
2010
-
2011
- /**
2012
- Deprecated. A list of edges to ignore during path finding.
2013
- */
2014
- repeated EdgeLocator ignored_edges = 7 [deprecated = true];
2015
-
2016
- /**
2017
- The source node where the request route should originated from. If empty,
2018
- self is assumed.
2019
- */
2020
- string source_pub_key = 8;
2021
-
2022
- /**
2023
- If set to true, edge probabilities from mission control will be used to get
2024
- the optimal route.
2025
- */
2026
- bool use_mission_control = 9;
2027
-
2028
- /**
2029
- A list of directed node pairs that will be ignored during path finding.
2030
- */
2031
- repeated NodePair ignored_pairs = 10;
2032
-
2033
- /**
2034
- An optional maximum total time lock for the route. If the source is empty or
2035
- ourselves, this should not exceed lnd's `--max-cltv-expiry` setting. If
2036
- zero, then the value of `--max-cltv-expiry` is used as the limit.
2037
- */
2038
- uint32 cltv_limit = 11;
2039
-
2040
- /**
2041
- An optional field that can be used to pass an arbitrary set of TLV records
2042
- to a peer which understands the new records. This can be used to pass
2043
- application specific data during the payment attempt. If the destination
2044
- does not support the specified recrods, and error will be returned.
2045
- Record types are required to be in the custom range >= 65536. When using
2046
- REST, the values must be encoded as base64.
2047
- */
2048
- map<uint64, bytes> dest_custom_records = 13;
2049
-
2050
- /**
2051
- The channel id of the channel that must be taken to the first hop. If zero,
2052
- any channel may be used.
2053
- */
2054
- uint64 outgoing_chan_id = 14 [jstype = JS_STRING];
2055
-
2056
- /**
2057
- The pubkey of the last hop of the route. If empty, any hop may be used.
2058
- */
2059
- bytes last_hop_pubkey = 15;
2060
-
2061
- /**
2062
- Optional route hints to reach the destination through private channels.
2063
- */
2064
- repeated lnrpc.RouteHint route_hints = 16;
2065
-
2066
- /**
2067
- Features assumed to be supported by the final node. All transitive feature
2068
- depdencies must also be set properly. For a given feature bit pair, either
2069
- optional or remote may be set, but not both. If this field is nil or empty,
2070
- the router will try to load destination features from the graph as a
2071
- fallback.
2072
- */
2073
- repeated lnrpc.FeatureBit dest_features = 17;
2074
- }
2075
-
2076
- message NodePair {
2077
- /**
2078
- The sending node of the pair. When using REST, this field must be encoded as
2079
- base64.
2080
- */
2081
- bytes from = 1;
2082
-
2083
- /**
2084
- The receiving node of the pair. When using REST, this field must be encoded
2085
- as base64.
2086
- */
2087
- bytes to = 2;
2088
- }
2089
-
2090
- message EdgeLocator {
2091
- /// The short channel id of this edge.
2092
- uint64 channel_id = 1 [jstype = JS_STRING];
2093
-
2094
- /**
2095
- The direction of this edge. If direction_reverse is false, the direction
2096
- of this edge is from the channel endpoint with the lexicographically smaller
2097
- pub key to the endpoint with the larger pub key. If direction_reverse is
2098
- is true, the edge goes the other way.
2099
- */
2100
- bool direction_reverse = 2;
2101
- }
2102
-
2103
- message QueryRoutesResponse {
2104
- /**
2105
- The route that results from the path finding operation. This is still a
2106
- repeated field to retain backwards compatibility.
2107
- */
2108
- repeated Route routes = 1 [json_name = "routes"];
2109
-
2110
- /**
2111
- The success probability of the returned route based on the current mission
2112
- control state. [EXPERIMENTAL]
2113
- */
2114
- double success_prob = 2 [json_name = "success_prob"];
2115
- }
2116
-
2117
- message Hop {
2118
- /**
2119
- The unique channel ID for the channel. The first 3 bytes are the block
2120
- height, the next 3 the index within the block, and the last 2 bytes are the
2121
- output index for the channel.
2122
- */
2123
- uint64 chan_id = 1 [json_name = "chan_id", jstype = JS_STRING];
2124
- int64 chan_capacity = 2 [json_name = "chan_capacity"];
2125
- int64 amt_to_forward = 3 [json_name = "amt_to_forward", deprecated = true];
2126
- int64 fee = 4 [json_name = "fee", deprecated = true];
2127
- uint32 expiry = 5 [json_name = "expiry"];
2128
- int64 amt_to_forward_msat = 6 [json_name = "amt_to_forward_msat"];
2129
- int64 fee_msat = 7 [json_name = "fee_msat"];
2130
-
2131
- /**
2132
- An optional public key of the hop. If the public key is given, the payment
2133
- can be executed without relying on a copy of the channel graph.
2134
- */
2135
- string pub_key = 8 [json_name = "pub_key"];
2136
-
2137
- /**
2138
- If set to true, then this hop will be encoded using the new variable length
2139
- TLV format. Note that if any custom tlv_records below are specified, then
2140
- this field MUST be set to true for them to be encoded properly.
2141
- */
2142
- bool tlv_payload = 9 [json_name = "tlv_payload"];
2143
-
2144
- /**
2145
- An optional TLV record tha singals the use of an MPP payment. If present,
2146
- the receiver will enforce that that the same mpp_record is included in the
2147
- final hop payload of all non-zero payments in the HTLC set. If empty, a
2148
- regular single-shot payment is or was attempted.
2149
- */
2150
- MPPRecord mpp_record = 10 [json_name = "mpp_record"];
2151
-
2152
- /**
2153
- An optional set of key-value TLV records. This is useful within the context
2154
- of the SendToRoute call as it allows callers to specify arbitrary K-V pairs
2155
- to drop off at each hop within the onion.
2156
- */
2157
- map<uint64, bytes> custom_records = 11 [json_name = "custom_records"];
2158
- }
2159
-
2160
- message MPPRecord {
2161
- /**
2162
- A unique, random identifier used to authenticate the sender as the intended
2163
- payer of a multi-path payment. The payment_addr must be the same for all
2164
- subpayments, and match the payment_addr provided in the receiver's invoice.
2165
- The same payment_addr must be used on all subpayments.
2166
- */
2167
- bytes payment_addr = 11 [json_name = "payment_addr"];
2168
-
2169
- /**
2170
- The total amount in milli-satoshis being sent as part of a larger multi-path
2171
- payment. The caller is responsible for ensuring subpayments to the same node
2172
- and payment_hash sum exactly to total_amt_msat. The same
2173
- total_amt_msat must be used on all subpayments.
2174
- */
2175
- int64 total_amt_msat = 10 [json_name = "total_amt_msat"];
2176
- }
2177
-
2178
- /**
2179
- A path through the channel graph which runs over one or more channels in
2180
- succession. This struct carries all the information required to craft the
2181
- Sphinx onion packet, and send the payment along the first hop in the path. A
2182
- route is only selected as valid if all the channels have sufficient capacity to
2183
- carry the initial payment amount after fees are accounted for.
2184
- */
2185
- message Route {
2186
-
2187
- /**
2188
- The cumulative (final) time lock across the entire route. This is the CLTV
2189
- value that should be extended to the first hop in the route. All other hops
2190
- will decrement the time-lock as advertised, leaving enough time for all
2191
- hops to wait for or present the payment preimage to complete the payment.
2192
- */
2193
- uint32 total_time_lock = 1 [json_name = "total_time_lock"];
2194
-
2195
- /**
2196
- The sum of the fees paid at each hop within the final route. In the case
2197
- of a one-hop payment, this value will be zero as we don't need to pay a fee
2198
- to ourselves.
2199
- */
2200
- int64 total_fees = 2 [json_name = "total_fees", deprecated = true];
2201
-
2202
- /**
2203
- The total amount of funds required to complete a payment over this route.
2204
- This value includes the cumulative fees at each hop. As a result, the HTLC
2205
- extended to the first-hop in the route will need to have at least this many
2206
- satoshis, otherwise the route will fail at an intermediate node due to an
2207
- insufficient amount of fees.
2208
- */
2209
- int64 total_amt = 3 [json_name = "total_amt", deprecated = true];
2210
-
2211
- /**
2212
- Contains details concerning the specific forwarding details at each hop.
2213
- */
2214
- repeated Hop hops = 4 [json_name = "hops"];
2215
-
2216
- /**
2217
- The total fees in millisatoshis.
2218
- */
2219
- int64 total_fees_msat = 5 [json_name = "total_fees_msat"];
2220
-
2221
- /**
2222
- The total amount in millisatoshis.
2223
- */
2224
- int64 total_amt_msat = 6 [json_name = "total_amt_msat"];
2225
- }
2226
-
2227
- message NodeInfoRequest {
2228
- /// The 33-byte hex-encoded compressed public of the target node
2229
- string pub_key = 1;
2230
-
2231
- /// If true, will include all known channels associated with the node.
2232
- bool include_channels = 2;
2233
- }
2234
-
2235
- message NodeInfo {
2236
-
2237
- /**
2238
- An individual vertex/node within the channel graph. A node is
2239
- connected to other nodes by one or more channel edges emanating from it. As
2240
- the graph is directed, a node will also have an incoming edge attached to
2241
- it for each outgoing edge.
2242
- */
2243
- LightningNode node = 1 [json_name = "node"];
2244
-
2245
- /// The total number of channels for the node.
2246
- uint32 num_channels = 2 [json_name = "num_channels"];
2247
-
2248
- /// The sum of all channels capacity for the node, denominated in satoshis.
2249
- int64 total_capacity = 3 [json_name = "total_capacity"];
2250
-
2251
- /// A list of all public channels for the node.
2252
- repeated ChannelEdge channels = 4 [json_name = "channels"];
2253
- }
2254
-
2255
- /**
2256
- An individual vertex/node within the channel graph. A node is
2257
- connected to other nodes by one or more channel edges emanating from it. As the
2258
- graph is directed, a node will also have an incoming edge attached to it for
2259
- each outgoing edge.
2260
- */
2261
- message LightningNode {
2262
- uint32 last_update = 1 [ json_name = "last_update" ];
2263
- string pub_key = 2 [ json_name = "pub_key" ];
2264
- string alias = 3 [ json_name = "alias" ];
2265
- repeated NodeAddress addresses = 4 [ json_name = "addresses" ];
2266
- string color = 5 [ json_name = "color" ];
2267
- map<uint32, Feature> features = 6 [ json_name = "features" ];
2268
- }
2269
-
2270
- message NodeAddress {
2271
- string network = 1 [ json_name = "network" ];
2272
- string addr = 2 [ json_name = "addr" ];
2273
- }
2274
-
2275
- message RoutingPolicy {
2276
- uint32 time_lock_delta = 1 [json_name = "time_lock_delta"];
2277
- int64 min_htlc = 2 [json_name = "min_htlc"];
2278
- int64 fee_base_msat = 3 [json_name = "fee_base_msat"];
2279
- int64 fee_rate_milli_msat = 4 [json_name = "fee_rate_milli_msat"];
2280
- bool disabled = 5 [json_name = "disabled"];
2281
- uint64 max_htlc_msat = 6 [json_name = "max_htlc_msat"];
2282
- uint32 last_update = 7 [json_name = "last_update"];
2283
- }
2284
-
2285
- /**
2286
- A fully authenticated channel along with all its unique attributes.
2287
- Once an authenticated channel announcement has been processed on the network,
2288
- then an instance of ChannelEdgeInfo encapsulating the channels attributes is
2289
- stored. The other portions relevant to routing policy of a channel are stored
2290
- within a ChannelEdgePolicy for each direction of the channel.
2291
- */
2292
- message ChannelEdge {
2293
-
2294
- /**
2295
- The unique channel ID for the channel. The first 3 bytes are the block
2296
- height, the next 3 the index within the block, and the last 2 bytes are the
2297
- output index for the channel.
2298
- */
2299
- uint64 channel_id = 1 [json_name = "channel_id", jstype = JS_STRING];
2300
- string chan_point = 2 [json_name = "chan_point"];
2301
-
2302
- uint32 last_update = 3 [json_name = "last_update", deprecated = true];
2303
-
2304
- string node1_pub = 4 [json_name = "node1_pub"];
2305
- string node2_pub = 5 [json_name = "node2_pub"];
2306
-
2307
- int64 capacity = 6 [json_name = "capacity"];
2308
-
2309
- RoutingPolicy node1_policy = 7 [json_name = "node1_policy"];
2310
- RoutingPolicy node2_policy = 8 [json_name = "node2_policy"];
2311
- }
2312
-
2313
- message ChannelGraphRequest {
2314
- /**
2315
- Whether unannounced channels are included in the response or not. If set,
2316
- unannounced channels are included. Unannounced channels are both private
2317
- channels, and public channels that are not yet announced to the network.
2318
- */
2319
- bool include_unannounced = 1 [json_name = "include_unannounced"];
2320
- }
2321
-
2322
- /// Returns a new instance of the directed channel graph.
2323
- message ChannelGraph {
2324
- /// The list of `LightningNode`s in this channel graph
2325
- repeated LightningNode nodes = 1 [json_name = "nodes"];
2326
-
2327
- /// The list of `ChannelEdge`s in this channel graph
2328
- repeated ChannelEdge edges = 2 [json_name = "edges"];
2329
- }
2330
-
2331
- message ChanInfoRequest {
2332
- /**
2333
- The unique channel ID for the channel. The first 3 bytes are the block
2334
- height, the next 3 the index within the block, and the last 2 bytes are the
2335
- output index for the channel.
2336
- */
2337
- uint64 chan_id = 1 [jstype = JS_STRING];
2338
- }
2339
-
2340
- message NetworkInfoRequest {
2341
- }
2342
- message NetworkInfo {
2343
- uint32 graph_diameter = 1 [json_name = "graph_diameter"];
2344
- double avg_out_degree = 2 [json_name = "avg_out_degree"];
2345
- uint32 max_out_degree = 3 [json_name = "max_out_degree"];
2346
-
2347
- uint32 num_nodes = 4 [json_name = "num_nodes"];
2348
- uint32 num_channels = 5 [json_name = "num_channels"];
2349
-
2350
- int64 total_network_capacity = 6 [json_name = "total_network_capacity"];
2351
-
2352
- double avg_channel_size = 7 [json_name = "avg_channel_size"];
2353
- int64 min_channel_size = 8 [json_name = "min_channel_size"];
2354
- int64 max_channel_size = 9 [json_name = "max_channel_size"];
2355
- int64 median_channel_size_sat = 10 [json_name = "median_channel_size_sat"];
2356
-
2357
- // The number of edges marked as zombies.
2358
- uint64 num_zombie_chans = 11 [json_name = "num_zombie_chans"];
2359
-
2360
- // TODO(roasbeef): fee rate info, expiry
2361
- // * also additional RPC for tracking fee info once in
2362
- }
2363
-
2364
- message StopRequest{}
2365
- message StopResponse{}
2366
-
2367
- message GraphTopologySubscription {}
2368
- message GraphTopologyUpdate {
2369
- repeated NodeUpdate node_updates = 1;
2370
- repeated ChannelEdgeUpdate channel_updates = 2;
2371
- repeated ClosedChannelUpdate closed_chans = 3;
2372
- }
2373
- message NodeUpdate {
2374
- repeated string addresses = 1;
2375
- string identity_key = 2;
2376
- bytes global_features = 3;
2377
- string alias = 4;
2378
- string color = 5;
2379
- }
2380
- message ChannelEdgeUpdate {
2381
- /**
2382
- The unique channel ID for the channel. The first 3 bytes are the block
2383
- height, the next 3 the index within the block, and the last 2 bytes are the
2384
- output index for the channel.
2385
- */
2386
- uint64 chan_id = 1 [jstype = JS_STRING];
2387
-
2388
- ChannelPoint chan_point = 2;
2389
-
2390
- int64 capacity = 3;
2391
-
2392
- RoutingPolicy routing_policy = 4;
2393
-
2394
- string advertising_node = 5;
2395
- string connecting_node = 6;
2396
- }
2397
- message ClosedChannelUpdate {
2398
- /**
2399
- The unique channel ID for the channel. The first 3 bytes are the block
2400
- height, the next 3 the index within the block, and the last 2 bytes are the
2401
- output index for the channel.
2402
- */
2403
- uint64 chan_id = 1 [jstype = JS_STRING];
2404
- int64 capacity = 2;
2405
- uint32 closed_height = 3;
2406
- ChannelPoint chan_point = 4;
2407
- }
2408
-
2409
- message HopHint {
2410
- /// The public key of the node at the start of the channel.
2411
- string node_id = 1 [json_name = "node_id"];
2412
-
2413
- /// The unique identifier of the channel.
2414
- uint64 chan_id = 2 [json_name = "chan_id", jstype = JS_STRING];
2415
-
2416
- /// The base fee of the channel denominated in millisatoshis.
2417
- uint32 fee_base_msat = 3 [json_name = "fee_base_msat"];
2418
-
2419
- /**
2420
- The fee rate of the channel for sending one satoshi across it denominated in
2421
- millionths of a satoshi.
2422
- */
2423
- uint32 fee_proportional_millionths = 4 [json_name = "fee_proportional_millionths"];
2424
-
2425
- /// The time-lock delta of the channel.
2426
- uint32 cltv_expiry_delta = 5 [json_name = "cltv_expiry_delta"];
2427
- }
2428
-
2429
- message RouteHint {
2430
- /**
2431
- A list of hop hints that when chained together can assist in reaching a
2432
- specific destination.
2433
- */
2434
- repeated HopHint hop_hints = 1 [json_name = "hop_hints"];
2435
- }
2436
-
2437
- message Invoice {
2438
- /**
2439
- An optional memo to attach along with the invoice. Used for record keeping
2440
- purposes for the invoice's creator, and will also be set in the description
2441
- field of the encoded payment request if the description_hash field is not
2442
- being used.
2443
- */
2444
- string memo = 1 [json_name = "memo"];
2445
-
2446
- reserved 2;
2447
-
2448
- /**
2449
- The hex-encoded preimage (32 byte) which will allow settling an incoming
2450
- HTLC payable to this preimage. When using REST, this field must be encoded
2451
- as base64.
2452
- */
2453
- bytes r_preimage = 3 [json_name = "r_preimage"];
2454
-
2455
- /**
2456
- The hash of the preimage. When using REST, this field must be encoded as
2457
- base64.
2458
- */
2459
- bytes r_hash = 4 [json_name = "r_hash"];
2460
-
2461
- /**
2462
- The value of this invoice in satoshis
2463
-
2464
- The fields value and value_msat are mutually exclusive.
2465
- */
2466
- int64 value = 5 [json_name = "value"];
2467
-
2468
- /**
2469
- The value of this invoice in millisatoshis
2470
-
2471
- The fields value and value_msat are mutually exclusive.
2472
- */
2473
- int64 value_msat = 23 [json_name = "value_msat"];
2474
-
2475
- /// Whether this invoice has been fulfilled
2476
- bool settled = 6 [json_name = "settled", deprecated = true];
2477
-
2478
- /// When this invoice was created
2479
- int64 creation_date = 7 [json_name = "creation_date"];
2480
-
2481
- /// When this invoice was settled
2482
- int64 settle_date = 8 [json_name = "settle_date"];
2483
-
2484
- /**
2485
- A bare-bones invoice for a payment within the Lightning Network. With the
2486
- details of the invoice, the sender has all the data necessary to send a
2487
- payment to the recipient.
2488
- */
2489
- string payment_request = 9 [json_name = "payment_request"];
2490
-
2491
- /**
2492
- Hash (SHA-256) of a description of the payment. Used if the description of
2493
- payment (memo) is too long to naturally fit within the description field
2494
- of an encoded payment request. When using REST, this field must be encoded
2495
- as base64.
2496
- */
2497
- bytes description_hash = 10 [json_name = "description_hash"];
2498
-
2499
- /// Payment request expiry time in seconds. Default is 3600 (1 hour).
2500
- int64 expiry = 11 [json_name = "expiry"];
2501
-
2502
- /// Fallback on-chain address.
2503
- string fallback_addr = 12 [json_name = "fallback_addr"];
2504
-
2505
- /// Delta to use for the time-lock of the CLTV extended to the final hop.
2506
- uint64 cltv_expiry = 13 [json_name = "cltv_expiry"];
2507
-
2508
- /**
2509
- Route hints that can each be individually used to assist in reaching the
2510
- invoice's destination.
2511
- */
2512
- repeated RouteHint route_hints = 14 [json_name = "route_hints"];
2513
-
2514
- /// Whether this invoice should include routing hints for private channels.
2515
- bool private = 15 [json_name = "private"];
2516
-
2517
- /**
2518
- The "add" index of this invoice. Each newly created invoice will increment
2519
- this index making it monotonically increasing. Callers to the
2520
- SubscribeInvoices call can use this to instantly get notified of all added
2521
- invoices with an add_index greater than this one.
2522
- */
2523
- uint64 add_index = 16 [json_name = "add_index"];
2524
-
2525
- /**
2526
- The "settle" index of this invoice. Each newly settled invoice will
2527
- increment this index making it monotonically increasing. Callers to the
2528
- SubscribeInvoices call can use this to instantly get notified of all
2529
- settled invoices with an settle_index greater than this one.
2530
- */
2531
- uint64 settle_index = 17 [json_name = "settle_index"];
2532
-
2533
- /// Deprecated, use amt_paid_sat or amt_paid_msat.
2534
- int64 amt_paid = 18 [json_name = "amt_paid", deprecated = true];
2535
-
2536
- /**
2537
- The amount that was accepted for this invoice, in satoshis. This will ONLY
2538
- be set if this invoice has been settled. We provide this field as if the
2539
- invoice was created with a zero value, then we need to record what amount
2540
- was ultimately accepted. Additionally, it's possible that the sender paid
2541
- MORE that was specified in the original invoice. So we'll record that here
2542
- as well.
2543
- */
2544
- int64 amt_paid_sat = 19 [json_name = "amt_paid_sat"];
2545
-
2546
- /**
2547
- The amount that was accepted for this invoice, in millisatoshis. This will
2548
- ONLY be set if this invoice has been settled. We provide this field as if
2549
- the invoice was created with a zero value, then we need to record what
2550
- amount was ultimately accepted. Additionally, it's possible that the sender
2551
- paid MORE that was specified in the original invoice. So we'll record that
2552
- here as well.
2553
- */
2554
- int64 amt_paid_msat = 20 [json_name = "amt_paid_msat"];
2555
-
2556
- enum InvoiceState {
2557
- OPEN = 0;
2558
- SETTLED = 1;
2559
- CANCELED = 2;
2560
- ACCEPTED = 3;
2561
- }
2562
-
2563
- /**
2564
- The state the invoice is in.
2565
- */
2566
- InvoiceState state = 21 [json_name = "state"];
2567
-
2568
- /// List of HTLCs paying to this invoice [EXPERIMENTAL].
2569
- repeated InvoiceHTLC htlcs = 22 [json_name = "htlcs"];
2570
-
2571
- /// List of features advertised on the invoice.
2572
- map<uint32, Feature> features = 24 [json_name = "features"];
2573
-
2574
- /**
2575
- Indicates if this invoice was a spontaneous payment that arrived via keysend
2576
- [EXPERIMENTAL].
2577
- */
2578
- bool is_keysend = 25 [json_name = "is_keysend"];
2579
- }
2580
-
2581
- enum InvoiceHTLCState {
2582
- ACCEPTED = 0;
2583
- SETTLED = 1;
2584
- CANCELED = 2;
2585
- }
2586
-
2587
- /// Details of an HTLC that paid to an invoice
2588
- message InvoiceHTLC {
2589
- /// Short channel id over which the htlc was received.
2590
- uint64 chan_id = 1 [json_name = "chan_id", jstype = JS_STRING];
2591
-
2592
- /// Index identifying the htlc on the channel.
2593
- uint64 htlc_index = 2 [json_name = "htlc_index"];
2594
-
2595
- /// The amount of the htlc in msat.
2596
- uint64 amt_msat = 3 [json_name = "amt_msat"];
2597
-
2598
- /// Block height at which this htlc was accepted.
2599
- int32 accept_height = 4 [json_name = "accept_height"];
2600
-
2601
- /// Time at which this htlc was accepted.
2602
- int64 accept_time = 5 [json_name = "accept_time"];
2603
-
2604
- /// Time at which this htlc was settled or canceled.
2605
- int64 resolve_time = 6 [json_name = "resolve_time"];
2606
-
2607
- /// Block height at which this htlc expires.
2608
- int32 expiry_height = 7 [json_name = "expiry_height"];
2609
-
2610
- /// Current state the htlc is in.
2611
- InvoiceHTLCState state = 8 [json_name = "state"];
2612
-
2613
- /// Custom tlv records.
2614
- map<uint64, bytes> custom_records = 9 [json_name = "custom_records"];
2615
-
2616
- /// The total amount of the mpp payment in msat.
2617
- uint64 mpp_total_amt_msat = 10 [json_name = "mpp_total_amt_msat"];
2618
- }
2619
-
2620
- message AddInvoiceResponse {
2621
- bytes r_hash = 1 [json_name = "r_hash"];
2622
-
2623
- /**
2624
- A bare-bones invoice for a payment within the Lightning Network. With the
2625
- details of the invoice, the sender has all the data necessary to send a
2626
- payment to the recipient.
2627
- */
2628
- string payment_request = 2 [json_name = "payment_request"];
2629
-
2630
- /**
2631
- The "add" index of this invoice. Each newly created invoice will increment
2632
- this index making it monotonically increasing. Callers to the
2633
- SubscribeInvoices call can use this to instantly get notified of all added
2634
- invoices with an add_index greater than this one.
2635
- */
2636
- uint64 add_index = 16 [json_name = "add_index"];
2637
- }
2638
- message PaymentHash {
2639
- /**
2640
- The hex-encoded payment hash of the invoice to be looked up. The passed
2641
- payment hash must be exactly 32 bytes, otherwise an error is returned.
2642
- Deprecated now that the REST gateway supports base64 encoding of bytes
2643
- fields.
2644
- */
2645
- string r_hash_str = 1 [json_name = "r_hash_str", deprecated = true];
2646
-
2647
- /**
2648
- The payment hash of the invoice to be looked up. When using REST, this field
2649
- must be encoded as base64.
2650
- */
2651
- bytes r_hash = 2 [json_name = "r_hash"];
2652
- }
2653
-
2654
- message ListInvoiceRequest {
2655
- /**
2656
- If set, only invoices that are not settled and not canceled will be returned
2657
- in the response.
2658
- */
2659
- bool pending_only = 1 [json_name = "pending_only"];
2660
-
2661
- /**
2662
- The index of an invoice that will be used as either the start or end of a
2663
- query to determine which invoices should be returned in the response.
2664
- */
2665
- uint64 index_offset = 4 [json_name = "index_offset"];
2666
-
2667
- /// The max number of invoices to return in the response to this query.
2668
- uint64 num_max_invoices = 5 [json_name = "num_max_invoices"];
2669
-
2670
- /**
2671
- If set, the invoices returned will result from seeking backwards from the
2672
- specified index offset. This can be used to paginate backwards.
2673
- */
2674
- bool reversed = 6 [json_name = "reversed"];
2675
- }
2676
- message ListInvoiceResponse {
2677
- /**
2678
- A list of invoices from the time slice of the time series specified in the
2679
- request.
2680
- */
2681
- repeated Invoice invoices = 1 [json_name = "invoices"];
2682
-
2683
- /**
2684
- The index of the last item in the set of returned invoices. This can be used
2685
- to seek further, pagination style.
2686
- */
2687
- uint64 last_index_offset = 2 [json_name = "last_index_offset"];
2688
-
2689
- /**
2690
- The index of the last item in the set of returned invoices. This can be used
2691
- to seek backwards, pagination style.
2692
- */
2693
- uint64 first_index_offset = 3 [json_name = "first_index_offset"];
2694
- }
2695
-
2696
- message InvoiceSubscription {
2697
- /**
2698
- If specified (non-zero), then we'll first start by sending out
2699
- notifications for all added indexes with an add_index greater than this
2700
- value. This allows callers to catch up on any events they missed while they
2701
- weren't connected to the streaming RPC.
2702
- */
2703
- uint64 add_index = 1 [json_name = "add_index"];
2704
-
2705
- /**
2706
- If specified (non-zero), then we'll first start by sending out
2707
- notifications for all settled indexes with an settle_index greater than
2708
- this value. This allows callers to catch up on any events they missed while
2709
- they weren't connected to the streaming RPC.
2710
- */
2711
- uint64 settle_index = 2 [json_name = "settle_index"];
2712
- }
2713
-
2714
-
2715
- message Payment {
2716
- /// The payment hash
2717
- string payment_hash = 1 [json_name = "payment_hash"];
2718
-
2719
- /// Deprecated, use value_sat or value_msat.
2720
- int64 value = 2 [json_name = "value", deprecated = true];
2721
-
2722
- /// Deprecated, use creation_time_ns
2723
- int64 creation_date = 3 [json_name = "creation_date", deprecated = true];
2724
-
2725
- /// The path this payment took.
2726
- repeated string path = 4 [json_name = "path", deprecated = true];
2727
-
2728
- /// Deprecated, use fee_sat or fee_msat.
2729
- int64 fee = 5 [json_name = "fee", deprecated = true];
2730
-
2731
- /// The payment preimage
2732
- string payment_preimage = 6 [json_name = "payment_preimage"];
2733
-
2734
- /// The value of the payment in satoshis
2735
- int64 value_sat = 7 [json_name = "value_sat"];
2736
-
2737
- /// The value of the payment in milli-satoshis
2738
- int64 value_msat = 8 [json_name = "value_msat"];
2739
-
2740
- /// The optional payment request being fulfilled.
2741
- string payment_request = 9 [json_name = "payment_request"];
2742
-
2743
- enum PaymentStatus {
2744
- UNKNOWN = 0;
2745
- IN_FLIGHT = 1;
2746
- SUCCEEDED = 2;
2747
- FAILED = 3;
2748
- }
2749
-
2750
- // The status of the payment.
2751
- PaymentStatus status = 10 [json_name = "status"];
2752
-
2753
- /// The fee paid for this payment in satoshis
2754
- int64 fee_sat = 11 [json_name = "fee_sat"];
2755
-
2756
- /// The fee paid for this payment in milli-satoshis
2757
- int64 fee_msat = 12 [json_name = "fee_msat"];
2758
-
2759
- /// The time in UNIX nanoseconds at which the payment was created.
2760
- int64 creation_time_ns = 13 [json_name = "creation_time_ns"];
2761
-
2762
- /// The HTLCs made in attempt to settle the payment [EXPERIMENTAL].
2763
- repeated HTLCAttempt htlcs = 14 [json_name = "htlcs"];
2764
- }
2765
-
2766
- message HTLCAttempt {
2767
- enum HTLCStatus {
2768
- IN_FLIGHT = 0;
2769
- SUCCEEDED = 1;
2770
- FAILED = 2;
2771
- }
2772
-
2773
- /// The status of the HTLC.
2774
- HTLCStatus status = 1 [json_name = "status"];
2775
-
2776
- /// The route taken by this HTLC.
2777
- Route route = 2 [json_name = "route"];
2778
-
2779
- /// The time in UNIX nanoseconds at which this HTLC was sent.
2780
- int64 attempt_time_ns = 3 [json_name = "attempt_time_ns"];
2781
-
2782
- /**
2783
- The time in UNIX nanoseconds at which this HTLC was settled or failed.
2784
- This value will not be set if the HTLC is still IN_FLIGHT.
2785
- */
2786
- int64 resolve_time_ns = 4 [json_name = "resolve_time_ns"];
2787
- }
2788
-
2789
- message ListPaymentsRequest {
2790
- /**
2791
- If true, then return payments that have not yet fully completed. This means
2792
- that pending payments, as well as failed payments will show up if this
2793
- field is set to True.
2794
- */
2795
- bool include_incomplete = 1;
2796
- }
2797
-
2798
- message ListPaymentsResponse {
2799
- /// The list of payments
2800
- repeated Payment payments = 1 [json_name = "payments"];
2801
- }
2802
-
2803
- message DeleteAllPaymentsRequest {
2804
- }
2805
-
2806
- message DeleteAllPaymentsResponse {
2807
- }
2808
-
2809
- message AbandonChannelRequest {
2810
- ChannelPoint channel_point = 1;
2811
- }
2812
-
2813
- message AbandonChannelResponse {
2814
- }
2815
-
2816
-
2817
- message DebugLevelRequest {
2818
- bool show = 1;
2819
- string level_spec = 2;
2820
- }
2821
- message DebugLevelResponse {
2822
- string sub_systems = 1 [json_name = "sub_systems"];
2823
- }
2824
-
2825
- message PayReqString {
2826
- /// The payment request string to be decoded
2827
- string pay_req = 1;
2828
- }
2829
- message PayReq {
2830
- string destination = 1 [json_name = "destination"];
2831
- string payment_hash = 2 [json_name = "payment_hash"];
2832
- int64 num_satoshis = 3 [json_name = "num_satoshis"];
2833
- int64 timestamp = 4 [json_name = "timestamp"];
2834
- int64 expiry = 5 [json_name = "expiry"];
2835
- string description = 6 [json_name = "description"];
2836
- string description_hash = 7 [json_name = "description_hash"];
2837
- string fallback_addr = 8 [json_name = "fallback_addr"];
2838
- int64 cltv_expiry = 9 [json_name = "cltv_expiry"];
2839
- repeated RouteHint route_hints = 10 [json_name = "route_hints"];
2840
- bytes payment_addr = 11 [json_name = "payment_addr"];
2841
- int64 num_msat = 12 [json_name = "num_msat"];
2842
- map<uint32, Feature> features = 13 [json_name = "features"];
2843
- }
2844
-
2845
- enum FeatureBit {
2846
- DATALOSS_PROTECT_REQ = 0;
2847
- DATALOSS_PROTECT_OPT = 1;
2848
- INITIAL_ROUING_SYNC = 3;
2849
- UPFRONT_SHUTDOWN_SCRIPT_REQ = 4;
2850
- UPFRONT_SHUTDOWN_SCRIPT_OPT = 5;
2851
- GOSSIP_QUERIES_REQ = 6;
2852
- GOSSIP_QUERIES_OPT = 7;
2853
- TLV_ONION_REQ = 8;
2854
- TLV_ONION_OPT = 9;
2855
- EXT_GOSSIP_QUERIES_REQ = 10;
2856
- EXT_GOSSIP_QUERIES_OPT = 11;
2857
- STATIC_REMOTE_KEY_REQ = 12;
2858
- STATIC_REMOTE_KEY_OPT = 13;
2859
- PAYMENT_ADDR_REQ = 14;
2860
- PAYMENT_ADDR_OPT = 15;
2861
- MPP_REQ = 16;
2862
- MPP_OPT = 17;
2863
- }
2864
-
2865
- message Feature {
2866
- string name = 2 [json_name = "name"];
2867
- bool is_required = 3 [json_name = "is_required"];
2868
- bool is_known = 4 [json_name = "is_known"];
2869
- }
2870
-
2871
- message FeeReportRequest {}
2872
- message ChannelFeeReport {
2873
- /// The channel that this fee report belongs to.
2874
- string chan_point = 1 [json_name = "channel_point"];
2875
-
2876
- /// The base fee charged regardless of the number of milli-satoshis sent.
2877
- int64 base_fee_msat = 2 [json_name = "base_fee_msat"];
2878
-
2879
- /// The amount charged per milli-satoshis transferred expressed in millionths of a satoshi.
2880
- int64 fee_per_mil = 3 [json_name = "fee_per_mil"];
2881
-
2882
- /// The effective fee rate in milli-satoshis. Computed by dividing the fee_per_mil value by 1 million.
2883
- double fee_rate = 4 [json_name = "fee_rate"];
2884
- }
2885
- message FeeReportResponse {
2886
- /// An array of channel fee reports which describes the current fee schedule for each channel.
2887
- repeated ChannelFeeReport channel_fees = 1 [json_name = "channel_fees"];
2888
-
2889
- /// The total amount of fee revenue (in satoshis) the switch has collected over the past 24 hrs.
2890
- uint64 day_fee_sum = 2 [json_name = "day_fee_sum"];
2891
-
2892
- /// The total amount of fee revenue (in satoshis) the switch has collected over the past 1 week.
2893
- uint64 week_fee_sum = 3 [json_name = "week_fee_sum"];
2894
-
2895
- /// The total amount of fee revenue (in satoshis) the switch has collected over the past 1 month.
2896
- uint64 month_fee_sum = 4 [json_name = "month_fee_sum"];
2897
- }
2898
-
2899
- message PolicyUpdateRequest {
2900
- oneof scope {
2901
- /// If set, then this update applies to all currently active channels.
2902
- bool global = 1 [json_name = "global"] ;
2903
-
2904
- /// If set, this update will target a specific channel.
2905
- ChannelPoint chan_point = 2 [json_name = "chan_point"];
2906
- }
2907
-
2908
- /// The base fee charged regardless of the number of milli-satoshis sent.
2909
- int64 base_fee_msat = 3 [json_name = "base_fee_msat"];
2910
-
2911
- /// The effective fee rate in milli-satoshis. The precision of this value goes up to 6 decimal places, so 1e-6.
2912
- double fee_rate = 4 [json_name = "fee_rate"];
2913
-
2914
- /// The required timelock delta for HTLCs forwarded over the channel.
2915
- uint32 time_lock_delta = 5 [json_name = "time_lock_delta"];
2916
-
2917
- /// If set, the maximum HTLC size in milli-satoshis. If unset, the maximum HTLC will be unchanged.
2918
- uint64 max_htlc_msat = 6 [json_name = "max_htlc_msat"];
2919
-
2920
- /// The minimum HTLC size in milli-satoshis. Only applied if min_htlc_msat_specified is true.
2921
- uint64 min_htlc_msat = 7 [json_name = "min_htlc_msat"];
2922
-
2923
- /// If true, min_htlc_msat is applied.
2924
- bool min_htlc_msat_specified = 8 [json_name = "set_min_htlc_msat"];
2925
- }
2926
- message PolicyUpdateResponse {
2927
- }
2928
-
2929
- message ForwardingHistoryRequest {
2930
- /// 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.
2931
- uint64 start_time = 1 [json_name = "start_time"];
2932
-
2933
- /// 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.
2934
- uint64 end_time = 2 [json_name = "end_time"];
2935
-
2936
- /// 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.
2937
- uint32 index_offset = 3 [json_name = "index_offset"];
2938
-
2939
- /// The max number of events to return in the response to this query.
2940
- uint32 num_max_events = 4 [json_name = "num_max_events"];
2941
- }
2942
- message ForwardingEvent {
2943
- /// Timestamp is the time (unix epoch offset) that this circuit was completed.
2944
- uint64 timestamp = 1 [json_name = "timestamp"];
2945
-
2946
- /// The incoming channel ID that carried the HTLC that created the circuit.
2947
- uint64 chan_id_in = 2 [json_name = "chan_id_in", jstype = JS_STRING];
2948
-
2949
- /// The outgoing channel ID that carried the preimage that completed the circuit.
2950
- uint64 chan_id_out = 4 [json_name = "chan_id_out", jstype = JS_STRING];
2951
-
2952
- /// The total amount (in satoshis) of the incoming HTLC that created half the circuit.
2953
- uint64 amt_in = 5 [json_name = "amt_in"];
2954
-
2955
- /// The total amount (in satoshis) of the outgoing HTLC that created the second half of the circuit.
2956
- uint64 amt_out = 6 [json_name = "amt_out"];
2957
-
2958
- /// The total fee (in satoshis) that this payment circuit carried.
2959
- uint64 fee = 7 [json_name = "fee"];
2960
-
2961
- /// The total fee (in milli-satoshis) that this payment circuit carried.
2962
- uint64 fee_msat = 8 [json_name = "fee_msat"];
2963
-
2964
- /// The total amount (in milli-satoshis) of the incoming HTLC that created half the circuit.
2965
- uint64 amt_in_msat = 9 [json_name = "amt_in_msat"];
2966
-
2967
- /// The total amount (in milli-satoshis) of the outgoing HTLC that created the second half of the circuit.
2968
- uint64 amt_out_msat = 10 [json_name = "amt_out_msat"];
2969
-
2970
-
2971
- // TODO(roasbeef): add settlement latency?
2972
- // * use FPE on the chan id?
2973
- // * also list failures?
2974
- }
2975
- message ForwardingHistoryResponse {
2976
- /// A list of forwarding events from the time slice of the time series specified in the request.
2977
- repeated ForwardingEvent forwarding_events = 1 [json_name = "forwarding_events"];
2978
-
2979
- /// The index of the last time in the set of returned forwarding events. Can be used to seek further, pagination style.
2980
- uint32 last_offset_index = 2 [json_name = "last_offset_index"];
2981
- }
2982
-
2983
- message ExportChannelBackupRequest {
2984
- /// The target channel point to obtain a back up for.
2985
- ChannelPoint chan_point = 1;
2986
- }
2987
-
2988
- message ChannelBackup {
2989
- /**
2990
- Identifies the channel that this backup belongs to.
2991
- */
2992
- ChannelPoint chan_point = 1 [ json_name = "chan_point" ];
2993
-
2994
- /**
2995
- Is an encrypted single-chan backup. this can be passed to
2996
- RestoreChannelBackups, or the WalletUnlocker Init and Unlock methods in
2997
- order to trigger the recovery protocol. When using REST, this field must be
2998
- encoded as base64.
2999
- */
3000
- bytes chan_backup = 2 [ json_name = "chan_backup" ];
3001
- }
3002
-
3003
- message MultiChanBackup {
3004
- /**
3005
- Is the set of all channels that are included in this multi-channel backup.
3006
- */
3007
- repeated ChannelPoint chan_points = 1 [ json_name = "chan_points" ];
3008
-
3009
- /**
3010
- A single encrypted blob containing all the static channel backups of the
3011
- channel listed above. This can be stored as a single file or blob, and
3012
- safely be replaced with any prior/future versions. When using REST, this
3013
- field must be encoded as base64.
3014
- */
3015
- bytes multi_chan_backup = 2 [ json_name = "multi_chan_backup" ];
3016
- }
3017
-
3018
- message ChanBackupExportRequest {}
3019
- message ChanBackupSnapshot {
3020
- /**
3021
- The set of new channels that have been added since the last channel backup
3022
- snapshot was requested.
3023
- */
3024
- ChannelBackups single_chan_backups = 1 [ json_name = "single_chan_backups" ];
3025
-
3026
- /**
3027
- A multi-channel backup that covers all open channels currently known to
3028
- lnd.
3029
- */
3030
- MultiChanBackup multi_chan_backup = 2 [ json_name = "multi_chan_backup" ];
3031
- }
3032
-
3033
- message ChannelBackups {
3034
- /**
3035
- A set of single-chan static channel backups.
3036
- */
3037
- repeated ChannelBackup chan_backups = 1 [ json_name = "chan_backups" ];
3038
- }
3039
-
3040
- message RestoreChanBackupRequest {
3041
- oneof backup {
3042
- /**
3043
- The channels to restore as a list of channel/backup pairs.
3044
- */
3045
- ChannelBackups chan_backups = 1 [ json_name = "chan_backups" ];
3046
-
3047
- /**
3048
- The channels to restore in the packed multi backup format. When using
3049
- REST, this field must be encoded as base64.
3050
- */
3051
- bytes multi_chan_backup = 2 [ json_name = "multi_chan_backup" ];
3052
- }
3053
- }
3054
- message RestoreBackupResponse {}
3055
-
3056
- message ChannelBackupSubscription {}
3057
-
3058
- message VerifyChanBackupResponse {
3059
- }
3060
-
3061
- message MacaroonPermission {
3062
- /// The entity a permission grants access to.
3063
- string entity = 1 [json_name = "entity"];
3064
-
3065
- /// The action that is granted.
3066
- string action = 2 [json_name = "action"];
3067
- }
3068
- message BakeMacaroonRequest {
3069
- /// The list of permissions the new macaroon should grant.
3070
- repeated MacaroonPermission permissions = 1 [json_name = "permissions"];
3071
- }
3072
- message BakeMacaroonResponse {
3073
- /// The hex encoded macaroon, serialized in binary format.
3074
- string macaroon = 1 [json_name = "macaroon"];
3075
- }