github.com/decred/dcrlnd@v0.7.6/lnrpc/lightning.proto (about) 1 syntax = "proto3"; 2 3 package lnrpc; 4 5 option go_package = "github.com/decred/dcrlnd/lnrpc"; 6 7 /* 8 * Comments in this file will be directly parsed into the API 9 * Documentation as descriptions of the associated method, message, or field. 10 * These descriptions should go right above the definition of the object, and 11 * can be in either block or // comment format. 12 * 13 * An RPC method can be matched to an lncli command by placing a line in the 14 * beginning of the description in exactly the following format: 15 * lncli: `methodname` 16 * 17 * Failure to specify the exact name of the command will cause documentation 18 * generation to fail. 19 * 20 * More information on how exactly the gRPC documentation is generated from 21 * this proto file can be found here: 22 * https://github.com/lightninglabs/lightning-api 23 */ 24 25 // Lightning is the main RPC server of the daemon. 26 service Lightning { 27 /* lncli: `walletbalance` 28 WalletBalance returns total unspent outputs(confirmed and unconfirmed), all 29 confirmed unspent outputs and all unconfirmed unspent outputs under control 30 of the wallet. 31 */ 32 rpc WalletBalance (WalletBalanceRequest) returns (WalletBalanceResponse); 33 34 /* lncli: `channelbalance` 35 ChannelBalance returns a report on the total funds across all open channels, 36 categorized in local/remote, pending local/remote and unsettled local/remote 37 balances. 38 */ 39 rpc ChannelBalance (ChannelBalanceRequest) returns (ChannelBalanceResponse); 40 41 /* lncli: `listchaintxns` 42 GetTransactions returns a list describing all the known transactions 43 relevant to the wallet. 44 */ 45 rpc GetTransactions (GetTransactionsRequest) returns (TransactionDetails); 46 47 /* lncli: `estimatefee` 48 EstimateFee asks the chain backend to estimate the fee rate and total fees 49 for a transaction that pays to multiple specified outputs. 50 51 When using REST, the `AddrToAmount` map type can be set by appending 52 `&AddrToAmount[<address>]=<amount_to_send>` to the URL. Unfortunately this 53 map type doesn't appear in the REST API documentation because of a bug in 54 the grpc-gateway library. 55 */ 56 rpc EstimateFee (EstimateFeeRequest) returns (EstimateFeeResponse); 57 58 /* lncli: `sendcoins` 59 SendCoins executes a request to send coins to a particular address. Unlike 60 SendMany, this RPC call only allows creating a single output at a time. If 61 neither target_conf, or atoms_per_byte are set, then the internal wallet 62 will consult its fee model to determine a fee for the default confirmation 63 target. 64 */ 65 rpc SendCoins (SendCoinsRequest) returns (SendCoinsResponse); 66 67 /* lncli: `listunspent` 68 Deprecated, use walletrpc.ListUnspent instead. 69 70 ListUnspent returns a list of all utxos spendable by the wallet with a 71 number of confirmations between the specified minimum and maximum. 72 */ 73 rpc ListUnspent (ListUnspentRequest) returns (ListUnspentResponse); 74 75 /* 76 SubscribeTransactions creates a uni-directional stream from the server to 77 the client in which any newly discovered transactions relevant to the 78 wallet are sent over. 79 */ 80 rpc SubscribeTransactions (GetTransactionsRequest) 81 returns (stream Transaction); 82 83 /* lncli: `sendmany` 84 SendMany handles a request for a transaction that creates multiple specified 85 outputs in parallel. If neither target_conf, or atoms_per_byte are set, then 86 the internal wallet will consult its fee model to determine a fee for the 87 default confirmation target. 88 */ 89 rpc SendMany (SendManyRequest) returns (SendManyResponse); 90 91 /* lncli: `newaddress` 92 NewAddress creates a new address under control of the local wallet. 93 */ 94 rpc NewAddress (NewAddressRequest) returns (NewAddressResponse); 95 96 /* lncli: `signmessage` 97 SignMessage signs a message with this node's private key. The returned 98 signature string is `zbase32` encoded and pubkey recoverable, meaning that 99 only the message digest and signature are needed for verification. 100 */ 101 rpc SignMessage (SignMessageRequest) returns (SignMessageResponse); 102 103 /* lncli: `verifymessage` 104 VerifyMessage verifies a signature over a msg. The signature must be 105 zbase32 encoded and signed by an active node in the resident node's 106 channel database. In addition to returning the validity of the signature, 107 VerifyMessage also returns the recovered pubkey from the signature. 108 */ 109 rpc VerifyMessage (VerifyMessageRequest) returns (VerifyMessageResponse); 110 111 /* lncli: `connect` 112 ConnectPeer attempts to establish a connection to a remote peer. This is at 113 the networking level, and is used for communication between nodes. This is 114 distinct from establishing a channel with a peer. 115 */ 116 rpc ConnectPeer (ConnectPeerRequest) returns (ConnectPeerResponse); 117 118 /* lncli: `disconnect` 119 DisconnectPeer attempts to disconnect one peer from another identified by a 120 given pubKey. In the case that we currently have a pending or active channel 121 with the target peer, then this action will be not be allowed. 122 */ 123 rpc DisconnectPeer (DisconnectPeerRequest) returns (DisconnectPeerResponse); 124 125 /* lncli: `listpeers` 126 ListPeers returns a verbose listing of all currently active peers. 127 */ 128 rpc ListPeers (ListPeersRequest) returns (ListPeersResponse); 129 130 /* 131 SubscribePeerEvents creates a uni-directional stream from the server to 132 the client in which any events relevant to the state of peers are sent 133 over. Events include peers going online and offline. 134 */ 135 rpc SubscribePeerEvents (PeerEventSubscription) returns (stream PeerEvent); 136 137 /* lncli: `getinfo` 138 GetInfo returns general information concerning the lightning node including 139 it's identity pubkey, alias, the chains it is connected to, and information 140 concerning the number of open+pending channels. 141 */ 142 rpc GetInfo (GetInfoRequest) returns (GetInfoResponse); 143 144 /** lncli: `getrecoveryinfo` 145 GetRecoveryInfo returns information concerning the recovery mode including 146 whether it's in a recovery mode, whether the recovery is finished, and the 147 progress made so far. 148 */ 149 rpc GetRecoveryInfo (GetRecoveryInfoRequest) 150 returns (GetRecoveryInfoResponse); 151 152 // TODO(roasbeef): merge with below with bool? 153 /* lncli: `pendingchannels` 154 PendingChannels returns a list of all the channels that are currently 155 considered "pending". A channel is pending if it has finished the funding 156 workflow and is waiting for confirmations for the funding txn, or is in the 157 process of closure, either initiated cooperatively or non-cooperatively. 158 */ 159 rpc PendingChannels (PendingChannelsRequest) 160 returns (PendingChannelsResponse); 161 162 /* lncli: `listchannels` 163 ListChannels returns a description of all the open channels that this node 164 is a participant in. 165 */ 166 rpc ListChannels (ListChannelsRequest) returns (ListChannelsResponse); 167 168 /* 169 SubscribeChannelEvents creates a uni-directional stream from the server to 170 the client in which any updates relevant to the state of the channels are 171 sent over. Events include new active channels, inactive channels, and closed 172 channels. 173 */ 174 rpc SubscribeChannelEvents (ChannelEventSubscription) 175 returns (stream ChannelEventUpdate); 176 177 /* lncli: `closedchannels` 178 ClosedChannels returns a description of all the closed channels that 179 this node was a participant in. 180 */ 181 rpc ClosedChannels (ClosedChannelsRequest) returns (ClosedChannelsResponse); 182 183 /* 184 OpenChannelSync is a synchronous version of the OpenChannel RPC call. This 185 call is meant to be consumed by clients to the REST proxy. As with all 186 other sync calls, all byte slices are intended to be populated as hex 187 encoded strings. 188 */ 189 rpc OpenChannelSync (OpenChannelRequest) returns (ChannelPoint); 190 191 /* lncli: `openchannel` 192 OpenChannel attempts to open a singly funded channel specified in the 193 request to a remote peer. Users are able to specify a target number of 194 blocks that the funding transaction should be confirmed in, or a manual fee 195 rate to us for the funding transaction. If neither are specified, then a 196 lax block confirmation target is used. Each OpenStatusUpdate will return 197 the pending channel ID of the in-progress channel. Depending on the 198 arguments specified in the OpenChannelRequest, this pending channel ID can 199 then be used to manually progress the channel funding flow. 200 */ 201 rpc OpenChannel (OpenChannelRequest) returns (stream OpenStatusUpdate); 202 203 /* lncli: `batchopenchannel` 204 BatchOpenChannel attempts to open multiple single-funded channels in a 205 single transaction in an atomic way. This means either all channel open 206 requests succeed at once or all attempts are aborted if any of them fail. 207 This is the safer variant of using PSBTs to manually fund a batch of 208 channels through the OpenChannel RPC. 209 */ 210 rpc BatchOpenChannel (BatchOpenChannelRequest) 211 returns (BatchOpenChannelResponse); 212 213 /* 214 FundingStateStep is an advanced funding related call that allows the caller 215 to either execute some preparatory steps for a funding workflow, or 216 manually progress a funding workflow. The primary way a funding flow is 217 identified is via its pending channel ID. As an example, this method can be 218 used to specify that we're expecting a funding flow for a particular 219 pending channel ID, for which we need to use specific parameters. 220 Alternatively, this can be used to interactively drive PSBT signing for 221 funding for partially complete funding transactions. 222 */ 223 rpc FundingStateStep (FundingTransitionMsg) returns (FundingStateStepResp); 224 225 /* 226 ChannelAcceptor dispatches a bi-directional streaming RPC in which 227 OpenChannel requests are sent to the client and the client responds with 228 a boolean that tells LND whether or not to accept the channel. This allows 229 node operators to specify their own criteria for accepting inbound channels 230 through a single persistent connection. 231 */ 232 rpc ChannelAcceptor (stream ChannelAcceptResponse) 233 returns (stream ChannelAcceptRequest); 234 235 /* lncli: `closechannel` 236 CloseChannel attempts to close an active channel identified by its channel 237 outpoint (ChannelPoint). The actions of this method can additionally be 238 augmented to attempt a force close after a timeout period in the case of an 239 inactive peer. If a non-force close (cooperative closure) is requested, 240 then the user can specify either a target number of blocks until the 241 closure transaction is confirmed, or a manual fee rate. If neither are 242 specified, then a default lax, block confirmation target is used. 243 */ 244 rpc CloseChannel (CloseChannelRequest) returns (stream CloseStatusUpdate); 245 246 /* lncli: `abandonchannel` 247 AbandonChannel removes all channel state from the database except for a 248 close summary. This method can be used to get rid of permanently unusable 249 channels due to bugs fixed in newer versions of lnd. This method can also be 250 used to remove externally funded channels where the funding transaction was 251 never broadcast. Only available for non-externally funded channels in dev 252 build. 253 */ 254 rpc AbandonChannel (AbandonChannelRequest) returns (AbandonChannelResponse); 255 256 /* lncli: `sendpayment` 257 Deprecated, use routerrpc.SendPaymentV2. SendPayment dispatches a 258 bi-directional streaming RPC for sending payments through the Lightning 259 Network. A single RPC invocation creates a persistent bi-directional 260 stream allowing clients to rapidly send payments through the Lightning 261 Network with a single persistent connection. 262 */ 263 rpc SendPayment (stream SendRequest) returns (stream SendResponse) { 264 option deprecated = true; 265 } 266 267 /* 268 SendPaymentSync is the synchronous non-streaming version of SendPayment. 269 This RPC is intended to be consumed by clients of the REST proxy. 270 Additionally, this RPC expects the destination's public key and the payment 271 hash (if any) to be encoded as hex strings. 272 */ 273 rpc SendPaymentSync (SendRequest) returns (SendResponse); 274 275 /* lncli: `sendtoroute` 276 Deprecated, use routerrpc.SendToRouteV2. SendToRoute is a bi-directional 277 streaming RPC for sending payment through the Lightning Network. This 278 method differs from SendPayment in that it allows users to specify a full 279 route manually. This can be used for things like rebalancing, and atomic 280 swaps. 281 */ 282 rpc SendToRoute (stream SendToRouteRequest) returns (stream SendResponse) { 283 option deprecated = true; 284 } 285 286 /* 287 SendToRouteSync is a synchronous version of SendToRoute. It Will block 288 until the payment either fails or succeeds. 289 */ 290 rpc SendToRouteSync (SendToRouteRequest) returns (SendResponse); 291 292 /* lncli: `addinvoice` 293 AddInvoice attempts to add a new invoice to the invoice database. Any 294 duplicated invoices are rejected, therefore all invoices *must* have a 295 unique payment preimage. 296 */ 297 rpc AddInvoice (Invoice) returns (AddInvoiceResponse); 298 299 /* lncli: `listinvoices` 300 ListInvoices returns a list of all the invoices currently stored within the 301 database. Any active debug invoices are ignored. It has full support for 302 paginated responses, allowing users to query for specific invoices through 303 their add_index. This can be done by using either the first_index_offset or 304 last_index_offset fields included in the response as the index_offset of the 305 next request. By default, the first 100 invoices created will be returned. 306 Backwards pagination is also supported through the Reversed flag. 307 */ 308 rpc ListInvoices (ListInvoiceRequest) returns (ListInvoiceResponse); 309 310 /* lncli: `lookupinvoice` 311 LookupInvoice attempts to look up an invoice according to its payment hash. 312 The passed payment hash *must* be exactly 32 bytes, if not, an error is 313 returned. 314 */ 315 rpc LookupInvoice (PaymentHash) returns (Invoice); 316 317 /* 318 SubscribeInvoices returns a uni-directional stream (server -> client) for 319 notifying the client of newly added/settled invoices. The caller can 320 optionally specify the add_index and/or the settle_index. If the add_index 321 is specified, then we'll first start by sending add invoice events for all 322 invoices with an add_index greater than the specified value. If the 323 settle_index is specified, the next, we'll send out all settle events for 324 invoices with a settle_index greater than the specified value. One or both 325 of these fields can be set. If no fields are set, then we'll only send out 326 the latest add/settle events. 327 */ 328 rpc SubscribeInvoices (InvoiceSubscription) returns (stream Invoice); 329 330 /* lncli: `decodepayreq` 331 DecodePayReq takes an encoded payment request string and attempts to decode 332 it, returning a full description of the conditions encoded within the 333 payment request. 334 */ 335 rpc DecodePayReq (PayReqString) returns (PayReq); 336 337 /* lncli: `listpayments` 338 ListPayments returns a list of all outgoing payments. 339 */ 340 rpc ListPayments (ListPaymentsRequest) returns (ListPaymentsResponse); 341 342 /* 343 DeletePayment deletes an outgoing payment from DB. Note that it will not 344 attempt to delete an In-Flight payment, since that would be unsafe. 345 */ 346 rpc DeletePayment (DeletePaymentRequest) returns (DeletePaymentResponse); 347 348 /* 349 DeleteAllPayments deletes all outgoing payments from DB. Note that it will 350 not attempt to delete In-Flight payments, since that would be unsafe. 351 */ 352 rpc DeleteAllPayments (DeleteAllPaymentsRequest) 353 returns (DeleteAllPaymentsResponse); 354 355 /* lncli: `describegraph` 356 DescribeGraph returns a description of the latest graph state from the 357 point of view of the node. The graph information is partitioned into two 358 components: all the nodes/vertexes, and all the edges that connect the 359 vertexes themselves. As this is a directed graph, the edges also contain 360 the node directional specific routing policy which includes: the time lock 361 delta, fee information, etc. 362 */ 363 rpc DescribeGraph (ChannelGraphRequest) returns (ChannelGraph); 364 365 /* lncli: `getnodemetrics` 366 GetNodeMetrics returns node metrics calculated from the graph. Currently 367 the only supported metric is betweenness centrality of individual nodes. 368 */ 369 rpc GetNodeMetrics (NodeMetricsRequest) returns (NodeMetricsResponse); 370 371 /* lncli: `getchaninfo` 372 GetChanInfo returns the latest authenticated network announcement for the 373 given channel identified by its channel ID: an 8-byte integer which 374 uniquely identifies the location of transaction's funding output within the 375 blockchain. 376 */ 377 rpc GetChanInfo (ChanInfoRequest) returns (ChannelEdge); 378 379 /* lncli: `getnodeinfo` 380 GetNodeInfo returns the latest advertised, aggregated, and authenticated 381 channel information for the specified node identified by its public key. 382 */ 383 rpc GetNodeInfo (NodeInfoRequest) returns (NodeInfo); 384 385 /* lncli: `enforcenodeping` 386 EnforceNodePing attempts to ping the specified peer. If the request is 387 canceled before a response is received from the remote peer, then this 388 forces lnd to disconnect from the peer (and potentially attempt to 389 reconnect). 390 */ 391 rpc EnforceNodePing (EnforceNodePingRequest) 392 returns (EnforceNodePingResponse); 393 394 /* lncli: `queryroutes` 395 QueryRoutes attempts to query the daemon's Channel Router for a possible 396 route to a target destination capable of carrying a specific amount of 397 atoms. The retuned route contains the full details required to craft and 398 send an HTLC, also including the necessary information that should be 399 present within the Sphinx packet encapsulated within the HTLC. 400 401 When using REST, the `dest_custom_records` map type can be set by appending 402 `&dest_custom_records[<record_number>]=<record_data_base64_url_encoded>` 403 to the URL. Unfortunately this map type doesn't appear in the REST API 404 documentation because of a bug in the grpc-gateway library. 405 */ 406 rpc QueryRoutes (QueryRoutesRequest) returns (QueryRoutesResponse); 407 408 /* lncli: `getnetworkinfo` 409 GetNetworkInfo returns some basic stats about the known channel graph from 410 the point of view of the node. 411 */ 412 rpc GetNetworkInfo (NetworkInfoRequest) returns (NetworkInfo); 413 414 /* lncli: `stop` 415 StopDaemon will send a shutdown request to the interrupt handler, triggering 416 a graceful shutdown of the daemon. 417 */ 418 rpc StopDaemon (StopRequest) returns (StopResponse); 419 420 /* 421 SubscribeChannelGraph launches a streaming RPC that allows the caller to 422 receive notifications upon any changes to the channel graph topology from 423 the point of view of the responding node. Events notified include: new 424 nodes coming online, nodes updating their authenticated attributes, new 425 channels being advertised, updates in the routing policy for a directional 426 channel edge, and when channels are closed on-chain. 427 */ 428 rpc SubscribeChannelGraph (GraphTopologySubscription) 429 returns (stream GraphTopologyUpdate); 430 431 /* lncli: `debuglevel` 432 DebugLevel allows a caller to programmatically set the logging verbosity of 433 lnd. The logging can be targeted according to a coarse daemon-wide logging 434 level, or in a granular fashion to specify the logging for a target 435 sub-system. 436 */ 437 rpc DebugLevel (DebugLevelRequest) returns (DebugLevelResponse); 438 439 /* lncli: `calcpaymentstats` 440 CalcPaymentStats goes through the DB and generates a report on total 441 number of payments recorded. 442 */ 443 rpc CalcPaymentStats (CalcPaymentStatsRequest) returns (CalcPaymentStatsResponse); 444 445 /* lncli: `feereport` 446 FeeReport allows the caller to obtain a report detailing the current fee 447 schedule enforced by the node globally for each channel. 448 */ 449 rpc FeeReport (FeeReportRequest) returns (FeeReportResponse); 450 451 /* lncli: `updatechanpolicy` 452 UpdateChannelPolicy allows the caller to update the fee schedule and 453 channel policies for all channels globally, or a particular channel. 454 */ 455 rpc UpdateChannelPolicy (PolicyUpdateRequest) 456 returns (PolicyUpdateResponse); 457 458 /* lncli: `fwdinghistory` 459 ForwardingHistory allows the caller to query the htlcswitch for a record of 460 all HTLCs forwarded within the target time range, and integer offset 461 within that time range, for a maximum number of events. If no maximum number 462 of events is specified, up to 100 events will be returned. If no time-range 463 is specified, then events will be returned in the order that they occured. 464 465 A list of forwarding events are returned. The size of each forwarding event 466 is 40 bytes, and the max message size able to be returned in gRPC is 4 MiB. 467 As a result each message can only contain 50k entries. Each response has 468 the index offset of the last entry. The index offset can be provided to the 469 request to allow the caller to skip a series of records. 470 */ 471 rpc ForwardingHistory (ForwardingHistoryRequest) 472 returns (ForwardingHistoryResponse); 473 474 /* lncli: `exportchanbackup` 475 ExportChannelBackup attempts to return an encrypted static channel backup 476 for the target channel identified by it channel point. The backup is 477 encrypted with a key generated from the aezeed seed of the user. The 478 returned backup can either be restored using the RestoreChannelBackup 479 method once lnd is running, or via the InitWallet and UnlockWallet methods 480 from the WalletUnlocker service. 481 */ 482 rpc ExportChannelBackup (ExportChannelBackupRequest) 483 returns (ChannelBackup); 484 485 /* 486 ExportAllChannelBackups returns static channel backups for all existing 487 channels known to lnd. A set of regular singular static channel backups for 488 each channel are returned. Additionally, a multi-channel backup is returned 489 as well, which contains a single encrypted blob containing the backups of 490 each channel. 491 */ 492 rpc ExportAllChannelBackups (ChanBackupExportRequest) 493 returns (ChanBackupSnapshot); 494 495 /* 496 VerifyChanBackup allows a caller to verify the integrity of a channel backup 497 snapshot. This method will accept either a packed Single or a packed Multi. 498 Specifying both will result in an error. 499 */ 500 rpc VerifyChanBackup (ChanBackupSnapshot) 501 returns (VerifyChanBackupResponse); 502 503 /* lncli: `restorechanbackup` 504 RestoreChannelBackups accepts a set of singular channel backups, or a 505 single encrypted multi-chan backup and attempts to recover any funds 506 remaining within the channel. If we are able to unpack the backup, then the 507 new channel will be shown under listchannels, as well as pending channels. 508 */ 509 rpc RestoreChannelBackups (RestoreChanBackupRequest) 510 returns (RestoreBackupResponse); 511 512 /* 513 SubscribeChannelBackups allows a client to sub-subscribe to the most up to 514 date information concerning the state of all channel backups. Each time a 515 new channel is added, we return the new set of channels, along with a 516 multi-chan backup containing the backup info for all channels. Each time a 517 channel is closed, we send a new update, which contains new new chan back 518 ups, but the updated set of encrypted multi-chan backups with the closed 519 channel(s) removed. 520 */ 521 rpc SubscribeChannelBackups (ChannelBackupSubscription) 522 returns (stream ChanBackupSnapshot); 523 524 /* lncli: `bakemacaroon` 525 BakeMacaroon allows the creation of a new macaroon with custom read and 526 write permissions. No first-party caveats are added since this can be done 527 offline. 528 */ 529 rpc BakeMacaroon (BakeMacaroonRequest) returns (BakeMacaroonResponse); 530 531 /* lncli: `listmacaroonids` 532 ListMacaroonIDs returns all root key IDs that are in use. 533 */ 534 rpc ListMacaroonIDs (ListMacaroonIDsRequest) 535 returns (ListMacaroonIDsResponse); 536 537 /* lncli: `deletemacaroonid` 538 DeleteMacaroonID deletes the specified macaroon ID and invalidates all 539 macaroons derived from that ID. 540 */ 541 rpc DeleteMacaroonID (DeleteMacaroonIDRequest) 542 returns (DeleteMacaroonIDResponse); 543 544 /* lncli: `listpermissions` 545 ListPermissions lists all RPC method URIs and their required macaroon 546 permissions to access them. 547 */ 548 rpc ListPermissions (ListPermissionsRequest) 549 returns (ListPermissionsResponse); 550 551 /* 552 CheckMacaroonPermissions checks whether a request follows the constraints 553 imposed on the macaroon and that the macaroon is authorized to follow the 554 provided permissions. 555 */ 556 rpc CheckMacaroonPermissions (CheckMacPermRequest) 557 returns (CheckMacPermResponse); 558 559 /* 560 RegisterRPCMiddleware adds a new gRPC middleware to the interceptor chain. A 561 gRPC middleware is software component external to lnd that aims to add 562 additional business logic to lnd by observing/intercepting/validating 563 incoming gRPC client requests and (if needed) replacing/overwriting outgoing 564 messages before they're sent to the client. When registering the middleware 565 must identify itself and indicate what custom macaroon caveats it wants to 566 be responsible for. Only requests that contain a macaroon with that specific 567 custom caveat are then sent to the middleware for inspection. The other 568 option is to register for the read-only mode in which all requests/responses 569 are forwarded for interception to the middleware but the middleware is not 570 allowed to modify any responses. As a security measure, _no_ middleware can 571 modify responses for requests made with _unencumbered_ macaroons! 572 */ 573 rpc RegisterRPCMiddleware (stream RPCMiddlewareResponse) 574 returns (stream RPCMiddlewareRequest); 575 576 /* lncli: `sendcustom` 577 SendCustomMessage sends a custom peer message. 578 */ 579 rpc SendCustomMessage (SendCustomMessageRequest) 580 returns (SendCustomMessageResponse); 581 582 /* lncli: `subscribecustom` 583 SubscribeCustomMessages subscribes to a stream of incoming custom peer 584 messages. 585 */ 586 rpc SubscribeCustomMessages (SubscribeCustomMessagesRequest) 587 returns (stream CustomMessage); 588 } 589 590 message SubscribeCustomMessagesRequest { 591 } 592 593 message CustomMessage { 594 // Peer from which the message originates 595 bytes peer = 1; 596 597 // Message type. This value will be in the custom range (>= 32768). 598 uint32 type = 2; 599 600 // Raw message data 601 bytes data = 3; 602 } 603 604 message SendCustomMessageRequest { 605 // Peer to send the message to 606 bytes peer = 1; 607 608 // Message type. This value needs to be in the custom range (>= 32768). 609 uint32 type = 2; 610 611 // Raw message data. 612 bytes data = 3; 613 } 614 615 message SendCustomMessageResponse { 616 } 617 618 message Utxo { 619 // The type of address 620 AddressType address_type = 1; 621 622 // The address 623 string address = 2; 624 625 // The value of the unspent coin in atoms 626 int64 amount_atoms = 3; 627 628 // The pkscript in hex 629 string pk_script = 4; 630 631 // The outpoint in format txid:n 632 OutPoint outpoint = 5; 633 634 // The number of confirmations for the Utxo 635 int64 confirmations = 6; 636 } 637 638 message Transaction { 639 // The transaction hash 640 string tx_hash = 1; 641 642 // The transaction amount, denominated in atoms 643 int64 amount = 2; 644 645 // The number of confirmations 646 int32 num_confirmations = 3; 647 648 // The hash of the block this transaction was included in 649 string block_hash = 4; 650 651 // The height of the block this transaction was included in 652 int32 block_height = 5; 653 654 // Timestamp of this transaction 655 int64 time_stamp = 6; 656 657 // Fees paid for this transaction 658 int64 total_fees = 7; 659 660 // Addresses that received funds for this transaction 661 repeated string dest_addresses = 8; 662 663 // The raw transaction hex. 664 string raw_tx_hex = 9; 665 666 // A label that was optionally set on transaction broadcast. 667 string label = 10; 668 } 669 message GetTransactionsRequest { 670 /* 671 The height from which to list transactions, inclusive. If this value is 672 greater than end_height, transactions will be read in reverse. 673 */ 674 int32 start_height = 1; 675 676 /* 677 The height until which to list transactions, inclusive. To include 678 unconfirmed transactions, this value should be set to -1, which will 679 return transactions from start_height until the current chain tip and 680 unconfirmed transactions. If no end_height is provided, the call will 681 default to this option. 682 */ 683 int32 end_height = 2; 684 685 // An optional filter to only include transactions relevant to an account. 686 string account = 3; 687 } 688 689 message TransactionDetails { 690 // The list of transactions relevant to the wallet. 691 repeated Transaction transactions = 1; 692 } 693 694 message FeeLimit { 695 oneof limit { 696 /* 697 The fee limit expressed as a fixed amount of atoms. 698 699 The fields fixed and fixed_m_atoms are mutually exclusive. 700 */ 701 int64 fixed = 1; 702 703 /* 704 The fee limit expressed as a fixed amount of milliatoms. 705 706 The fields fixed and fixed_m_atoms are mutually exclusive. 707 */ 708 int64 fixed_m_atoms = 3; 709 710 // The fee limit expressed as a percentage of the payment amount. 711 int64 percent = 2; 712 } 713 } 714 715 message SendRequest { 716 /* 717 The identity pubkey of the payment recipient. When using REST, this field 718 must be encoded as base64. 719 */ 720 bytes dest = 1; 721 722 /* 723 The hex-encoded identity pubkey of the payment recipient. Deprecated now 724 that the REST gateway supports base64 encoding of bytes fields. 725 */ 726 string dest_string = 2 [deprecated = true]; 727 728 /* 729 The amount to send expressed in atoms. 730 731 The fields amt and amt_m_atoms are mutually exclusive. 732 */ 733 int64 amt = 3; 734 735 /* 736 The amount to send expressed in milliatoms. 737 738 The fields amt and amt_m_atoms are mutually exclusive. 739 */ 740 int64 amt_m_atoms = 13; 741 742 /* 743 The hash to use within the payment's HTLC. When using REST, this field 744 must be encoded as base64. 745 */ 746 bytes payment_hash = 4; 747 748 /* 749 The hex-encoded hash to use within the payment's HTLC. Deprecated now 750 that the REST gateway supports base64 encoding of bytes fields. 751 */ 752 string payment_hash_string = 5 [deprecated = true]; 753 754 /* 755 A bare-bones invoice for a payment within the Lightning Network. With the 756 details of the invoice, the sender has all the data necessary to send a 757 payment to the recipient. 758 */ 759 string payment_request = 6; 760 761 /* 762 The CLTV delta from the current height that should be used to set the 763 timelock for the final hop. 764 */ 765 int32 final_cltv_delta = 7; 766 767 /* 768 The maximum number of atoms that will be paid as a fee of the payment. 769 This value can be represented either as a percentage of the amount being 770 sent, or as a fixed amount of the maximum fee the user is willing the pay to 771 send the payment. If not specified, lnd will use a default value of 100% 772 fees for small amounts (<=1k atoms) or 5% fees for larger amounts. 773 */ 774 FeeLimit fee_limit = 8; 775 776 /* 777 The channel id of the channel that must be taken to the first hop. If zero, 778 any channel may be used. 779 */ 780 uint64 outgoing_chan_id = 10 [jstype = JS_STRING]; 781 782 /* 783 Whether to forgo checking for the maximum outbound amount before attempting 784 to send the payment. 785 786 When sending a payment, the node will check if there is enough outbound 787 bandwidth in at least one of its directly connected channels (after 788 accounting for the required reserves) before attempting to determine a 789 route for it. Specifying this parameter will disable these checks and allow 790 the node to attempt the payment even if there are no outbound channels with 791 enough capacity to send it. 792 */ 793 bool ignore_max_outbound_amt = 9; 794 795 /* 796 The pubkey of the last hop of the route. If empty, any hop may be used. 797 */ 798 bytes last_hop_pubkey = 14; 799 800 /* 801 An optional maximum total time lock for the route. This should not exceed 802 lnd's `--max-cltv-expiry` setting. If zero, then the value of 803 `--max-cltv-expiry` is enforced. 804 */ 805 uint32 cltv_limit = 11; 806 807 /* 808 An optional field that can be used to pass an arbitrary set of TLV records 809 to a peer which understands the new records. This can be used to pass 810 application specific data during the payment attempt. Record types are 811 required to be in the custom range >= 65536. When using REST, the values 812 must be encoded as base64. 813 */ 814 map<uint64, bytes> dest_custom_records = 12; 815 816 // If set, circular payments to self are permitted. 817 bool allow_self_payment = 15; 818 819 /* 820 Features assumed to be supported by the final node. All transitive feature 821 dependencies must also be set properly. For a given feature bit pair, either 822 optional or remote may be set, but not both. If this field is nil or empty, 823 the router will try to load destination features from the graph as a 824 fallback. 825 */ 826 repeated FeatureBit dest_features = 16; 827 828 /* 829 The payment address of the generated invoice. 830 */ 831 bytes payment_addr = 17; 832 } 833 834 message SendResponse { 835 string payment_error = 1; 836 bytes payment_preimage = 2; 837 Route payment_route = 3; 838 bytes payment_hash = 4; 839 } 840 841 message SendToRouteRequest { 842 /* 843 The payment hash to use for the HTLC. When using REST, this field must be 844 encoded as base64. 845 */ 846 bytes payment_hash = 1; 847 848 /* 849 An optional hex-encoded payment hash to be used for the HTLC. Deprecated now 850 that the REST gateway supports base64 encoding of bytes fields. 851 */ 852 string payment_hash_string = 2 [deprecated = true]; 853 854 reserved 3; 855 856 // Route that should be used to attempt to complete the payment. 857 Route route = 4; 858 } 859 860 message ChannelAcceptRequest { 861 // The pubkey of the node that wishes to open an inbound channel. 862 bytes node_pubkey = 1; 863 864 // The hash of the genesis block that the proposed channel resides in. 865 bytes chain_hash = 2; 866 867 // The pending channel id. 868 bytes pending_chan_id = 3; 869 870 // The funding amount in satoshis that initiator wishes to use in the 871 // channel. 872 uint64 funding_amt = 4; 873 874 // The push amount of the proposed channel in millisatoshis. 875 uint64 push_amt = 5; 876 877 // The dust limit of the initiator's commitment tx. 878 uint64 dust_limit = 6; 879 880 // The maximum amount of coins in millisatoshis that can be pending in this 881 // channel. 882 uint64 max_value_in_flight = 7; 883 884 // The minimum amount of satoshis the initiator requires us to have at all 885 // times. 886 uint64 channel_reserve = 8; 887 888 // The smallest HTLC in millisatoshis that the initiator will accept. 889 uint64 min_htlc = 9; 890 891 // The initial fee rate that the initiator suggests for both commitment 892 // transactions. 893 uint64 fee_per_kb = 10; 894 895 /* 896 The number of blocks to use for the relative time lock in the pay-to-self 897 output of both commitment transactions. 898 */ 899 uint32 csv_delay = 11; 900 901 // The total number of incoming HTLC's that the initiator will accept. 902 uint32 max_accepted_htlcs = 12; 903 904 // A bit-field which the initiator uses to specify proposed channel 905 // behavior. 906 uint32 channel_flags = 13; 907 908 // The commitment type the initiator wishes to use for the proposed channel. 909 CommitmentType commitment_type = 14; 910 } 911 912 message ChannelAcceptResponse { 913 // Whether or not the client accepts the channel. 914 bool accept = 1; 915 916 // The pending channel id to which this response applies. 917 bytes pending_chan_id = 2; 918 919 /* 920 An optional error to send the initiating party to indicate why the channel 921 was rejected. This field *should not* contain sensitive information, it will 922 be sent to the initiating party. This field should only be set if accept is 923 false, the channel will be rejected if an error is set with accept=true 924 because the meaning of this response is ambiguous. Limited to 500 925 characters. 926 */ 927 string error = 3; 928 929 /* 930 The upfront shutdown address to use if the initiating peer supports option 931 upfront shutdown script (see ListPeers for the features supported). Note 932 that the channel open will fail if this value is set for a peer that does 933 not support this feature bit. 934 */ 935 string upfront_shutdown = 4; 936 937 /* 938 The csv delay (in blocks) that we require for the remote party. 939 */ 940 uint32 csv_delay = 5; 941 942 /* 943 The reserve amount in atoms that we require the remote peer to adhere to. 944 We require that the remote peer always have some reserve amount allocated to 945 them so that there is always a disincentive to broadcast old state (if they 946 hold 0 sats on their side of the channel, there is nothing to lose). 947 */ 948 uint64 reserve_atoms = 6; 949 950 /* 951 The maximum amount of funds in milliatoms that we allow the remote peer 952 to have in outstanding htlcs. 953 */ 954 uint64 in_flight_max_matoms = 7; 955 956 /* 957 The maximum number of htlcs that the remote peer can offer us. 958 */ 959 uint32 max_htlc_count = 8; 960 961 /* 962 The minimum value in milliatoms for incoming htlcs on the channel. 963 */ 964 uint64 min_htlc_in = 9; 965 966 /* 967 The number of confirmations we require before we consider the channel open. 968 */ 969 uint32 min_accept_depth = 10; 970 } 971 972 message ChannelPoint { 973 oneof funding_txid { 974 /* 975 Txid of the funding transaction. When using REST, this field must be 976 encoded as base64. 977 */ 978 bytes funding_txid_bytes = 1; 979 980 /* 981 Hex-encoded string representing the byte-reversed hash of the funding 982 transaction. 983 */ 984 string funding_txid_str = 2; 985 } 986 987 // The index of the output of the funding transaction 988 uint32 output_index = 3; 989 } 990 991 message OutPoint { 992 // Raw bytes representing the transaction id. 993 bytes txid_bytes = 1; 994 995 // Reversed, hex-encoded string representing the transaction id. 996 string txid_str = 2; 997 998 // The index of the output on the transaction. 999 uint32 output_index = 3; 1000 } 1001 1002 message LightningAddress { 1003 // The identity pubkey of the Lightning node 1004 string pubkey = 1; 1005 1006 // The network location of the lightning node, e.g. `69.69.69.69:1337` or 1007 // `localhost:10011` 1008 string host = 2; 1009 } 1010 1011 message EstimateFeeRequest { 1012 // The map from addresses to amounts for the transaction. 1013 map<string, int64> AddrToAmount = 1; 1014 1015 // The target number of blocks that this transaction should be confirmed 1016 // by. 1017 int32 target_conf = 2; 1018 1019 // The minimum number of confirmations each one of your outputs used for 1020 // the transaction must satisfy. 1021 int32 min_confs = 3; 1022 1023 // Whether unconfirmed outputs should be used as inputs for the transaction. 1024 bool spend_unconfirmed = 4; 1025 } 1026 1027 message EstimateFeeResponse { 1028 // The total fee in atoms. 1029 int64 fee_atoms = 1; 1030 1031 // The fee rate in atoms/byte. 1032 int64 feerate_atoms_per_byte = 2; 1033 1034 // Upstream, this is used for sat_per_vbyte. 1035 reserved 3; 1036 } 1037 1038 message SendManyRequest { 1039 // The map from addresses to amounts 1040 map<string, int64> AddrToAmount = 1; 1041 1042 // The target number of blocks that this transaction should be confirmed 1043 // by. 1044 int32 target_conf = 3; 1045 1046 // A manual fee rate set in atom/byte that should be used when crafting the 1047 // transaction. 1048 int64 atoms_per_byte = 5; 1049 1050 // An optional label for the transaction, limited to 500 characters. 1051 string label = 6; 1052 1053 // The account from which to send funds. If empty, funds are sent from the 1054 // default account. 1055 string account = 100; 1056 1057 // The minimum number of confirmations each one of your outputs used for 1058 // the transaction must satisfy. 1059 int32 min_confs = 7; 1060 1061 // Whether unconfirmed outputs should be used as inputs for the transaction. 1062 bool spend_unconfirmed = 8; 1063 } 1064 message SendManyResponse { 1065 // The id of the transaction 1066 string txid = 1; 1067 } 1068 1069 message SendCoinsRequest { 1070 // The address to send coins to 1071 string addr = 1; 1072 1073 // The amount in atoms to send 1074 int64 amount = 2; 1075 1076 // The target number of blocks that this transaction should be confirmed 1077 // by. 1078 int32 target_conf = 3; 1079 1080 // A manual fee rate set in atom/byte that should be used when crafting the 1081 // transaction. 1082 int64 atoms_per_byte = 5; 1083 1084 /* 1085 If set, then the amount field will be ignored, and lnd will attempt to 1086 send all the coins under control of the internal wallet to the specified 1087 address. 1088 */ 1089 bool send_all = 6; 1090 1091 // An optional label for the transaction, limited to 500 characters. 1092 string label = 7; 1093 1094 // The account from which to send funds. If empty, funds are sent from the 1095 // default account. 1096 string account = 100; 1097 1098 // The minimum number of confirmations each one of your outputs used for 1099 // the transaction must satisfy. 1100 int32 min_confs = 8; 1101 1102 // Whether unconfirmed outputs should be used as inputs for the transaction. 1103 bool spend_unconfirmed = 9; 1104 } 1105 message SendCoinsResponse { 1106 // The transaction ID of the transaction 1107 string txid = 1; 1108 } 1109 1110 message ListUnspentRequest { 1111 // The minimum number of confirmations to be included. 1112 int32 min_confs = 1; 1113 1114 // The maximum number of confirmations to be included. 1115 int32 max_confs = 2; 1116 1117 // An optional filter to only include outputs belonging to an account. 1118 string account = 3; 1119 } 1120 message ListUnspentResponse { 1121 // A list of utxos 1122 repeated Utxo utxos = 1; 1123 } 1124 1125 /* 1126 `AddressType` has to be one of: 1127 1128 - `p2wkh`: Pay to witness key hash (`WITNESS_PUBKEY_HASH` = 0) 1129 - `np2wkh`: Pay to nested witness key hash (`NESTED_PUBKEY_HASH` = 1) 1130 - `p2pkh`: Pay to pubkey hash (`PUBKEY_HASH` = 2) 1131 - `p2sh`: Pay to script hash (`SCRIPT_HASH` = 3) 1132 */ 1133 enum AddressType { 1134 WITNESS_PUBKEY_HASH = 0; 1135 NESTED_PUBKEY_HASH = 1; 1136 PUBKEY_HASH = 2; 1137 SCRIPT_HASH = 3; 1138 UNUSED_PUBKEY_HASH = 4; 1139 } 1140 1141 message NewAddressRequest { 1142 // The type of address to generate. 1143 AddressType type = 1; 1144 1145 /* 1146 The name of the account to generate a new address for. If empty, the 1147 default wallet account is used. 1148 */ 1149 string account = 2; 1150 } 1151 message NewAddressResponse { 1152 // The newly generated wallet address 1153 string address = 1; 1154 } 1155 1156 message SignMessageRequest { 1157 /* 1158 The message to be signed. When using REST, this field must be encoded as 1159 base64. 1160 */ 1161 bytes msg = 1; 1162 1163 /* 1164 Instead of the default double-SHA256 hashing of the message before signing, 1165 only use one round of hashing instead. 1166 */ 1167 bool single_hash = 2; 1168 } 1169 message SignMessageResponse { 1170 // The signature for the given message 1171 string signature = 1; 1172 } 1173 1174 message VerifyMessageRequest { 1175 /* 1176 The message over which the signature is to be verified. When using REST, 1177 this field must be encoded as base64. 1178 */ 1179 bytes msg = 1; 1180 1181 // The signature to be verified over the given message 1182 string signature = 2; 1183 } 1184 message VerifyMessageResponse { 1185 // Whether the signature was valid over the given message 1186 bool valid = 1; 1187 1188 // The pubkey recovered from the signature 1189 string pubkey = 2; 1190 } 1191 1192 message ConnectPeerRequest { 1193 // Lightning address of the peer, in the format `<pubkey>@host` 1194 LightningAddress addr = 1; 1195 1196 /* If set, the daemon will attempt to persistently connect to the target 1197 * peer. Otherwise, the call will be synchronous. */ 1198 bool perm = 2; 1199 1200 /* 1201 The connection timeout value (in seconds) for this request. It won't affect 1202 other requests. 1203 */ 1204 uint64 timeout = 3; 1205 } 1206 message ConnectPeerResponse { 1207 } 1208 1209 message DisconnectPeerRequest { 1210 // The pubkey of the node to disconnect from 1211 string pub_key = 1; 1212 } 1213 message DisconnectPeerResponse { 1214 } 1215 1216 message HTLC { 1217 bool incoming = 1; 1218 int64 amount = 2; 1219 bytes hash_lock = 3; 1220 uint32 expiration_height = 4; 1221 1222 // Index identifying the htlc on the channel. 1223 uint64 htlc_index = 5; 1224 1225 // If this HTLC is involved in a forwarding operation, this field indicates 1226 // the forwarding channel. For an outgoing htlc, it is the incoming channel. 1227 // For an incoming htlc, it is the outgoing channel. When the htlc 1228 // originates from this node or this node is the final destination, 1229 // forwarding_channel will be zero. The forwarding channel will also be zero 1230 // for htlcs that need to be forwarded but don't have a forwarding decision 1231 // persisted yet. 1232 uint64 forwarding_channel = 6; 1233 1234 // Index identifying the htlc on the forwarding channel. 1235 uint64 forwarding_htlc_index = 7; 1236 } 1237 1238 enum CommitmentType { 1239 /* 1240 Returned when the commitment type isn't known or unavailable. 1241 */ 1242 UNKNOWN_COMMITMENT_TYPE = 0; 1243 1244 /* 1245 A channel using the legacy commitment format having tweaked to_remote 1246 keys. 1247 */ 1248 LEGACY = 1; 1249 1250 /* 1251 A channel that uses the modern commitment format where the key in the 1252 output of the remote party does not change each state. This makes back 1253 up and recovery easier as when the channel is closed, the funds go 1254 directly to that key. 1255 */ 1256 STATIC_REMOTE_KEY = 2; 1257 1258 /* 1259 A channel that uses a commitment format that has anchor outputs on the 1260 commitments, allowing fee bumping after a force close transaction has 1261 been broadcast. 1262 */ 1263 ANCHORS = 3; 1264 1265 /* 1266 A channel that uses a commitment type that builds upon the anchors 1267 commitment format, but in addition requires a CLTV clause to spend outputs 1268 paying to the channel initiator. This is intended for use on leased channels 1269 to guarantee that the channel initiator has no incentives to close a leased 1270 channel before its maturity date. 1271 */ 1272 SCRIPT_ENFORCED_LEASE = 4; 1273 } 1274 1275 message ChannelConstraints { 1276 /* 1277 The CSV delay expressed in relative blocks. If the channel is force closed, 1278 we will need to wait for this many blocks before we can regain our funds. 1279 */ 1280 uint32 csv_delay = 1; 1281 1282 // The minimum atoms this node is required to reserve in its balance. 1283 uint64 chan_reserve_atoms = 2; 1284 1285 // The dust limit (in satoshis) of the initiator's commitment tx. 1286 uint64 dust_limit_atoms = 3; 1287 1288 // The maximum amount of coins in milliatoms that can be pending in this 1289 // channel. 1290 uint64 max_pending_amt_m_atoms = 4; 1291 1292 // The smallest HTLC in milliatoms that the initiator will accept. 1293 uint64 min_htlc_m_atoms = 5; 1294 1295 // The total number of incoming HTLC's that the initiator will accept. 1296 uint32 max_accepted_htlcs = 6; 1297 } 1298 1299 message Channel { 1300 // Whether this channel is active or not 1301 bool active = 1; 1302 1303 // The identity pubkey of the remote node 1304 string remote_pubkey = 2; 1305 1306 /* 1307 The outpoint (txid:index) of the funding transaction. With this value, Bob 1308 will be able to generate a signature for Alice's version of the commitment 1309 transaction. 1310 */ 1311 string channel_point = 3; 1312 1313 /* 1314 The unique channel ID for the channel. The first 3 bytes are the block 1315 height, the next 3 the index within the block, and the last 2 bytes are the 1316 output index for the channel. 1317 */ 1318 uint64 chan_id = 4 [jstype = JS_STRING]; 1319 1320 // The total amount of funds held in this channel 1321 int64 capacity = 5; 1322 1323 // This node's current balance in this channel 1324 int64 local_balance = 6; 1325 1326 // The counterparty's current balance in this channel 1327 int64 remote_balance = 7; 1328 1329 /* 1330 The amount calculated to be paid in fees for the current set of commitment 1331 transactions. The fee amount is persisted with the channel in order to 1332 allow the fee amount to be removed and recalculated with each channel state 1333 update, including updates that happen after a system restart. 1334 */ 1335 int64 commit_fee = 8; 1336 1337 // The size of the commitment transaction 1338 int64 commit_size = 9; 1339 1340 /* 1341 The required number of atoms per kilobyte that the requester will pay 1342 at all times, for both the funding transaction and commitment transaction. 1343 This value can later be updated once the channel is open. 1344 */ 1345 int64 fee_per_kb = 10; 1346 1347 // The unsettled balance in this channel 1348 int64 unsettled_balance = 11; 1349 1350 /* 1351 The total number of atoms we've sent within this channel. 1352 */ 1353 int64 total_atoms_sent = 12; 1354 1355 /* 1356 The total number of atoms we've received within this channel. 1357 */ 1358 int64 total_atoms_received = 13; 1359 1360 /* 1361 The total number of updates conducted within this channel. 1362 */ 1363 uint64 num_updates = 14; 1364 1365 /* 1366 The list of active, uncleared HTLCs currently pending within the channel. 1367 */ 1368 repeated HTLC pending_htlcs = 15; 1369 1370 /* 1371 Deprecated. The CSV delay expressed in relative blocks. If the channel is 1372 force closed, we will need to wait for this many blocks before we can regain 1373 our funds. 1374 */ 1375 uint32 csv_delay = 16 [deprecated = true]; 1376 1377 // Whether this channel is advertised to the network or not. 1378 bool private = 17; 1379 1380 // True if we were the ones that created the channel. 1381 bool initiator = 18; 1382 1383 // A set of flags showing the current state of the channel. 1384 string chan_status_flags = 19; 1385 1386 // The minimum atoms this node is required to reserve in its balance. 1387 int64 local_chan_reserve_atoms = 20 [deprecated = true]; 1388 1389 /* 1390 The minimum atoms the other node is required to reserve in its balance. 1391 */ 1392 int64 remote_chan_reserve_atoms = 21 [deprecated = true]; 1393 1394 // Deprecated. Use commitment_type. 1395 bool static_remote_key = 22 [deprecated = true]; 1396 1397 // The commitment type used by this channel. 1398 CommitmentType commitment_type = 26; 1399 1400 /* 1401 The total amount of time the remote peer has been online while NOT sending 1402 a ChannelReestablish message. 1403 */ 1404 int64 chan_reestablish_wait_time_ms = 900; 1405 1406 /* 1407 The short channel id represented as a string, to ease log parsing. This is 1408 the same as chan_id, but returned directly in the string representation. 1409 */ 1410 string short_chan_id = 901; 1411 1412 /* 1413 The number of seconds that the channel has been monitored by the channel 1414 scoring system. Scores are currently not persisted, so this value may be 1415 less than the lifetime of the channel [EXPERIMENTAL]. 1416 */ 1417 int64 lifetime = 23; 1418 1419 /* 1420 The number of seconds that the remote peer has been observed as being online 1421 by the channel scoring system over the lifetime of the channel 1422 [EXPERIMENTAL]. 1423 */ 1424 int64 uptime = 24; 1425 1426 /* 1427 Close address is the address that we will enforce payout to on cooperative 1428 close if the channel was opened utilizing option upfront shutdown. This 1429 value can be set on channel open by setting close_address in an open channel 1430 request. If this value is not set, you can still choose a payout address by 1431 cooperatively closing with the delivery_address field set. 1432 */ 1433 string close_address = 25; 1434 1435 /* 1436 The amount that the initiator of the channel optionally pushed to the remote 1437 party on channel open. This amount will be zero if the channel initiator did 1438 not push any funds to the remote peer. If the initiator field is true, we 1439 pushed this amount to our peer, if it is false, the remote peer pushed this 1440 amount to us. 1441 */ 1442 uint64 push_amount_atoms = 27; 1443 1444 /* 1445 This uint32 indicates if this channel is to be considered 'frozen'. A 1446 frozen channel doest not allow a cooperative channel close by the 1447 initiator. The thaw_height is the height that this restriction stops 1448 applying to the channel. This field is optional, not setting it or using a 1449 value of zero will mean the channel has no additional restrictions. The 1450 height can be interpreted in two ways: as a relative height if the value is 1451 less than 500,000, or as an absolute height otherwise. 1452 */ 1453 uint32 thaw_height = 28; 1454 1455 // List constraints for the local node. 1456 ChannelConstraints local_constraints = 29; 1457 1458 // List constraints for the remote node. 1459 ChannelConstraints remote_constraints = 30; 1460 } 1461 1462 message ListChannelsRequest { 1463 bool active_only = 1; 1464 bool inactive_only = 2; 1465 bool public_only = 3; 1466 bool private_only = 4; 1467 1468 /* 1469 Filters the response for channels with a target peer's pubkey. If peer is 1470 empty, all channels will be returned. 1471 */ 1472 bytes peer = 5; 1473 } 1474 message ListChannelsResponse { 1475 // The list of active channels 1476 repeated Channel channels = 11; 1477 } 1478 1479 enum Initiator { 1480 INITIATOR_UNKNOWN = 0; 1481 INITIATOR_LOCAL = 1; 1482 INITIATOR_REMOTE = 2; 1483 INITIATOR_BOTH = 3; 1484 } 1485 1486 message ChannelCloseSummary { 1487 // The outpoint (txid:index) of the funding transaction. 1488 string channel_point = 1; 1489 1490 /* 1491 The short channel id represented as a string, to ease log parsing. This is 1492 the same as chan_id, but returned directly in the string representation. 1493 */ 1494 string short_chan_id = 900; 1495 1496 // The unique channel ID for the channel. 1497 uint64 chan_id = 2 [jstype = JS_STRING]; 1498 1499 // The hash of the genesis block that this channel resides within. 1500 string chain_hash = 3; 1501 1502 // The txid of the transaction which ultimately closed this channel. 1503 string closing_tx_hash = 4; 1504 1505 // Public key of the remote peer that we formerly had a channel with. 1506 string remote_pubkey = 5; 1507 1508 // Total capacity of the channel. 1509 int64 capacity = 6; 1510 1511 // Height at which the funding transaction was spent. 1512 uint32 close_height = 7; 1513 1514 // Settled balance at the time of channel closure 1515 int64 settled_balance = 8; 1516 1517 // The sum of all the time-locked outputs at the time of channel closure 1518 int64 time_locked_balance = 9; 1519 1520 enum ClosureType { 1521 COOPERATIVE_CLOSE = 0; 1522 LOCAL_FORCE_CLOSE = 1; 1523 REMOTE_FORCE_CLOSE = 2; 1524 BREACH_CLOSE = 3; 1525 FUNDING_CANCELED = 4; 1526 ABANDONED = 5; 1527 } 1528 1529 // Details on how the channel was closed. 1530 ClosureType close_type = 10; 1531 1532 /* 1533 Open initiator is the party that initiated opening the channel. Note that 1534 this value may be unknown if the channel was closed before we migrated to 1535 store open channel information after close. 1536 */ 1537 Initiator open_initiator = 11; 1538 1539 /* 1540 Close initiator indicates which party initiated the close. This value will 1541 be unknown for channels that were cooperatively closed before we started 1542 tracking cooperative close initiators. Note that this indicates which party 1543 initiated a close, and it is possible for both to initiate cooperative or 1544 force closes, although only one party's close will be confirmed on chain. 1545 */ 1546 Initiator close_initiator = 12; 1547 1548 repeated Resolution resolutions = 13; 1549 } 1550 1551 enum ResolutionType { 1552 TYPE_UNKNOWN = 0; 1553 1554 // We resolved an anchor output. 1555 ANCHOR = 1; 1556 1557 /* 1558 We are resolving an incoming htlc on chain. This if this htlc is 1559 claimed, we swept the incoming htlc with the preimage. If it is timed 1560 out, our peer swept the timeout path. 1561 */ 1562 INCOMING_HTLC = 2; 1563 1564 /* 1565 We are resolving an outgoing htlc on chain. If this htlc is claimed, 1566 the remote party swept the htlc with the preimage. If it is timed out, 1567 we swept it with the timeout path. 1568 */ 1569 OUTGOING_HTLC = 3; 1570 1571 // We force closed and need to sweep our time locked commitment output. 1572 COMMIT = 4; 1573 } 1574 1575 enum ResolutionOutcome { 1576 // Outcome unknown. 1577 OUTCOME_UNKNOWN = 0; 1578 1579 // An output was claimed on chain. 1580 CLAIMED = 1; 1581 1582 // An output was left unclaimed on chain. 1583 UNCLAIMED = 2; 1584 1585 /* 1586 ResolverOutcomeAbandoned indicates that an output that we did not 1587 claim on chain, for example an anchor that we did not sweep and a 1588 third party claimed on chain, or a htlc that we could not decode 1589 so left unclaimed. 1590 */ 1591 ABANDONED = 3; 1592 1593 /* 1594 If we force closed our channel, our htlcs need to be claimed in two 1595 stages. This outcome represents the broadcast of a timeout or success 1596 transaction for this two stage htlc claim. 1597 */ 1598 FIRST_STAGE = 4; 1599 1600 // A htlc was timed out on chain. 1601 TIMEOUT = 5; 1602 } 1603 1604 message Resolution { 1605 // The type of output we are resolving. 1606 ResolutionType resolution_type = 1; 1607 1608 // The outcome of our on chain action that resolved the outpoint. 1609 ResolutionOutcome outcome = 2; 1610 1611 // The outpoint that was spent by the resolution. 1612 OutPoint outpoint = 3; 1613 1614 // The amount that was claimed by the resolution. 1615 uint64 amount_atoms = 4; 1616 1617 // The hex-encoded transaction ID of the sweep transaction that spent the 1618 // output. 1619 string sweep_txid = 5; 1620 } 1621 1622 message ClosedChannelsRequest { 1623 bool cooperative = 1; 1624 bool local_force = 2; 1625 bool remote_force = 3; 1626 bool breach = 4; 1627 bool funding_canceled = 5; 1628 bool abandoned = 6; 1629 } 1630 1631 message ClosedChannelsResponse { 1632 repeated ChannelCloseSummary channels = 1; 1633 } 1634 1635 message Peer { 1636 // The identity pubkey of the peer 1637 string pub_key = 1; 1638 1639 // Network address of the peer; eg `127.0.0.1:10011` 1640 string address = 3; 1641 1642 // Bytes of data transmitted to this peer 1643 uint64 bytes_sent = 4; 1644 1645 // Bytes of data transmitted from this peer 1646 uint64 bytes_recv = 5; 1647 1648 // Atoms sent to this peer 1649 int64 atoms_sent = 6; 1650 1651 // Atoms received from this peer 1652 int64 atoms_recv = 7; 1653 1654 // A channel is inbound if the counterparty initiated the channel 1655 bool inbound = 8; 1656 1657 // Ping time to this peer 1658 int64 ping_time = 9; 1659 1660 enum SyncType { 1661 /* 1662 Denotes that we cannot determine the peer's current sync type. 1663 */ 1664 UNKNOWN_SYNC = 0; 1665 1666 /* 1667 Denotes that we are actively receiving new graph updates from the peer. 1668 */ 1669 ACTIVE_SYNC = 1; 1670 1671 /* 1672 Denotes that we are not receiving new graph updates from the peer. 1673 */ 1674 PASSIVE_SYNC = 2; 1675 1676 /* 1677 Denotes that this peer is pinned into an active sync. 1678 */ 1679 PINNED_SYNC = 3; 1680 } 1681 1682 // The type of sync we are currently performing with this peer. 1683 SyncType sync_type = 10; 1684 1685 // Features advertised by the remote peer in their init message. 1686 map<uint32, Feature> features = 11; 1687 1688 /* 1689 The latest errors received from our peer with timestamps, limited to the 10 1690 most recent errors. These errors are tracked across peer connections, but 1691 are not persisted across lnd restarts. Note that these errors are only 1692 stored for peers that we have channels open with, to prevent peers from 1693 spamming us with errors at no cost. 1694 */ 1695 repeated TimestampedError errors = 12; 1696 1697 /* 1698 The number of times we have recorded this peer going offline or coming 1699 online, recorded across restarts. Note that this value is decreased over 1700 time if the peer has not recently flapped, so that we can forgive peers 1701 with historically high flap counts. 1702 */ 1703 int32 flap_count = 13; 1704 1705 /* 1706 The timestamp of the last flap we observed for this peer. If this value is 1707 zero, we have not observed any flaps for this peer. 1708 */ 1709 int64 last_flap_ns = 14; 1710 1711 /* 1712 The last ping payload the peer has sent to us. 1713 */ 1714 bytes last_ping_payload = 15; 1715 } 1716 1717 message TimestampedError { 1718 // The unix timestamp in seconds when the error occurred. 1719 uint64 timestamp = 1; 1720 1721 // The string representation of the error sent by our peer. 1722 string error = 2; 1723 } 1724 1725 message ListPeersRequest { 1726 /* 1727 If true, only the last error that our peer sent us will be returned with 1728 the peer's information, rather than the full set of historic errors we have 1729 stored. 1730 */ 1731 bool latest_error = 1; 1732 } 1733 message ListPeersResponse { 1734 // The list of currently connected peers 1735 repeated Peer peers = 1; 1736 } 1737 1738 message PeerEventSubscription { 1739 } 1740 1741 message PeerEvent { 1742 // The identity pubkey of the peer. 1743 string pub_key = 1; 1744 1745 enum EventType { 1746 PEER_ONLINE = 0; 1747 PEER_OFFLINE = 1; 1748 } 1749 1750 EventType type = 2; 1751 } 1752 1753 message GetInfoRequest { 1754 } 1755 message GetInfoResponse { 1756 // The version of the LND software that the node is running. 1757 string version = 14; 1758 1759 // The SHA1 commit hash that the daemon is compiled with. 1760 string commit_hash = 20; 1761 1762 // The identity pubkey of the current node. 1763 string identity_pubkey = 1; 1764 1765 // If applicable, the alias of the current node, e.g. "bob" 1766 string alias = 2; 1767 1768 // The color of the current node in hex code format 1769 string color = 17; 1770 1771 // Number of pending channels 1772 uint32 num_pending_channels = 3; 1773 1774 // Number of active channels 1775 uint32 num_active_channels = 4; 1776 1777 // Number of inactive channels 1778 uint32 num_inactive_channels = 15; 1779 1780 // Number of peers 1781 uint32 num_peers = 5; 1782 1783 // The node's current view of the height of the best block 1784 uint32 block_height = 6; 1785 1786 // The node's current view of the hash of the best block 1787 string block_hash = 8; 1788 1789 // Timestamp of the block best known to the wallet 1790 int64 best_header_timestamp = 13; 1791 1792 // Whether the wallet's view is synced to the main chain 1793 bool synced_to_chain = 9; 1794 1795 // Whether we consider ourselves synced with the public channel graph. 1796 bool synced_to_graph = 18; 1797 1798 /* 1799 Whether the current node is connected to testnet. This field is 1800 deprecated and the network field should be used instead 1801 **/ 1802 bool testnet = 10 [deprecated = true]; 1803 1804 reserved 11; 1805 1806 // A list of active chains the node is connected to 1807 repeated Chain chains = 16; 1808 1809 // The URIs of the current node. 1810 repeated string uris = 12; 1811 1812 /* 1813 Features that our node has advertised in our init message, node 1814 announcements and invoices. 1815 */ 1816 map<uint32, Feature> features = 19; 1817 1818 /* 1819 Whether all server sub-processes have started and the node is ready to be 1820 used. 1821 **/ 1822 bool server_active = 901 [json_name = "server_active"]; 1823 1824 /* 1825 Target height of the channel router startup graph pruning process. 1826 */ 1827 uint32 router_prune_target = 902; 1828 1829 /* 1830 Last checked height of the channel router startup graph pruning process. 1831 */ 1832 uint32 router_prune_height = 903; 1833 } 1834 1835 message GetRecoveryInfoRequest { 1836 } 1837 message GetRecoveryInfoResponse { 1838 // Whether the wallet is in recovery mode 1839 bool recovery_mode = 1; 1840 1841 // Whether the wallet recovery progress is finished 1842 bool recovery_finished = 2; 1843 1844 // The recovery progress, ranging from 0 to 1. 1845 double progress = 3; 1846 } 1847 1848 message Chain { 1849 // The blockchain the node is on (eg decred) 1850 string chain = 1; 1851 1852 // The network the node is on (eg regtest, testnet, mainnet) 1853 string network = 2; 1854 } 1855 1856 message ConfirmationUpdate { 1857 bytes block_sha = 1; 1858 int32 block_height = 2; 1859 1860 uint32 num_confs_left = 3; 1861 } 1862 1863 message ChannelOpenUpdate { 1864 ChannelPoint channel_point = 1; 1865 } 1866 1867 message ChannelCloseUpdate { 1868 bytes closing_txid = 1; 1869 1870 bool success = 2; 1871 } 1872 1873 message CloseChannelRequest { 1874 /* 1875 The outpoint (txid:index) of the funding transaction. With this value, Bob 1876 will be able to generate a signature for Alice's version of the commitment 1877 transaction. 1878 */ 1879 ChannelPoint channel_point = 1; 1880 1881 // If true, then the channel will be closed forcibly. This means the 1882 // current commitment transaction will be signed and broadcast. 1883 bool force = 2; 1884 1885 // The target number of blocks that the closure transaction should be 1886 // confirmed by. 1887 int32 target_conf = 3; 1888 1889 // A manual fee rate set in atom/byte that should be used when crafting the 1890 // closure transaction. 1891 int64 atoms_per_byte = 4; 1892 1893 /* 1894 An optional address to send funds to in the case of a cooperative close. 1895 If the channel was opened with an upfront shutdown script and this field 1896 is set, the request to close will fail because the channel must pay out 1897 to the upfront shutdown addresss. 1898 */ 1899 string delivery_address = 5; 1900 1901 // Upstream, this is used for the sat_per_vbyte field. 1902 reserved 6; 1903 } 1904 1905 message CloseStatusUpdate { 1906 oneof update { 1907 PendingUpdate close_pending = 1; 1908 ChannelCloseUpdate chan_close = 3; 1909 } 1910 } 1911 1912 message PendingUpdate { 1913 bytes txid = 1; 1914 uint32 output_index = 2; 1915 } 1916 1917 message ReadyForPsbtFunding { 1918 /* 1919 The P2WSH address of the channel funding multisig address that the below 1920 specified amount in satoshis needs to be sent to. 1921 */ 1922 string funding_address = 1; 1923 1924 /* 1925 The exact amount in satoshis that needs to be sent to the above address to 1926 fund the pending channel. 1927 */ 1928 int64 funding_amount = 2; 1929 1930 /* 1931 A raw PSBT that contains the pending channel output. If a base PSBT was 1932 provided in the PsbtShim, this is the base PSBT with one additional output. 1933 If no base PSBT was specified, this is an otherwise empty PSBT with exactly 1934 one output. 1935 */ 1936 bytes psbt = 3; 1937 } 1938 1939 message BatchOpenChannelRequest { 1940 // The list of channels to open. 1941 repeated BatchOpenChannel channels = 1; 1942 1943 // The target number of blocks that the funding transaction should be 1944 // confirmed by. 1945 int32 target_conf = 2; 1946 1947 // A manual fee rate set in atoms/Byte that should be used when crafting the 1948 // funding transaction. 1949 int64 atoms_per_byte = 3; 1950 1951 // The minimum number of confirmations each one of your outputs used for 1952 // the funding transaction must satisfy. 1953 int32 min_confs = 4; 1954 1955 // Whether unconfirmed outputs should be used as inputs for the funding 1956 // transaction. 1957 bool spend_unconfirmed = 5; 1958 1959 // An optional label for the batch transaction, limited to 500 characters. 1960 string label = 6; 1961 } 1962 1963 message BatchOpenChannel { 1964 // The pubkey of the node to open a channel with. When using REST, this 1965 // field must be encoded as base64. 1966 bytes node_pubkey = 1; 1967 1968 // The number of satoshis the wallet should commit to the channel. 1969 int64 local_funding_amount = 2; 1970 1971 // The number of atoms to push to the remote side as part of the initial 1972 // commitment state. 1973 int64 push_atoms = 3; 1974 1975 // Whether this channel should be private, not announced to the greater 1976 // network. 1977 bool private = 4; 1978 1979 // The minimum value in milliatoms we will require for incoming HTLCs on 1980 // the channel. 1981 int64 min_htlc_m_atoms = 5; 1982 1983 // The delay we require on the remote's commitment transaction. If this is 1984 // not set, it will be scaled automatically with the channel size. 1985 uint32 remote_csv_delay = 6; 1986 1987 /* 1988 Close address is an optional address which specifies the address to which 1989 funds should be paid out to upon cooperative close. This field may only be 1990 set if the peer supports the option upfront feature bit (call listpeers 1991 to check). The remote peer will only accept cooperative closes to this 1992 address if it is set. 1993 1994 Note: If this value is set on channel creation, you will *not* be able to 1995 cooperatively close out to a different address. 1996 */ 1997 string close_address = 7; 1998 1999 /* 2000 An optional, unique identifier of 32 random bytes that will be used as the 2001 pending channel ID to identify the channel while it is in the pre-pending 2002 state. 2003 */ 2004 bytes pending_chan_id = 8; 2005 2006 /* 2007 The explicit commitment type to use. Note this field will only be used if 2008 the remote peer supports explicit channel negotiation. 2009 */ 2010 CommitmentType commitment_type = 9; 2011 } 2012 2013 message BatchOpenChannelResponse { 2014 repeated PendingUpdate pending_channels = 1; 2015 } 2016 2017 message OpenChannelRequest { 2018 // Upstream, this is used for the sat_per_vbyte field. 2019 reserved 1; 2020 2021 /* 2022 The pubkey of the node to open a channel with. When using REST, this field 2023 must be encoded as base64. 2024 */ 2025 bytes node_pubkey = 2; 2026 2027 /* 2028 The hex encoded pubkey of the node to open a channel with. Deprecated now 2029 that the REST gateway supports base64 encoding of bytes fields. 2030 */ 2031 string node_pubkey_string = 3 [deprecated = true]; 2032 2033 // The number of atoms the wallet should commit to the channel 2034 int64 local_funding_amount = 4; 2035 2036 // The number of atoms to push to the remote side as part of the initial 2037 // commitment state 2038 int64 push_atoms = 5; 2039 2040 // The target number of blocks that the funding transaction should be 2041 // confirmed by. 2042 int32 target_conf = 6; 2043 2044 // A manual fee rate set in atom/byte that should be used when crafting the 2045 // funding transaction. 2046 int64 atoms_per_byte = 7; 2047 2048 // Whether this channel should be private, not announced to the greater 2049 // network. 2050 bool private = 8; 2051 2052 // The minimum value in MilliAtom we will require for incoming HTLCs on the 2053 // channel. 2054 int64 min_htlc_m_atoms = 9; 2055 2056 // The delay we require on the remote's commitment transaction. If this is 2057 // not set, it will be scaled automatically with the channel size. 2058 uint32 remote_csv_delay = 10; 2059 2060 // The minimum number of confirmations each one of your outputs used for 2061 // the funding transaction must satisfy. 2062 int32 min_confs = 11; 2063 2064 // Whether unconfirmed outputs should be used as inputs for the funding 2065 // transaction. 2066 bool spend_unconfirmed = 12; 2067 2068 /* 2069 Close address is an optional address which specifies the address to which 2070 funds should be paid out to upon cooperative close. This field may only be 2071 set if the peer supports the option upfront feature bit (call listpeers 2072 to check). The remote peer will only accept cooperative closes to this 2073 address if it is set. 2074 2075 Note: If this value is set on channel creation, you will *not* be able to 2076 cooperatively close out to a different address. 2077 */ 2078 string close_address = 13; 2079 2080 /* 2081 Funding shims are an optional argument that allow the caller to intercept 2082 certain funding functionality. For example, a shim can be provided to use a 2083 particular key for the commitment key (ideally cold) rather than use one 2084 that is generated by the wallet as normal, or signal that signing will be 2085 carried out in an interactive manner (PSBT based). 2086 */ 2087 FundingShim funding_shim = 14; 2088 2089 /* 2090 The maximum amount of coins in milliatoms that can be pending within 2091 the channel. It only applies to the remote party. 2092 */ 2093 uint64 remote_max_value_in_flight_m_atoms = 15; 2094 2095 /* 2096 The maximum number of concurrent HTLCs we will allow the remote party to add 2097 to the commitment transaction. 2098 */ 2099 uint32 remote_max_htlcs = 16; 2100 2101 /* 2102 Max local csv is the maximum csv delay we will allow for our own commitment 2103 transaction. 2104 */ 2105 uint32 max_local_csv = 17; 2106 2107 /* 2108 The explicit commitment type to use. Note this field will only be used if 2109 the remote peer supports explicit channel negotiation. 2110 */ 2111 CommitmentType commitment_type = 18; 2112 } 2113 message OpenStatusUpdate { 2114 oneof update { 2115 /* 2116 Signals that the channel is now fully negotiated and the funding 2117 transaction published. 2118 */ 2119 PendingUpdate chan_pending = 1; 2120 2121 /* 2122 Signals that the channel's funding transaction has now reached the 2123 required number of confirmations on chain and can be used. 2124 */ 2125 ChannelOpenUpdate chan_open = 3; 2126 2127 /* 2128 Signals that the funding process has been suspended and the construction 2129 of a PSBT that funds the channel PK script is now required. 2130 */ 2131 ReadyForPsbtFunding psbt_fund = 5; 2132 } 2133 2134 /* 2135 The pending channel ID of the created channel. This value may be used to 2136 further the funding flow manually via the FundingStateStep method. 2137 */ 2138 bytes pending_chan_id = 4; 2139 } 2140 2141 message KeyLocator { 2142 // The family of key being identified. 2143 int32 key_family = 1; 2144 2145 // The precise index of the key being identified. 2146 int32 key_index = 2; 2147 } 2148 2149 message KeyDescriptor { 2150 /* 2151 The raw bytes of the key being identified. 2152 */ 2153 bytes raw_key_bytes = 1; 2154 2155 /* 2156 The key locator that identifies which key to use for signing. 2157 */ 2158 KeyLocator key_loc = 2; 2159 } 2160 2161 message ChanPointShim { 2162 /* 2163 The size of the pre-crafted output to be used as the channel point for this 2164 channel funding. 2165 */ 2166 int64 amt = 1; 2167 2168 // The target channel point to refrence in created commitment transactions. 2169 ChannelPoint chan_point = 2; 2170 2171 // Our local key to use when creating the multi-sig output. 2172 KeyDescriptor local_key = 3; 2173 2174 // The key of the remote party to use when creating the multi-sig output. 2175 bytes remote_key = 4; 2176 2177 /* 2178 If non-zero, then this will be used as the pending channel ID on the wire 2179 protocol to initate the funding request. This is an optional field, and 2180 should only be set if the responder is already expecting a specific pending 2181 channel ID. 2182 */ 2183 bytes pending_chan_id = 5; 2184 2185 /* 2186 This uint32 indicates if this channel is to be considered 'frozen'. A frozen 2187 channel does not allow a cooperative channel close by the initiator. The 2188 thaw_height is the height that this restriction stops applying to the 2189 channel. The height can be interpreted in two ways: as a relative height if 2190 the value is less than 500,000, or as an absolute height otherwise. 2191 */ 2192 uint32 thaw_height = 6; 2193 } 2194 2195 message PsbtShim { 2196 /* 2197 A unique identifier of 32 random bytes that will be used as the pending 2198 channel ID to identify the PSBT state machine when interacting with it and 2199 on the wire protocol to initiate the funding request. 2200 */ 2201 bytes pending_chan_id = 1; 2202 2203 /* 2204 An optional base PSBT the new channel output will be added to. If this is 2205 non-empty, it must be a binary serialized PSBT. 2206 */ 2207 bytes base_psbt = 2; 2208 2209 /* 2210 If a channel should be part of a batch (multiple channel openings in one 2211 transaction), it can be dangerous if the whole batch transaction is 2212 published too early before all channel opening negotiations are completed. 2213 This flag prevents this particular channel from broadcasting the transaction 2214 after the negotiation with the remote peer. In a batch of channel openings 2215 this flag should be set to true for every channel but the very last. 2216 */ 2217 bool no_publish = 3; 2218 } 2219 2220 message FundingShim { 2221 oneof shim { 2222 /* 2223 A channel shim where the channel point was fully constructed outside 2224 of lnd's wallet and the transaction might already be published. 2225 */ 2226 ChanPointShim chan_point_shim = 1; 2227 2228 /* 2229 A channel shim that uses a PSBT to fund and sign the channel funding 2230 transaction. 2231 */ 2232 PsbtShim psbt_shim = 2; 2233 } 2234 } 2235 2236 message FundingShimCancel { 2237 // The pending channel ID of the channel to cancel the funding shim for. 2238 bytes pending_chan_id = 1; 2239 } 2240 2241 message FundingPsbtVerify { 2242 /* 2243 The funded but not yet signed PSBT that sends the exact channel capacity 2244 amount to the PK script returned in the open channel message in a previous 2245 step. 2246 */ 2247 bytes funded_psbt = 1; 2248 2249 // The pending channel ID of the channel to get the PSBT for. 2250 bytes pending_chan_id = 2; 2251 2252 /* 2253 Can only be used if the no_publish flag was set to true in the OpenChannel 2254 call meaning that the caller is solely responsible for publishing the final 2255 funding transaction. If skip_finalize is set to true then lnd will not wait 2256 for a FundingPsbtFinalize state step and instead assumes that a transaction 2257 with the same TXID as the passed in PSBT will eventually confirm. 2258 IT IS ABSOLUTELY IMPERATIVE that the TXID of the transaction that is 2259 eventually published does have the _same TXID_ as the verified PSBT. That 2260 means no inputs or outputs can change, only signatures can be added. If the 2261 TXID changes between this call and the publish step then the channel will 2262 never be created and the funds will be in limbo. 2263 */ 2264 bool skip_finalize = 3; 2265 } 2266 2267 message FundingPsbtFinalize { 2268 /* 2269 The funded PSBT that contains all witness data to send the exact channel 2270 capacity amount to the PK script returned in the open channel message in a 2271 previous step. Cannot be set at the same time as final_raw_tx. 2272 */ 2273 bytes signed_psbt = 1; 2274 2275 // The pending channel ID of the channel to get the PSBT for. 2276 bytes pending_chan_id = 2; 2277 2278 /* 2279 As an alternative to the signed PSBT with all witness data, the final raw 2280 wire format transaction can also be specified directly. Cannot be set at the 2281 same time as signed_psbt. 2282 */ 2283 bytes final_raw_tx = 3; 2284 } 2285 2286 message FundingTransitionMsg { 2287 oneof trigger { 2288 /* 2289 The funding shim to register. This should be used before any 2290 channel funding has began by the remote party, as it is intended as a 2291 preparatory step for the full channel funding. 2292 */ 2293 FundingShim shim_register = 1; 2294 2295 // Used to cancel an existing registered funding shim. 2296 FundingShimCancel shim_cancel = 2; 2297 2298 /* 2299 Used to continue a funding flow that was initiated to be executed 2300 through a PSBT. This step verifies that the PSBT contains the correct 2301 outputs to fund the channel. 2302 */ 2303 FundingPsbtVerify psbt_verify = 3; 2304 2305 /* 2306 Used to continue a funding flow that was initiated to be executed 2307 through a PSBT. This step finalizes the funded and signed PSBT, finishes 2308 negotiation with the peer and finally publishes the resulting funding 2309 transaction. 2310 */ 2311 FundingPsbtFinalize psbt_finalize = 4; 2312 } 2313 } 2314 2315 message FundingStateStepResp { 2316 } 2317 2318 message PendingHTLC { 2319 // The direction within the channel that the htlc was sent 2320 bool incoming = 1; 2321 2322 // The total value of the htlc 2323 int64 amount = 2; 2324 2325 // The final output to be swept back to the user's wallet 2326 string outpoint = 3; 2327 2328 // The next block height at which we can spend the current stage 2329 uint32 maturity_height = 4; 2330 2331 /* 2332 The number of blocks remaining until the current stage can be swept. 2333 Negative values indicate how many blocks have passed since becoming 2334 mature. 2335 */ 2336 int32 blocks_til_maturity = 5; 2337 2338 // Indicates whether the htlc is in its first or second stage of recovery 2339 uint32 stage = 6; 2340 } 2341 2342 message PendingChannelsRequest { 2343 } 2344 message PendingChannelsResponse { 2345 message PendingChannel { 2346 string remote_node_pub = 1; 2347 string channel_point = 2; 2348 2349 /* 2350 The short channel id represented as a string, to ease log parsing. This is 2351 the same as chan_id, but returned directly in the string representation. 2352 */ 2353 string short_chan_id = 900; 2354 2355 int64 capacity = 3; 2356 2357 int64 local_balance = 4; 2358 int64 remote_balance = 5; 2359 2360 // The minimum atoms this node is required to reserve in its balance. 2361 int64 local_chan_reserve_atoms = 6; 2362 2363 /* 2364 The minimum atoms the other node is required to reserve in its 2365 balance. 2366 */ 2367 int64 remote_chan_reserve_atoms = 7; 2368 2369 // The party that initiated opening the channel. 2370 Initiator initiator = 8; 2371 2372 // The commitment type used by this channel. 2373 CommitmentType commitment_type = 9; 2374 2375 // Total number of forwarding packages created in this channel. 2376 int64 num_forwarding_packages = 10; 2377 2378 // A set of flags showing the current state of the channel. 2379 string chan_status_flags = 11; 2380 } 2381 2382 message PendingOpenChannel { 2383 // The pending channel 2384 PendingChannel channel = 1; 2385 2386 // The height at which this channel will be confirmed 2387 uint32 confirmation_height = 2; 2388 2389 /* 2390 The amount calculated to be paid in fees for the current set of 2391 commitment transactions. The fee amount is persisted with the channel 2392 in order to allow the fee amount to be removed and recalculated with 2393 each channel state update, including updates that happen after a system 2394 restart. 2395 */ 2396 int64 commit_fee = 4; 2397 2398 // The size of the commitment transaction 2399 int64 commit_size = 5; 2400 2401 /* 2402 The required number of atoms per kilobyte that the requester will 2403 pay at all times, for both the funding transaction and commitment 2404 transaction. This value can later be updated once the channel is open. 2405 */ 2406 int64 fee_per_kb = 6; 2407 } 2408 2409 message WaitingCloseChannel { 2410 // The pending channel waiting for closing tx to confirm 2411 PendingChannel channel = 1; 2412 2413 // The balance in atoms encumbered in this channel 2414 int64 limbo_balance = 2; 2415 2416 /* 2417 A list of valid commitment transactions. Any of these can confirm at 2418 this point. 2419 */ 2420 Commitments commitments = 3; 2421 2422 // The transaction id of the closing transaction 2423 string closing_txid = 4; 2424 } 2425 2426 message Commitments { 2427 // Hash of the local version of the commitment tx. 2428 string local_txid = 1; 2429 2430 // Hash of the remote version of the commitment tx. 2431 string remote_txid = 2; 2432 2433 // Hash of the remote pending version of the commitment tx. 2434 string remote_pending_txid = 3; 2435 2436 /* 2437 The amount in atoms calculated to be paid in fees for the local 2438 commitment. 2439 */ 2440 uint64 local_commit_fee_atoms = 4; 2441 2442 /* 2443 The amount in atoms calculated to be paid in fees for the remote 2444 commitment. 2445 */ 2446 uint64 remote_commit_fee_atoms = 5; 2447 2448 /* 2449 The amount in satoshis calculated to be paid in fees for the remote 2450 pending commitment. 2451 */ 2452 uint64 remote_pending_commit_fee_atoms = 6; 2453 } 2454 2455 message ClosedChannel { 2456 // The pending channel to be closed 2457 PendingChannel channel = 1; 2458 2459 // The transaction id of the closing transaction 2460 string closing_txid = 2; 2461 } 2462 2463 message ForceClosedChannel { 2464 // The pending channel to be force closed 2465 PendingChannel channel = 1; 2466 2467 // The transaction id of the closing transaction 2468 string closing_txid = 2; 2469 2470 // The balance in atoms encumbered in this pending channel 2471 int64 limbo_balance = 3; 2472 2473 // The height at which funds can be swept into the wallet 2474 uint32 maturity_height = 4; 2475 2476 /* 2477 Remaining # of blocks until the commitment output can be swept. 2478 Negative values indicate how many blocks have passed since becoming 2479 mature. 2480 */ 2481 int32 blocks_til_maturity = 5; 2482 2483 // The total value of funds successfully recovered from this channel 2484 int64 recovered_balance = 6; 2485 2486 repeated PendingHTLC pending_htlcs = 8; 2487 2488 enum AnchorState { 2489 LIMBO = 0; 2490 RECOVERED = 1; 2491 LOST = 2; 2492 } 2493 2494 AnchorState anchor = 9; 2495 } 2496 2497 // The balance in atoms encumbered in pending channels 2498 int64 total_limbo_balance = 1; 2499 2500 // Channels pending opening 2501 repeated PendingOpenChannel pending_open_channels = 2; 2502 2503 /* 2504 Deprecated: Channels pending closing previously contained cooperatively 2505 closed channels with a single confirmation. These channels are now 2506 considered closed from the time we see them on chain. 2507 */ 2508 repeated ClosedChannel pending_closing_channels = 3 [deprecated = true]; 2509 2510 // Channels pending force closing 2511 repeated ForceClosedChannel pending_force_closing_channels = 4; 2512 2513 // Channels waiting for closing tx to confirm 2514 repeated WaitingCloseChannel waiting_close_channels = 5; 2515 } 2516 2517 message ChannelEventSubscription { 2518 } 2519 2520 message ChannelEventUpdate { 2521 oneof channel { 2522 Channel open_channel = 1; 2523 ChannelCloseSummary closed_channel = 2; 2524 ChannelPoint active_channel = 3; 2525 ChannelPoint inactive_channel = 4; 2526 PendingUpdate pending_open_channel = 6; 2527 ChannelPoint fully_resolved_channel = 7; 2528 } 2529 2530 enum UpdateType { 2531 OPEN_CHANNEL = 0; 2532 CLOSED_CHANNEL = 1; 2533 ACTIVE_CHANNEL = 2; 2534 INACTIVE_CHANNEL = 3; 2535 PENDING_OPEN_CHANNEL = 4; 2536 FULLY_RESOLVED_CHANNEL = 5; 2537 } 2538 2539 UpdateType type = 5; 2540 } 2541 2542 message WalletAccountBalance { 2543 // The confirmed balance of the account (with >= 1 confirmations). 2544 int64 confirmed_balance = 1; 2545 2546 // The unconfirmed balance of the account (with 0 confirmations). 2547 int64 unconfirmed_balance = 2; 2548 } 2549 2550 message WalletBalanceRequest { 2551 } 2552 2553 message WalletBalanceResponse { 2554 // The balance of the wallet 2555 int64 total_balance = 1; 2556 2557 // The confirmed balance of a wallet(with >= 1 confirmations) 2558 int64 confirmed_balance = 2; 2559 2560 // The unconfirmed balance of a wallet(with 0 confirmations) 2561 int64 unconfirmed_balance = 3; 2562 2563 // The total amount of wallet UTXOs held in outputs that are locked for 2564 // other usage. 2565 int64 locked_balance = 5; 2566 2567 // A mapping of each wallet account's name to its balance. 2568 map<string, WalletAccountBalance> account_balance = 4; 2569 } 2570 2571 message Amount { 2572 // Value denominated in atoms. 2573 uint64 atoms = 1; 2574 2575 // Value denominated in milli-atoms. 2576 uint64 matoms = 2; 2577 } 2578 2579 message ChannelBalanceRequest { 2580 } 2581 message ChannelBalanceResponse { 2582 // Deprecated. Sum of channels balances denominated in satoshis 2583 int64 balance = 1 [deprecated = true]; 2584 2585 // Deprecated. Sum of channels pending balances denominated in satoshis 2586 int64 pending_open_balance = 2 [deprecated = true]; 2587 2588 // Sum of channels local balances. 2589 Amount local_balance = 3; 2590 2591 // Sum of channels remote balances. 2592 Amount remote_balance = 4; 2593 2594 // Sum of channels local unsettled balances. 2595 Amount unsettled_local_balance = 5; 2596 2597 // Sum of channels remote unsettled balances. 2598 Amount unsettled_remote_balance = 6; 2599 2600 // Sum of channels pending local balances. 2601 Amount pending_open_local_balance = 7; 2602 2603 // Sum of channels pending remote balances. 2604 Amount pending_open_remote_balance = 8; 2605 2606 /* 2607 Maximum amount we can receive across all our channels, after accounting 2608 for required reserves. 2609 */ 2610 int64 max_inbound_amount = 900; 2611 2612 /* 2613 Maximum amount we can send across all our channels, after accounting for 2614 required reserves. 2615 */ 2616 int64 max_outbound_amount = 901; 2617 } 2618 2619 message QueryRoutesRequest { 2620 // The 33-byte hex-encoded public key for the payment destination 2621 string pub_key = 1; 2622 2623 /* 2624 The amount to send expressed in atoms. 2625 2626 The fields amt and amt_m_atoms are mutually exclusive. 2627 */ 2628 int64 amt = 2; 2629 2630 /* 2631 The amount to send expressed in milliatoms. 2632 2633 The fields amt and amt_m_atoms are mutually exclusive. 2634 */ 2635 int64 amt_m_atoms = 12; 2636 2637 reserved 3; 2638 2639 /* 2640 An optional CLTV delta from the current height that should be used for the 2641 timelock of the final hop. Note that unlike SendPayment, QueryRoutes does 2642 not add any additional block padding on top of final_ctlv_delta. This 2643 padding of a few blocks needs to be added manually or otherwise failures may 2644 happen when a block comes in while the payment is in flight. 2645 */ 2646 int32 final_cltv_delta = 4; 2647 2648 /* 2649 The maximum number of atoms that will be paid as a fee of the payment. 2650 This value can be represented either as a percentage of the amount being 2651 sent, or as a fixed amount of the maximum fee the user is willing the pay to 2652 send the payment. If not specified, lnd will use a default value of 100% 2653 fees for small amounts (<=1k atoms) or 5% fees for larger amounts. 2654 */ 2655 FeeLimit fee_limit = 5; 2656 2657 /* 2658 A list of nodes to ignore during path finding. When using REST, these fields 2659 must be encoded as base64. 2660 */ 2661 repeated bytes ignored_nodes = 6; 2662 2663 /* 2664 Deprecated. A list of edges to ignore during path finding. 2665 */ 2666 repeated EdgeLocator ignored_edges = 7 [deprecated = true]; 2667 2668 /* 2669 The source node where the request route should originated from. If empty, 2670 self is assumed. 2671 */ 2672 string source_pub_key = 8; 2673 2674 /* 2675 If set to true, edge probabilities from mission control will be used to get 2676 the optimal route. 2677 */ 2678 bool use_mission_control = 9; 2679 2680 /* 2681 A list of directed node pairs that will be ignored during path finding. 2682 */ 2683 repeated NodePair ignored_pairs = 10; 2684 2685 /* 2686 An optional maximum total time lock for the route. If the source is empty or 2687 ourselves, this should not exceed lnd's `--max-cltv-expiry` setting. If 2688 zero, then the value of `--max-cltv-expiry` is used as the limit. 2689 */ 2690 uint32 cltv_limit = 11; 2691 2692 /* 2693 An optional field that can be used to pass an arbitrary set of TLV records 2694 to a peer which understands the new records. This can be used to pass 2695 application specific data during the payment attempt. If the destination 2696 does not support the specified records, and error will be returned. 2697 Record types are required to be in the custom range >= 65536. When using 2698 REST, the values must be encoded as base64. 2699 */ 2700 map<uint64, bytes> dest_custom_records = 13; 2701 2702 /* 2703 The channel id of the channel that must be taken to the first hop. If zero, 2704 any channel may be used. 2705 */ 2706 uint64 outgoing_chan_id = 14 [jstype = JS_STRING]; 2707 2708 /* 2709 The pubkey of the last hop of the route. If empty, any hop may be used. 2710 */ 2711 bytes last_hop_pubkey = 15; 2712 2713 /* 2714 Optional route hints to reach the destination through private channels. 2715 */ 2716 repeated lnrpc.RouteHint route_hints = 16; 2717 2718 /* 2719 Features assumed to be supported by the final node. All transitive feature 2720 dependencies must also be set properly. For a given feature bit pair, either 2721 optional or remote may be set, but not both. If this field is nil or empty, 2722 the router will try to load destination features from the graph as a 2723 fallback. 2724 */ 2725 repeated lnrpc.FeatureBit dest_features = 17; 2726 } 2727 2728 message NodePair { 2729 /* 2730 The sending node of the pair. When using REST, this field must be encoded as 2731 base64. 2732 */ 2733 bytes from = 1; 2734 2735 /* 2736 The receiving node of the pair. When using REST, this field must be encoded 2737 as base64. 2738 */ 2739 bytes to = 2; 2740 } 2741 2742 message EdgeLocator { 2743 // The short channel id of this edge. 2744 uint64 channel_id = 1 [jstype = JS_STRING]; 2745 2746 /* 2747 The direction of this edge. If direction_reverse is false, the direction 2748 of this edge is from the channel endpoint with the lexicographically smaller 2749 pub key to the endpoint with the larger pub key. If direction_reverse is 2750 is true, the edge goes the other way. 2751 */ 2752 bool direction_reverse = 2; 2753 } 2754 2755 message QueryRoutesResponse { 2756 /* 2757 The route that results from the path finding operation. This is still a 2758 repeated field to retain backwards compatibility. 2759 */ 2760 repeated Route routes = 1; 2761 2762 /* 2763 The success probability of the returned route based on the current mission 2764 control state. [EXPERIMENTAL] 2765 */ 2766 double success_prob = 2; 2767 } 2768 2769 message Hop { 2770 /* 2771 The unique channel ID for the channel. The first 3 bytes are the block 2772 height, the next 3 the index within the block, and the last 2 bytes are the 2773 output index for the channel. 2774 */ 2775 uint64 chan_id = 1 [jstype = JS_STRING]; 2776 int64 chan_capacity = 2 [deprecated = true]; 2777 int64 amt_to_forward = 3 [deprecated = true]; 2778 int64 fee = 4 [deprecated = true]; 2779 uint32 expiry = 5; 2780 int64 amt_to_forward_m_atoms = 6; 2781 int64 fee_m_atoms = 7; 2782 2783 /* 2784 An optional public key of the hop. If the public key is given, the payment 2785 can be executed without relying on a copy of the channel graph. 2786 */ 2787 string pub_key = 8; 2788 2789 /* 2790 If set to true, then this hop will be encoded using the new variable length 2791 TLV format. Note that if any custom tlv_records below are specified, then 2792 this field MUST be set to true for them to be encoded properly. 2793 */ 2794 bool tlv_payload = 9 [deprecated = true]; 2795 2796 /* 2797 An optional TLV record that signals the use of an MPP payment. If present, 2798 the receiver will enforce that the same mpp_record is included in the final 2799 hop payload of all non-zero payments in the HTLC set. If empty, a regular 2800 single-shot payment is or was attempted. 2801 */ 2802 MPPRecord mpp_record = 10; 2803 2804 /* 2805 An optional TLV record that signals the use of an AMP payment. If present, 2806 the receiver will treat all received payments including the same 2807 (payment_addr, set_id) pair as being part of one logical payment. The 2808 payment will be settled by XORing the root_share's together and deriving the 2809 child hashes and preimages according to BOLT XX. Must be used in conjunction 2810 with mpp_record. 2811 */ 2812 AMPRecord amp_record = 12; 2813 2814 /* 2815 An optional set of key-value TLV records. This is useful within the context 2816 of the SendToRoute call as it allows callers to specify arbitrary K-V pairs 2817 to drop off at each hop within the onion. 2818 */ 2819 map<uint64, bytes> custom_records = 11; 2820 } 2821 2822 message MPPRecord { 2823 /* 2824 A unique, random identifier used to authenticate the sender as the intended 2825 payer of a multi-path payment. The payment_addr must be the same for all 2826 subpayments, and match the payment_addr provided in the receiver's invoice. 2827 The same payment_addr must be used on all subpayments. 2828 */ 2829 bytes payment_addr = 11; 2830 2831 /* 2832 The total amount in milli-satoshis being sent as part of a larger multi-path 2833 payment. The caller is responsible for ensuring subpayments to the same node 2834 and payment_hash sum exactly to total_amt_m_atoms. The same 2835 total_amt_m_atoms must be used on all subpayments. 2836 */ 2837 int64 total_amt_m_atoms = 10; 2838 } 2839 2840 message AMPRecord { 2841 bytes root_share = 1; 2842 2843 bytes set_id = 2; 2844 2845 uint32 child_index = 3; 2846 } 2847 2848 /* 2849 A path through the channel graph which runs over one or more channels in 2850 succession. This struct carries all the information required to craft the 2851 Sphinx onion packet, and send the payment along the first hop in the path. A 2852 route is only selected as valid if all the channels have sufficient capacity to 2853 carry the initial payment amount after fees are accounted for. 2854 */ 2855 message Route { 2856 /* 2857 The cumulative (final) time lock across the entire route. This is the CLTV 2858 value that should be extended to the first hop in the route. All other hops 2859 will decrement the time-lock as advertised, leaving enough time for all 2860 hops to wait for or present the payment preimage to complete the payment. 2861 */ 2862 uint32 total_time_lock = 1; 2863 2864 /* 2865 The sum of the fees paid at each hop within the final route. In the case 2866 of a one-hop payment, this value will be zero as we don't need to pay a fee 2867 to ourselves. 2868 */ 2869 int64 total_fees = 2 [deprecated = true]; 2870 2871 /* 2872 The total amount of funds required to complete a payment over this route. 2873 This value includes the cumulative fees at each hop. As a result, the HTLC 2874 extended to the first-hop in the route will need to have at least this many 2875 atoms, otherwise the route will fail at an intermediate node due to an 2876 insufficient amount of fees. 2877 */ 2878 int64 total_amt = 3 [deprecated = true]; 2879 2880 /* 2881 Contains details concerning the specific forwarding details at each hop. 2882 */ 2883 repeated Hop hops = 4; 2884 2885 /* 2886 The total fees in MilliAtoms. 2887 */ 2888 int64 total_fees_m_atoms = 5; 2889 2890 /* 2891 The total amount in MilliAtoms. 2892 */ 2893 int64 total_amt_m_atoms = 6; 2894 } 2895 2896 message NodeInfoRequest { 2897 // The 33-byte hex-encoded compressed public of the target node 2898 string pub_key = 1; 2899 2900 // If true, will include all known channels associated with the node. 2901 bool include_channels = 2; 2902 } 2903 2904 message NodeInfo { 2905 /* 2906 An individual vertex/node within the channel graph. A node is 2907 connected to other nodes by one or more channel edges emanating from it. As 2908 the graph is directed, a node will also have an incoming edge attached to 2909 it for each outgoing edge. 2910 */ 2911 LightningNode node = 1; 2912 2913 // The total number of channels for the node. 2914 uint32 num_channels = 2; 2915 2916 // The sum of all channels capacity for the node, denominated in satoshis. 2917 int64 total_capacity = 3; 2918 2919 // A list of all public channels for the node. 2920 repeated ChannelEdge channels = 4; 2921 } 2922 2923 /* 2924 An individual vertex/node within the channel graph. A node is 2925 connected to other nodes by one or more channel edges emanating from it. As the 2926 graph is directed, a node will also have an incoming edge attached to it for 2927 each outgoing edge. 2928 */ 2929 message LightningNode { 2930 uint32 last_update = 1; 2931 string pub_key = 2; 2932 string alias = 3; 2933 repeated NodeAddress addresses = 4; 2934 string color = 5; 2935 map<uint32, Feature> features = 6; 2936 } 2937 2938 message NodeAddress { 2939 string network = 1; 2940 string addr = 2; 2941 } 2942 2943 message RoutingPolicy { 2944 uint32 time_lock_delta = 1; 2945 int64 min_htlc = 2; 2946 int64 fee_base_m_atoms = 3; 2947 int64 fee_rate_milli_m_atoms = 4; 2948 bool disabled = 5; 2949 uint64 max_htlc_m_atoms = 6; 2950 uint32 last_update = 7; 2951 } 2952 2953 message EnforceNodePingRequest { 2954 /* 2955 The node pub key in hexadecimal format. 2956 */ 2957 string pub_key = 1; 2958 } 2959 2960 message EnforceNodePingResponse { 2961 /* 2962 Roud Trip Time (RTT) in microseconds to the peer. 2963 */ 2964 int64 ping_time_micro = 1; 2965 } 2966 2967 /* 2968 A fully authenticated channel along with all its unique attributes. 2969 Once an authenticated channel announcement has been processed on the network, 2970 then an instance of ChannelEdgeInfo encapsulating the channels attributes is 2971 stored. The other portions relevant to routing policy of a channel are stored 2972 within a ChannelEdgePolicy for each direction of the channel. 2973 */ 2974 message ChannelEdge { 2975 /* 2976 The unique channel ID for the channel. The first 3 bytes are the block 2977 height, the next 3 the index within the block, and the last 2 bytes are the 2978 output index for the channel. 2979 */ 2980 uint64 channel_id = 1 [jstype = JS_STRING]; 2981 string chan_point = 2; 2982 2983 uint32 last_update = 3 [deprecated = true]; 2984 2985 string node1_pub = 4; 2986 string node2_pub = 5; 2987 2988 int64 capacity = 6; 2989 2990 RoutingPolicy node1_policy = 7; 2991 RoutingPolicy node2_policy = 8; 2992 } 2993 2994 message ChannelGraphRequest { 2995 /* 2996 Whether unannounced channels are included in the response or not. If set, 2997 unannounced channels are included. Unannounced channels are both private 2998 channels, and public channels that are not yet announced to the network. 2999 */ 3000 bool include_unannounced = 1; 3001 } 3002 3003 // Returns a new instance of the directed channel graph. 3004 message ChannelGraph { 3005 // The list of `LightningNode`s in this channel graph 3006 repeated LightningNode nodes = 1; 3007 3008 // The list of `ChannelEdge`s in this channel graph 3009 repeated ChannelEdge edges = 2; 3010 } 3011 3012 enum NodeMetricType { 3013 UNKNOWN = 0; 3014 BETWEENNESS_CENTRALITY = 1; 3015 } 3016 3017 message NodeMetricsRequest { 3018 // The requested node metrics. 3019 repeated NodeMetricType types = 1; 3020 } 3021 3022 message NodeMetricsResponse { 3023 /* 3024 Betweenness centrality is the sum of the ratio of shortest paths that pass 3025 through the node for each pair of nodes in the graph (not counting paths 3026 starting or ending at this node). 3027 Map of node pubkey to betweenness centrality of the node. Normalized 3028 values are in the [0,1] closed interval. 3029 */ 3030 map<string, FloatMetric> betweenness_centrality = 1; 3031 } 3032 3033 message FloatMetric { 3034 // Arbitrary float value. 3035 double value = 1; 3036 3037 // The value normalized to [0,1] or [-1,1]. 3038 double normalized_value = 2; 3039 } 3040 3041 message ChanInfoRequest { 3042 /* 3043 The unique channel ID for the channel. The first 3 bytes are the block 3044 height, the next 3 the index within the block, and the last 2 bytes are the 3045 output index for the channel. 3046 */ 3047 uint64 chan_id = 1 [jstype = JS_STRING]; 3048 } 3049 3050 message NetworkInfoRequest { 3051 } 3052 message NetworkInfo { 3053 uint32 graph_diameter = 1; 3054 double avg_out_degree = 2; 3055 uint32 max_out_degree = 3; 3056 3057 uint32 num_nodes = 4; 3058 uint32 num_channels = 5; 3059 3060 int64 total_network_capacity = 6; 3061 3062 double avg_channel_size = 7; 3063 int64 min_channel_size = 8; 3064 int64 max_channel_size = 9; 3065 int64 median_channel_size_sat = 10; 3066 3067 // The number of edges marked as zombies. 3068 uint64 num_zombie_chans = 11; 3069 3070 // TODO(roasbeef): fee rate info, expiry 3071 // * also additional RPC for tracking fee info once in 3072 } 3073 3074 message StopRequest { 3075 } 3076 message StopResponse { 3077 } 3078 3079 message GraphTopologySubscription { 3080 } 3081 message GraphTopologyUpdate { 3082 repeated NodeUpdate node_updates = 1; 3083 repeated ChannelEdgeUpdate channel_updates = 2; 3084 repeated ClosedChannelUpdate closed_chans = 3; 3085 } 3086 message NodeUpdate { 3087 /* 3088 Deprecated, use node_addresses. 3089 */ 3090 repeated string addresses = 1 [deprecated = true]; 3091 3092 string identity_key = 2; 3093 3094 /* 3095 Deprecated, use features. 3096 */ 3097 bytes global_features = 3 [deprecated = true]; 3098 3099 string alias = 4; 3100 string color = 5; 3101 repeated NodeAddress node_addresses = 7; 3102 3103 /* 3104 Features that the node has advertised in the init message, node 3105 announcements and invoices. 3106 */ 3107 map<uint32, Feature> features = 6; 3108 } 3109 message ChannelEdgeUpdate { 3110 /* 3111 The unique channel ID for the channel. The first 3 bytes are the block 3112 height, the next 3 the index within the block, and the last 2 bytes are the 3113 output index for the channel. 3114 */ 3115 uint64 chan_id = 1 [jstype = JS_STRING]; 3116 3117 ChannelPoint chan_point = 2; 3118 3119 int64 capacity = 3; 3120 3121 RoutingPolicy routing_policy = 4; 3122 3123 string advertising_node = 5; 3124 string connecting_node = 6; 3125 } 3126 message ClosedChannelUpdate { 3127 /* 3128 The unique channel ID for the channel. The first 3 bytes are the block 3129 height, the next 3 the index within the block, and the last 2 bytes are the 3130 output index for the channel. 3131 */ 3132 uint64 chan_id = 1 [jstype = JS_STRING]; 3133 int64 capacity = 2; 3134 uint32 closed_height = 3; 3135 ChannelPoint chan_point = 4; 3136 } 3137 3138 message HopHint { 3139 // The public key of the node at the start of the channel. 3140 string node_id = 1; 3141 3142 // The unique identifier of the channel. 3143 uint64 chan_id = 2 [jstype = JS_STRING]; 3144 3145 // The base fee of the channel denominated in MilliAtoms. 3146 uint32 fee_base_m_atoms = 3; 3147 3148 /* 3149 The fee rate of the channel for sending one atom across it denominated in 3150 millionths of a atom. 3151 */ 3152 uint32 fee_proportional_millionths = 4; 3153 3154 // The time-lock delta of the channel. 3155 uint32 cltv_expiry_delta = 5; 3156 } 3157 3158 message SetID { 3159 bytes set_id = 1; 3160 } 3161 3162 message RouteHint { 3163 /* 3164 A list of hop hints that when chained together can assist in reaching a 3165 specific destination. 3166 */ 3167 repeated HopHint hop_hints = 1; 3168 } 3169 3170 message AMPInvoiceState { 3171 // The state the HTLCs associated with this setID are in. 3172 InvoiceHTLCState state = 1; 3173 3174 // The settle index of this HTLC set, if the invoice state is settled. 3175 uint64 settle_index = 2; 3176 3177 // The time this HTLC set was settled expressed in unix epoch. 3178 int64 settle_time = 3; 3179 3180 // The total amount paid for the sub-invoice expressed in milli atoms. 3181 int64 amt_paid_m_atoms = 5; 3182 } 3183 3184 message Invoice { 3185 /* 3186 An optional memo to attach along with the invoice. Used for record keeping 3187 purposes for the invoice's creator, and will also be set in the description 3188 field of the encoded payment request if the description_hash field is not 3189 being used. 3190 */ 3191 string memo = 1; 3192 3193 reserved 2; 3194 3195 /* 3196 The hex-encoded preimage (32 byte) which will allow settling an incoming 3197 HTLC payable to this preimage. When using REST, this field must be encoded 3198 as base64. 3199 */ 3200 bytes r_preimage = 3; 3201 3202 /* 3203 The hash of the preimage. When using REST, this field must be encoded as 3204 base64. 3205 */ 3206 bytes r_hash = 4; 3207 3208 /* 3209 The value of this invoice in atoms. 3210 3211 The fields value and value_msat are mutually exclusive. 3212 */ 3213 int64 value = 5; 3214 3215 /* 3216 The value of this invoice in milliatoms. 3217 3218 The fields value and value_msat are mutually exclusive. 3219 */ 3220 int64 value_m_atoms = 23; 3221 3222 // Whether this invoice has been fulfilled 3223 bool settled = 6 [deprecated = true]; 3224 3225 // When this invoice was created 3226 int64 creation_date = 7; 3227 3228 // When this invoice was settled 3229 int64 settle_date = 8; 3230 3231 /* 3232 A bare-bones invoice for a payment within the Lightning Network. With the 3233 details of the invoice, the sender has all the data necessary to send a 3234 payment to the recipient. 3235 */ 3236 string payment_request = 9; 3237 3238 /* 3239 Hash (SHA-256) of a description of the payment. Used if the description of 3240 payment (memo) is too long to naturally fit within the description field 3241 of an encoded payment request. When using REST, this field must be encoded 3242 as base64. 3243 */ 3244 bytes description_hash = 10; 3245 3246 // Payment request expiry time in seconds. Default is 3600 (1 hour). 3247 int64 expiry = 11; 3248 3249 // Fallback on-chain address. 3250 string fallback_addr = 12; 3251 3252 // Delta to use for the time-lock of the CLTV extended to the final hop. 3253 uint64 cltv_expiry = 13; 3254 3255 /* 3256 Route hints that can each be individually used to assist in reaching the 3257 invoice's destination. 3258 */ 3259 repeated RouteHint route_hints = 14; 3260 3261 // Whether this invoice should include routing hints for private channels. 3262 bool private = 15; 3263 3264 /* 3265 The "add" index of this invoice. Each newly created invoice will increment 3266 this index making it monotonically increasing. Callers to the 3267 SubscribeInvoices call can use this to instantly get notified of all added 3268 invoices with an add_index greater than this one. 3269 */ 3270 uint64 add_index = 16; 3271 3272 /* 3273 The "settle" index of this invoice. Each newly settled invoice will 3274 increment this index making it monotonically increasing. Callers to the 3275 SubscribeInvoices call can use this to instantly get notified of all 3276 settled invoices with an settle_index greater than this one. 3277 */ 3278 uint64 settle_index = 17; 3279 3280 // Deprecated, use amt_paid_atoms or amt_paid_m_atoms. 3281 int64 amt_paid = 18; 3282 3283 /* 3284 The amount that was accepted for this invoice, in atoms. This will ONLY 3285 be set if this invoice has been settled. We provide this field as if the 3286 invoice was created with a zero value, then we need to record what amount 3287 was ultimately accepted. Additionally, it's possible that the sender paid 3288 MORE that was specified in the original invoice. So we'll record that here 3289 as well. 3290 */ 3291 int64 amt_paid_atoms = 19; 3292 3293 /* 3294 The amount that was accepted for this invoice, in MilliAtoms. This will 3295 ONLY be set if this invoice has been settled. We provide this field as if 3296 the invoice was created with a zero value, then we need to record what 3297 amount was ultimately accepted. Additionally, it's possible that the sender 3298 paid MORE that was specified in the original invoice. So we'll record that 3299 here as well. 3300 */ 3301 int64 amt_paid_m_atoms = 20; 3302 3303 enum InvoiceState { 3304 OPEN = 0; 3305 SETTLED = 1; 3306 CANCELED = 2; 3307 ACCEPTED = 3; 3308 } 3309 3310 /* 3311 The state the invoice is in. 3312 */ 3313 InvoiceState state = 21; 3314 3315 // List of HTLCs paying to this invoice [EXPERIMENTAL]. 3316 repeated InvoiceHTLC htlcs = 22; 3317 3318 /* 3319 Whether to forgo checking for the current max inbound amount before 3320 creating the invoice. This is only applicable during invoice creation. 3321 3322 When creating an invoice, the node will check if there is enough inbound 3323 bandwidth in at least one of its directly connected channels (after 3324 accounting for the required reserves) before allowing the invoice to be 3325 created. Specifying this parameter as true will make the node ignore those 3326 checks and create the invoice even if it could not possibly have it settled. 3327 */ 3328 bool ignore_max_inbound_amt = 1001 [json_name = "ignore_max_inbound_amt"]; 3329 3330 // List of features advertised on the invoice. 3331 map<uint32, Feature> features = 24; 3332 3333 /* 3334 Indicates if this invoice was a spontaneous payment that arrived via keysend 3335 [EXPERIMENTAL]. 3336 */ 3337 bool is_keysend = 25; 3338 3339 /* 3340 The payment address of this invoice. This value will be used in MPP 3341 payments, and also for newer invoices that always require the MPP payload 3342 for added end-to-end security. 3343 */ 3344 bytes payment_addr = 26; 3345 3346 /* 3347 Signals whether or not this is an AMP invoice. 3348 */ 3349 bool is_amp = 27; 3350 3351 /* 3352 [EXPERIMENTAL]: 3353 3354 Maps a 32-byte hex-encoded set ID to the sub-invoice AMP state for the 3355 given set ID. This field is always populated for AMP invoices, and can be 3356 used along side LookupInvoice to obtain the HTLC information related to a 3357 given sub-invoice. 3358 */ 3359 map<string, AMPInvoiceState> amp_invoice_state = 28; 3360 } 3361 3362 enum InvoiceHTLCState { 3363 ACCEPTED = 0; 3364 SETTLED = 1; 3365 CANCELED = 2; 3366 } 3367 3368 // Details of an HTLC that paid to an invoice 3369 message InvoiceHTLC { 3370 // Short channel id over which the htlc was received. 3371 uint64 chan_id = 1 [jstype = JS_STRING]; 3372 3373 // Index identifying the htlc on the channel. 3374 uint64 htlc_index = 2; 3375 3376 // The amount of the htlc in msat. 3377 uint64 amt_m_atoms = 3; 3378 3379 // Block height at which this htlc was accepted. 3380 int32 accept_height = 4; 3381 3382 // Time at which this htlc was accepted. 3383 int64 accept_time = 5; 3384 3385 // Time at which this htlc was settled or canceled. 3386 int64 resolve_time = 6; 3387 3388 // Block height at which this htlc expires. 3389 int32 expiry_height = 7; 3390 3391 // Current state the htlc is in. 3392 InvoiceHTLCState state = 8; 3393 3394 // Custom tlv records. 3395 map<uint64, bytes> custom_records = 9; 3396 3397 // The total amount of the mpp payment in milli-atoms. 3398 uint64 mpp_total_amt_m_atoms = 10; 3399 3400 // Details relevant to AMP HTLCs, only populated if this is an AMP HTLC. 3401 AMP amp = 11; 3402 } 3403 3404 // Details specific to AMP HTLCs. 3405 message AMP { 3406 // An n-of-n secret share of the root seed from which child payment hashes 3407 // and preimages are derived. 3408 bytes root_share = 1; 3409 3410 // An identifier for the HTLC set that this HTLC belongs to. 3411 bytes set_id = 2; 3412 3413 // A nonce used to randomize the child preimage and child hash from a given 3414 // root_share. 3415 uint32 child_index = 3; 3416 3417 // The payment hash of the AMP HTLC. 3418 bytes hash = 4; 3419 3420 // The preimage used to settle this AMP htlc. This field will only be 3421 // populated if the invoice is in InvoiceState_ACCEPTED or 3422 // InvoiceState_SETTLED. 3423 bytes preimage = 5; 3424 } 3425 3426 message AddInvoiceResponse { 3427 bytes r_hash = 1; 3428 3429 /* 3430 A bare-bones invoice for a payment within the Lightning Network. With the 3431 details of the invoice, the sender has all the data necessary to send a 3432 payment to the recipient. 3433 */ 3434 string payment_request = 2; 3435 3436 /* 3437 The "add" index of this invoice. Each newly created invoice will increment 3438 this index making it monotonically increasing. Callers to the 3439 SubscribeInvoices call can use this to instantly get notified of all added 3440 invoices with an add_index greater than this one. 3441 */ 3442 uint64 add_index = 16; 3443 3444 /* 3445 The payment address of the generated invoice. This value should be used 3446 in all payments for this invoice as we require it for end to end 3447 security. 3448 */ 3449 bytes payment_addr = 17; 3450 } 3451 message PaymentHash { 3452 /* 3453 The hex-encoded payment hash of the invoice to be looked up. The passed 3454 payment hash must be exactly 32 bytes, otherwise an error is returned. 3455 Deprecated now that the REST gateway supports base64 encoding of bytes 3456 fields. 3457 */ 3458 string r_hash_str = 1 [deprecated = true]; 3459 3460 /* 3461 The payment hash of the invoice to be looked up. When using REST, this field 3462 must be encoded as base64. 3463 */ 3464 bytes r_hash = 2; 3465 } 3466 3467 message ListInvoiceRequest { 3468 /* 3469 If set, only invoices that are not settled and not canceled will be returned 3470 in the response. 3471 */ 3472 bool pending_only = 1; 3473 3474 /* 3475 The index of an invoice that will be used as either the start or end of a 3476 query to determine which invoices should be returned in the response. 3477 */ 3478 uint64 index_offset = 4; 3479 3480 // The max number of invoices to return in the response to this query. 3481 uint64 num_max_invoices = 5; 3482 3483 /* 3484 If set, the invoices returned will result from seeking backwards from the 3485 specified index offset. This can be used to paginate backwards. 3486 */ 3487 bool reversed = 6; 3488 } 3489 message ListInvoiceResponse { 3490 /* 3491 A list of invoices from the time slice of the time series specified in the 3492 request. 3493 */ 3494 repeated Invoice invoices = 1; 3495 3496 /* 3497 The index of the last item in the set of returned invoices. This can be used 3498 to seek further, pagination style. 3499 */ 3500 uint64 last_index_offset = 2; 3501 3502 /* 3503 The index of the last item in the set of returned invoices. This can be used 3504 to seek backwards, pagination style. 3505 */ 3506 uint64 first_index_offset = 3; 3507 } 3508 3509 message InvoiceSubscription { 3510 /* 3511 If specified (non-zero), then we'll first start by sending out 3512 notifications for all added indexes with an add_index greater than this 3513 value. This allows callers to catch up on any events they missed while they 3514 weren't connected to the streaming RPC. 3515 */ 3516 uint64 add_index = 1; 3517 3518 /* 3519 If specified (non-zero), then we'll first start by sending out 3520 notifications for all settled indexes with an settle_index greater than 3521 this value. This allows callers to catch up on any events they missed while 3522 they weren't connected to the streaming RPC. 3523 */ 3524 uint64 settle_index = 2; 3525 } 3526 3527 enum PaymentFailureReason { 3528 /* 3529 Payment isn't failed (yet). 3530 */ 3531 FAILURE_REASON_NONE = 0; 3532 3533 /* 3534 There are more routes to try, but the payment timeout was exceeded. 3535 */ 3536 FAILURE_REASON_TIMEOUT = 1; 3537 3538 /* 3539 All possible routes were tried and failed permanently. Or were no 3540 routes to the destination at all. 3541 */ 3542 FAILURE_REASON_NO_ROUTE = 2; 3543 3544 /* 3545 A non-recoverable error has occured. 3546 */ 3547 FAILURE_REASON_ERROR = 3; 3548 3549 /* 3550 Payment details incorrect (unknown hash, invalid amt or 3551 invalid final cltv delta) 3552 */ 3553 FAILURE_REASON_INCORRECT_PAYMENT_DETAILS = 4; 3554 3555 /* 3556 Insufficient local balance. 3557 */ 3558 FAILURE_REASON_INSUFFICIENT_BALANCE = 5; 3559 } 3560 3561 message Payment { 3562 // The payment hash 3563 string payment_hash = 1; 3564 3565 // Deprecated, use value_atoms or value_m_atoms. 3566 int64 value = 2 [deprecated = true]; 3567 3568 // Deprecated, use creation_time_ns 3569 int64 creation_date = 3 [deprecated = true]; 3570 3571 reserved 4; 3572 3573 // Deprecated, use fee_atoms or fee_m_atoms. 3574 int64 fee = 5 [deprecated = true]; 3575 3576 // The payment preimage 3577 string payment_preimage = 6; 3578 3579 // The value of the payment in atoms 3580 int64 value_atoms = 7; 3581 3582 // The value of the payment in milli-atoms 3583 int64 value_m_atoms = 8; 3584 3585 // The optional payment request being fulfilled. 3586 string payment_request = 9; 3587 3588 enum PaymentStatus { 3589 UNKNOWN = 0; 3590 IN_FLIGHT = 1; 3591 SUCCEEDED = 2; 3592 FAILED = 3; 3593 } 3594 3595 // The status of the payment. 3596 PaymentStatus status = 10; 3597 3598 // The fee paid for this payment in atoms 3599 int64 fee_atoms = 11; 3600 3601 // The fee paid for this payment in milli-atoms 3602 int64 fee_m_atoms = 12; 3603 3604 // The time in UNIX nanoseconds at which the payment was created. 3605 int64 creation_time_ns = 13; 3606 3607 // The HTLCs made in attempt to settle the payment. 3608 repeated HTLCAttempt htlcs = 14; 3609 3610 /* 3611 The creation index of this payment. Each payment can be uniquely identified 3612 by this index, which may not strictly increment by 1 for payments made in 3613 older versions of lnd. 3614 */ 3615 uint64 payment_index = 15; 3616 3617 PaymentFailureReason failure_reason = 16; 3618 } 3619 3620 message HTLCAttempt { 3621 // The unique ID that is used for this attempt. 3622 uint64 attempt_id = 7; 3623 3624 enum HTLCStatus { 3625 IN_FLIGHT = 0; 3626 SUCCEEDED = 1; 3627 FAILED = 2; 3628 } 3629 3630 // The status of the HTLC. 3631 HTLCStatus status = 1; 3632 3633 // The route taken by this HTLC. 3634 Route route = 2; 3635 3636 // The time in UNIX nanoseconds at which this HTLC was sent. 3637 int64 attempt_time_ns = 3; 3638 3639 /* 3640 The time in UNIX nanoseconds at which this HTLC was settled or failed. 3641 This value will not be set if the HTLC is still IN_FLIGHT. 3642 */ 3643 int64 resolve_time_ns = 4; 3644 3645 // Detailed htlc failure info. 3646 Failure failure = 5; 3647 3648 // The preimage that was used to settle the HTLC. 3649 bytes preimage = 6; 3650 } 3651 3652 message ListPaymentsRequest { 3653 /* 3654 If true, then return payments that have not yet fully completed. This means 3655 that pending payments, as well as failed payments will show up if this 3656 field is set to true. This flag doesn't change the meaning of the indices, 3657 which are tied to individual payments. 3658 */ 3659 bool include_incomplete = 1; 3660 3661 /* 3662 The index of a payment that will be used as either the start or end of a 3663 query to determine which payments should be returned in the response. The 3664 index_offset is exclusive. In the case of a zero index_offset, the query 3665 will start with the oldest payment when paginating forwards, or will end 3666 with the most recent payment when paginating backwards. 3667 */ 3668 uint64 index_offset = 2; 3669 3670 // The maximal number of payments returned in the response to this query. 3671 uint64 max_payments = 3; 3672 3673 /* 3674 If set, the payments returned will result from seeking backwards from the 3675 specified index offset. This can be used to paginate backwards. The order 3676 of the returned payments is always oldest first (ascending index order). 3677 */ 3678 bool reversed = 4; 3679 } 3680 3681 message ListPaymentsResponse { 3682 // The list of payments 3683 repeated Payment payments = 1; 3684 3685 /* 3686 The index of the first item in the set of returned payments. This can be 3687 used as the index_offset to continue seeking backwards in the next request. 3688 */ 3689 uint64 first_index_offset = 2; 3690 3691 /* 3692 The index of the last item in the set of returned payments. This can be used 3693 as the index_offset to continue seeking forwards in the next request. 3694 */ 3695 uint64 last_index_offset = 3; 3696 } 3697 3698 message DeletePaymentRequest { 3699 // Payment hash to delete. 3700 bytes payment_hash = 1; 3701 3702 /* 3703 Only delete failed HTLCs from the payment, not the payment itself. 3704 */ 3705 bool failed_htlcs_only = 2; 3706 } 3707 3708 message DeleteAllPaymentsRequest { 3709 // Only delete failed payments. 3710 bool failed_payments_only = 1; 3711 3712 /* 3713 Only delete failed HTLCs from payments, not the payment itself. 3714 */ 3715 bool failed_htlcs_only = 2; 3716 } 3717 3718 message DeletePaymentResponse { 3719 } 3720 3721 message DeleteAllPaymentsResponse { 3722 } 3723 3724 message AbandonChannelRequest { 3725 ChannelPoint channel_point = 1; 3726 3727 bool pending_funding_shim_only = 2; 3728 3729 /* 3730 Override the requirement for being in dev mode by setting this to true and 3731 confirming the user knows what they are doing and this is a potential foot 3732 gun to lose funds if used on active channels. 3733 */ 3734 bool i_know_what_i_am_doing = 3; 3735 } 3736 3737 message AbandonChannelResponse { 3738 } 3739 3740 message DebugLevelRequest { 3741 bool show = 1; 3742 string level_spec = 2; 3743 } 3744 message DebugLevelResponse { 3745 string sub_systems = 1; 3746 } 3747 3748 message CalcPaymentStatsRequest { 3749 } 3750 message CalcPaymentStatsResponse { 3751 uint64 total = 1; 3752 uint64 failed = 2; 3753 uint64 succeeded = 3; 3754 uint64 htlc_attempts = 4; 3755 uint64 htlc_failed = 5; 3756 uint64 htlc_settled = 6; 3757 uint64 old_dupe_payments = 7; 3758 } 3759 3760 message PayReqString { 3761 // The payment request string to be decoded 3762 string pay_req = 1; 3763 } 3764 message PayReq { 3765 string destination = 1; 3766 string payment_hash = 2; 3767 int64 num_atoms = 3; 3768 int64 timestamp = 4; 3769 int64 expiry = 5; 3770 string description = 6; 3771 string description_hash = 7; 3772 string fallback_addr = 8; 3773 int64 cltv_expiry = 9; 3774 repeated RouteHint route_hints = 10; 3775 bytes payment_addr = 11; 3776 int64 num_m_atoms = 12; 3777 map<uint32, Feature> features = 13; 3778 } 3779 3780 enum FeatureBit { 3781 DATALOSS_PROTECT_REQ = 0; 3782 DATALOSS_PROTECT_OPT = 1; 3783 INITIAL_ROUING_SYNC = 3; 3784 UPFRONT_SHUTDOWN_SCRIPT_REQ = 4; 3785 UPFRONT_SHUTDOWN_SCRIPT_OPT = 5; 3786 GOSSIP_QUERIES_REQ = 6; 3787 GOSSIP_QUERIES_OPT = 7; 3788 TLV_ONION_REQ = 8; 3789 TLV_ONION_OPT = 9; 3790 EXT_GOSSIP_QUERIES_REQ = 10; 3791 EXT_GOSSIP_QUERIES_OPT = 11; 3792 STATIC_REMOTE_KEY_REQ = 12; 3793 STATIC_REMOTE_KEY_OPT = 13; 3794 PAYMENT_ADDR_REQ = 14; 3795 PAYMENT_ADDR_OPT = 15; 3796 MPP_REQ = 16; 3797 MPP_OPT = 17; 3798 WUMBO_CHANNELS_REQ = 18; 3799 WUMBO_CHANNELS_OPT = 19; 3800 ANCHORS_REQ = 20; 3801 ANCHORS_OPT = 21; 3802 ANCHORS_ZERO_FEE_HTLC_REQ = 22; 3803 ANCHORS_ZERO_FEE_HTLC_OPT = 23; 3804 AMP_REQ = 30; 3805 AMP_OPT = 31; 3806 } 3807 3808 message Feature { 3809 string name = 2; 3810 bool is_required = 3; 3811 bool is_known = 4; 3812 } 3813 3814 message FeeReportRequest { 3815 } 3816 message ChannelFeeReport { 3817 // The short channel id that this fee report belongs to. 3818 uint64 chan_id = 5 [jstype = JS_STRING]; 3819 3820 // The channel that this fee report belongs to. 3821 string channel_point = 1; 3822 3823 // The base fee charged regardless of the number of milli-atoms sent. 3824 int64 base_fee_m_atoms = 2; 3825 3826 // The amount charged per milli-atoms transferred expressed in millionths 3827 // of a atom. 3828 int64 fee_per_mil = 3; 3829 3830 // The effective fee rate in milli-atoms. Computed by dividing the 3831 // fee_per_mil value by 1 million. 3832 double fee_rate = 4; 3833 } 3834 message FeeReportResponse { 3835 // An array of channel fee reports which describes the current fee schedule 3836 // for each channel. 3837 repeated ChannelFeeReport channel_fees = 1; 3838 3839 // The total amount of fee revenue (in atoms) the switch has collected over 3840 // the past 24 hrs. 3841 uint64 day_fee_sum = 2; 3842 3843 // The total amount of fee revenue (in atoms) the switch has collected over 3844 // the past 1 week. 3845 uint64 week_fee_sum = 3; 3846 3847 // The total amount of fee revenue (in atoms) the switch has collected over 3848 // the past 1 month. 3849 uint64 month_fee_sum = 4; 3850 } 3851 3852 message PolicyUpdateRequest { 3853 oneof scope { 3854 // If set, then this update applies to all currently active channels. 3855 bool global = 1; 3856 3857 // If set, this update will target a specific channel. 3858 ChannelPoint chan_point = 2; 3859 } 3860 3861 // The base fee charged regardless of the number of milli-atoms sent. 3862 int64 base_fee_m_atoms = 3; 3863 3864 // The effective fee rate in milli-atoms. The precision of this value goes 3865 // up to 6 decimal places, so 1e-6. 3866 double fee_rate = 4; 3867 3868 // The effective fee rate in micro-satoshis (parts per million). 3869 uint32 fee_rate_ppm = 9; 3870 3871 // The required timelock delta for HTLCs forwarded over the channel. 3872 uint32 time_lock_delta = 5; 3873 3874 // If set, the maximum HTLC size in milli-atoms. If unset, the maximum HTLC 3875 // will be unchanged. 3876 uint64 max_htlc_m_atoms = 6; 3877 3878 // The minimum HTLC size in milli-atoms. Only applied if 3879 // min_htlc_msat_specified is true. 3880 uint64 min_htlc_m_atoms = 7; 3881 3882 // If true, min_htlc_m_atoms is applied. 3883 bool min_htlc_m_atoms_specified = 8; 3884 } 3885 enum UpdateFailure { 3886 UPDATE_FAILURE_UNKNOWN = 0; 3887 UPDATE_FAILURE_PENDING = 1; 3888 UPDATE_FAILURE_NOT_FOUND = 2; 3889 UPDATE_FAILURE_INTERNAL_ERR = 3; 3890 UPDATE_FAILURE_INVALID_PARAMETER = 4; 3891 } 3892 3893 message FailedUpdate { 3894 // The outpoint in format txid:n 3895 OutPoint outpoint = 1; 3896 3897 // Reason for the policy update failure. 3898 UpdateFailure reason = 2; 3899 3900 // A string representation of the policy update error. 3901 string update_error = 3; 3902 } 3903 3904 message PolicyUpdateResponse { 3905 // List of failed policy updates. 3906 repeated FailedUpdate failed_updates = 1; 3907 } 3908 3909 message ForwardingHistoryRequest { 3910 // Start time is the starting point of the forwarding history request. All 3911 // records beyond this point will be included, respecting the end time, and 3912 // the index offset. 3913 uint64 start_time = 1; 3914 3915 // End time is the end point of the forwarding history request. The 3916 // response will carry at most 50k records between the start time and the 3917 // end time. The index offset can be used to implement pagination. 3918 uint64 end_time = 2; 3919 3920 // Index offset is the offset in the time series to start at. As each 3921 // response can only contain 50k records, callers can use this to skip 3922 // around within a packed time series. 3923 uint32 index_offset = 3; 3924 3925 // The max number of events to return in the response to this query. 3926 uint32 num_max_events = 4; 3927 } 3928 message ForwardingEvent { 3929 // Timestamp is the time (unix epoch offset) that this circuit was 3930 // completed. Deprecated by timestamp_ns. 3931 uint64 timestamp = 1 [deprecated = true]; 3932 3933 // The incoming channel ID that carried the HTLC that created the circuit. 3934 uint64 chan_id_in = 2 [jstype = JS_STRING]; 3935 3936 // The outgoing channel ID that carried the preimage that completed the 3937 // circuit. 3938 uint64 chan_id_out = 4 [jstype = JS_STRING]; 3939 3940 // The total amount (in atoms) of the incoming HTLC that created half the 3941 // circuit. 3942 uint64 amt_in = 5; 3943 3944 // The total amount (in atoms) of the outgoing HTLC that created the second 3945 // half of the circuit. 3946 uint64 amt_out = 6; 3947 3948 // The total fee (in atoms) that this payment circuit carried. 3949 uint64 fee = 7; 3950 3951 // The total fee (in milli-atoms) that this payment circuit carried. 3952 uint64 fee_m_atoms = 8; 3953 3954 // The total amount (in milli-atoms) of the incoming HTLC that created half 3955 // the circuit. 3956 uint64 amt_in_m_atoms = 9; 3957 3958 // The total amount (in milli-atoms) of the outgoing HTLC that created the 3959 // second half of the circuit. 3960 uint64 amt_out_m_atoms = 10; 3961 3962 // The number of nanoseconds elapsed since January 1, 1970 UTC when this 3963 // circuit was completed. 3964 uint64 timestamp_ns = 11; 3965 3966 // TODO(roasbeef): add settlement latency? 3967 // * use FPE on the chan id? 3968 // * also list failures? 3969 } 3970 message ForwardingHistoryResponse { 3971 // A list of forwarding events from the time slice of the time series 3972 // specified in the request. 3973 repeated ForwardingEvent forwarding_events = 1; 3974 3975 // The index of the last time in the set of returned forwarding events. Can 3976 // be used to seek further, pagination style. 3977 uint32 last_offset_index = 2; 3978 } 3979 3980 message ExportChannelBackupRequest { 3981 // The target channel point to obtain a back up for. 3982 ChannelPoint chan_point = 1; 3983 } 3984 3985 message ChannelBackup { 3986 /* 3987 Identifies the channel that this backup belongs to. 3988 */ 3989 ChannelPoint chan_point = 1; 3990 3991 /* 3992 Is an encrypted single-chan backup. this can be passed to 3993 RestoreChannelBackups, or the WalletUnlocker Init and Unlock methods in 3994 order to trigger the recovery protocol. When using REST, this field must be 3995 encoded as base64. 3996 */ 3997 bytes chan_backup = 2; 3998 } 3999 4000 message MultiChanBackup { 4001 /* 4002 Is the set of all channels that are included in this multi-channel backup. 4003 */ 4004 repeated ChannelPoint chan_points = 1; 4005 4006 /* 4007 A single encrypted blob containing all the static channel backups of the 4008 channel listed above. This can be stored as a single file or blob, and 4009 safely be replaced with any prior/future versions. When using REST, this 4010 field must be encoded as base64. 4011 */ 4012 bytes multi_chan_backup = 2; 4013 } 4014 4015 message ChanBackupExportRequest { 4016 } 4017 message ChanBackupSnapshot { 4018 /* 4019 The set of new channels that have been added since the last channel backup 4020 snapshot was requested. 4021 */ 4022 ChannelBackups single_chan_backups = 1; 4023 4024 /* 4025 A multi-channel backup that covers all open channels currently known to 4026 lnd. 4027 */ 4028 MultiChanBackup multi_chan_backup = 2; 4029 } 4030 4031 message ChannelBackups { 4032 /* 4033 A set of single-chan static channel backups. 4034 */ 4035 repeated ChannelBackup chan_backups = 1; 4036 } 4037 4038 message RestoreChanBackupRequest { 4039 oneof backup { 4040 /* 4041 The channels to restore as a list of channel/backup pairs. 4042 */ 4043 ChannelBackups chan_backups = 1; 4044 4045 /* 4046 The channels to restore in the packed multi backup format. When using 4047 REST, this field must be encoded as base64. 4048 */ 4049 bytes multi_chan_backup = 2; 4050 } 4051 } 4052 message RestoreBackupResponse { 4053 } 4054 4055 message ChannelBackupSubscription { 4056 } 4057 4058 message VerifyChanBackupResponse { 4059 } 4060 4061 message MacaroonPermission { 4062 // The entity a permission grants access to. 4063 string entity = 1; 4064 4065 // The action that is granted. 4066 string action = 2; 4067 } 4068 message BakeMacaroonRequest { 4069 // The list of permissions the new macaroon should grant. 4070 repeated MacaroonPermission permissions = 1; 4071 4072 // The root key ID used to create the macaroon, must be a positive integer. 4073 uint64 root_key_id = 2; 4074 4075 /* 4076 Informs the RPC on whether to allow external permissions that LND is not 4077 aware of. 4078 */ 4079 bool allow_external_permissions = 3; 4080 } 4081 message BakeMacaroonResponse { 4082 // The hex encoded macaroon, serialized in binary format. 4083 string macaroon = 1; 4084 } 4085 4086 message ListMacaroonIDsRequest { 4087 } 4088 message ListMacaroonIDsResponse { 4089 // The list of root key IDs that are in use. 4090 repeated uint64 root_key_ids = 1; 4091 } 4092 4093 message DeleteMacaroonIDRequest { 4094 // The root key ID to be removed. 4095 uint64 root_key_id = 1; 4096 } 4097 message DeleteMacaroonIDResponse { 4098 // A boolean indicates that the deletion is successful. 4099 bool deleted = 1; 4100 } 4101 4102 message MacaroonPermissionList { 4103 // A list of macaroon permissions. 4104 repeated MacaroonPermission permissions = 1; 4105 } 4106 4107 message ListPermissionsRequest { 4108 } 4109 message ListPermissionsResponse { 4110 /* 4111 A map between all RPC method URIs and their required macaroon permissions to 4112 access them. 4113 */ 4114 map<string, MacaroonPermissionList> method_permissions = 1; 4115 } 4116 4117 message Failure { 4118 enum FailureCode { 4119 /* 4120 The numbers assigned in this enumeration match the failure codes as 4121 defined in BOLT #4. Because protobuf 3 requires enums to start with 0, 4122 a RESERVED value is added. 4123 */ 4124 RESERVED = 0; 4125 4126 INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS = 1; 4127 INCORRECT_PAYMENT_AMOUNT = 2; 4128 FINAL_INCORRECT_CLTV_EXPIRY = 3; 4129 FINAL_INCORRECT_HTLC_AMOUNT = 4; 4130 FINAL_EXPIRY_TOO_SOON = 5; 4131 INVALID_REALM = 6; 4132 EXPIRY_TOO_SOON = 7; 4133 INVALID_ONION_VERSION = 8; 4134 INVALID_ONION_HMAC = 9; 4135 INVALID_ONION_KEY = 10; 4136 AMOUNT_BELOW_MINIMUM = 11; 4137 FEE_INSUFFICIENT = 12; 4138 INCORRECT_CLTV_EXPIRY = 13; 4139 CHANNEL_DISABLED = 14; 4140 TEMPORARY_CHANNEL_FAILURE = 15; 4141 REQUIRED_NODE_FEATURE_MISSING = 16; 4142 REQUIRED_CHANNEL_FEATURE_MISSING = 17; 4143 UNKNOWN_NEXT_PEER = 18; 4144 TEMPORARY_NODE_FAILURE = 19; 4145 PERMANENT_NODE_FAILURE = 20; 4146 PERMANENT_CHANNEL_FAILURE = 21; 4147 EXPIRY_TOO_FAR = 22; 4148 MPP_TIMEOUT = 23; 4149 INVALID_ONION_PAYLOAD = 24; 4150 4151 /* 4152 An internal error occurred. 4153 */ 4154 INTERNAL_FAILURE = 997; 4155 4156 /* 4157 The error source is known, but the failure itself couldn't be decoded. 4158 */ 4159 UNKNOWN_FAILURE = 998; 4160 4161 /* 4162 An unreadable failure result is returned if the received failure message 4163 cannot be decrypted. In that case the error source is unknown. 4164 */ 4165 UNREADABLE_FAILURE = 999; 4166 } 4167 4168 // Failure code as defined in the Lightning spec 4169 FailureCode code = 1; 4170 4171 reserved 2; 4172 4173 // An optional channel update message. 4174 ChannelUpdate channel_update = 3; 4175 4176 // A failure type-dependent htlc value. 4177 uint64 htlc_m_atoms = 4; 4178 4179 // The sha256 sum of the onion payload. 4180 bytes onion_sha_256 = 5; 4181 4182 // A failure type-dependent cltv expiry value. 4183 uint32 cltv_expiry = 6; 4184 4185 // A failure type-dependent flags value. 4186 uint32 flags = 7; 4187 4188 /* 4189 The position in the path of the intermediate or final node that generated 4190 the failure message. Position zero is the sender node. 4191 **/ 4192 uint32 failure_source_index = 8; 4193 4194 // A failure type-dependent block height. 4195 uint32 height = 9; 4196 } 4197 4198 message ChannelUpdate { 4199 /* 4200 The signature that validates the announced data and proves the ownership 4201 of node id. 4202 */ 4203 bytes signature = 1; 4204 4205 /* 4206 The target chain that this channel was opened within. This value 4207 should be the genesis hash of the target chain. Along with the short 4208 channel ID, this uniquely identifies the channel globally in a 4209 blockchain. 4210 */ 4211 bytes chain_hash = 2; 4212 4213 /* 4214 The unique description of the funding transaction. 4215 */ 4216 uint64 chan_id = 3 [jstype = JS_STRING]; 4217 4218 /* 4219 A timestamp that allows ordering in the case of multiple announcements. 4220 We should ignore the message if timestamp is not greater than the 4221 last-received. 4222 */ 4223 uint32 timestamp = 4; 4224 4225 /* 4226 The bitfield that describes whether optional fields are present in this 4227 update. Currently, the least-significant bit must be set to 1 if the 4228 optional field MaxHtlc is present. 4229 */ 4230 uint32 message_flags = 10; 4231 4232 /* 4233 The bitfield that describes additional meta-data concerning how the 4234 update is to be interpreted. Currently, the least-significant bit must be 4235 set to 0 if the creating node corresponds to the first node in the 4236 previously sent channel announcement and 1 otherwise. If the second bit 4237 is set, then the channel is set to be disabled. 4238 */ 4239 uint32 channel_flags = 5; 4240 4241 /* 4242 The minimum number of blocks this node requires to be added to the expiry 4243 of HTLCs. This is a security parameter determined by the node operator. 4244 This value represents the required gap between the time locks of the 4245 incoming and outgoing HTLC's set to this node. 4246 */ 4247 uint32 time_lock_delta = 6; 4248 4249 /* 4250 The minimum HTLC value which will be accepted. 4251 */ 4252 uint64 htlc_minimum_m_atoms = 7; 4253 4254 /* 4255 The base fee that must be used for incoming HTLC's to this particular 4256 channel. This value will be tacked onto the required for a payment 4257 independent of the size of the payment. 4258 */ 4259 uint32 base_fee = 8; 4260 4261 /* 4262 The fee rate that will be charged per millionth of a satoshi. 4263 */ 4264 uint32 fee_rate = 9; 4265 4266 /* 4267 The maximum HTLC value which will be accepted. 4268 */ 4269 uint64 htlc_maximum_m_atoms = 11; 4270 4271 /* 4272 The set of data that was appended to this message, some of which we may 4273 not actually know how to iterate or parse. By holding onto this data, we 4274 ensure that we're able to properly validate the set of signatures that 4275 cover these new fields, and ensure we're able to make upgrades to the 4276 network in a forwards compatible manner. 4277 */ 4278 bytes extra_opaque_data = 12; 4279 } 4280 4281 message MacaroonId { 4282 bytes nonce = 1; 4283 bytes storageId = 2; 4284 repeated Op ops = 3; 4285 } 4286 4287 message Op { 4288 string entity = 1; 4289 repeated string actions = 2; 4290 } 4291 4292 message CheckMacPermRequest { 4293 bytes macaroon = 1; 4294 repeated MacaroonPermission permissions = 2; 4295 string fullMethod = 3; 4296 } 4297 4298 message CheckMacPermResponse { 4299 bool valid = 1; 4300 } 4301 4302 message RPCMiddlewareRequest { 4303 /* 4304 The unique ID of the intercepted original gRPC request. Useful for mapping 4305 request to response when implementing full duplex message interception. For 4306 streaming requests, this will be the same ID for all incoming and outgoing 4307 middleware intercept messages of the _same_ stream. 4308 */ 4309 uint64 request_id = 1; 4310 4311 /* 4312 The raw bytes of the complete macaroon as sent by the gRPC client in the 4313 original request. This might be empty for a request that doesn't require 4314 macaroons such as the wallet unlocker RPCs. 4315 */ 4316 bytes raw_macaroon = 2; 4317 4318 /* 4319 The parsed condition of the macaroon's custom caveat for convenient access. 4320 This field only contains the value of the custom caveat that the handling 4321 middleware has registered itself for. The condition _must_ be validated for 4322 messages of intercept_type stream_auth and request! 4323 */ 4324 string custom_caveat_condition = 3; 4325 4326 /* 4327 There are three types of messages that will be sent to the middleware for 4328 inspection and approval: Stream authentication, request and response 4329 interception. The first two can only be accepted (=forward to main RPC 4330 server) or denied (=return error to client). Intercepted responses can also 4331 be replaced/overwritten. 4332 */ 4333 oneof intercept_type { 4334 /* 4335 Intercept stream authentication: each new streaming RPC call that is 4336 initiated against lnd and contains the middleware's custom macaroon 4337 caveat can be approved or denied based upon the macaroon in the stream 4338 header. This message will only be sent for streaming RPCs, unary RPCs 4339 must handle the macaroon authentication in the request interception to 4340 avoid an additional message round trip between lnd and the middleware. 4341 */ 4342 StreamAuth stream_auth = 4; 4343 4344 /* 4345 Intercept incoming gRPC client request message: all incoming messages, 4346 both on streaming and unary RPCs, are forwarded to the middleware for 4347 inspection. For unary RPC messages the middleware is also expected to 4348 validate the custom macaroon caveat of the request. 4349 */ 4350 RPCMessage request = 5; 4351 4352 /* 4353 Intercept outgoing gRPC response message: all outgoing messages, both on 4354 streaming and unary RPCs, are forwarded to the middleware for inspection 4355 and amendment. The response in this message is the original response as 4356 it was generated by the main RPC server. It can either be accepted 4357 (=forwarded to the client), replaced/overwritten with a new message of 4358 the same type, or replaced by an error message. 4359 */ 4360 RPCMessage response = 6; 4361 } 4362 4363 /* 4364 The unique message ID of this middleware intercept message. There can be 4365 multiple middleware intercept messages per single gRPC request (one for the 4366 incoming request and one for the outgoing response) or gRPC stream (one for 4367 each incoming message and one for each outgoing response). This message ID 4368 must be referenced when responding (accepting/rejecting/modifying) to an 4369 intercept message. 4370 */ 4371 uint64 msg_id = 7; 4372 } 4373 4374 message StreamAuth { 4375 /* 4376 The full URI (in the format /<rpcpackage>.<ServiceName>/MethodName, for 4377 example /lnrpc.Lightning/GetInfo) of the streaming RPC method that was just 4378 established. 4379 */ 4380 string method_full_uri = 1; 4381 } 4382 4383 message RPCMessage { 4384 /* 4385 The full URI (in the format /<rpcpackage>.<ServiceName>/MethodName, for 4386 example /lnrpc.Lightning/GetInfo) of the RPC method the message was sent 4387 to/from. 4388 */ 4389 string method_full_uri = 1; 4390 4391 /* 4392 Indicates whether the message was sent over a streaming RPC method or not. 4393 */ 4394 bool stream_rpc = 2; 4395 4396 /* 4397 The full canonical gRPC name of the message type (in the format 4398 <rpcpackage>.TypeName, for example lnrpc.GetInfoRequest). 4399 */ 4400 string type_name = 3; 4401 4402 /* 4403 The full content of the gRPC message, serialized in the binary protobuf 4404 format. 4405 */ 4406 bytes serialized = 4; 4407 } 4408 4409 message RPCMiddlewareResponse { 4410 /* 4411 The request message ID this response refers to. Must always be set when 4412 giving feedback to an intercept but is ignored for the initial registration 4413 message. 4414 */ 4415 uint64 ref_msg_id = 1; 4416 4417 /* 4418 The middleware can only send two types of messages to lnd: The initial 4419 registration message that identifies the middleware and after that only 4420 feedback messages to requests sent to the middleware. 4421 */ 4422 oneof middleware_message { 4423 /* 4424 The registration message identifies the middleware that's being 4425 registered in lnd. The registration message must be sent immediately 4426 after initiating the RegisterRpcMiddleware stream, otherwise lnd will 4427 time out the attempt and terminate the request. NOTE: The middleware 4428 will only receive interception messages for requests that contain a 4429 macaroon with the custom caveat that the middleware declares it is 4430 responsible for handling in the registration message! As a security 4431 measure, _no_ middleware can intercept requests made with _unencumbered_ 4432 macaroons! 4433 */ 4434 MiddlewareRegistration register = 2; 4435 4436 /* 4437 The middleware received an interception request and gives feedback to 4438 it. The request_id indicates what message the feedback refers to. 4439 */ 4440 InterceptFeedback feedback = 3; 4441 } 4442 } 4443 4444 message MiddlewareRegistration { 4445 /* 4446 The name of the middleware to register. The name should be as informative 4447 as possible and is logged on registration. 4448 */ 4449 string middleware_name = 1; 4450 4451 /* 4452 The name of the custom macaroon caveat that this middleware is responsible 4453 for. Only requests/responses that contain a macaroon with the registered 4454 custom caveat are forwarded for interception to the middleware. The 4455 exception being the read-only mode: All requests/responses are forwarded to 4456 a middleware that requests read-only access but such a middleware won't be 4457 allowed to _alter_ responses. As a security measure, _no_ middleware can 4458 change responses to requests made with _unencumbered_ macaroons! 4459 NOTE: Cannot be used at the same time as read_only_mode. 4460 */ 4461 string custom_macaroon_caveat_name = 2; 4462 4463 /* 4464 Instead of defining a custom macaroon caveat name a middleware can register 4465 itself for read-only access only. In that mode all requests/responses are 4466 forwarded to the middleware but the middleware isn't allowed to alter any of 4467 the responses. 4468 NOTE: Cannot be used at the same time as custom_macaroon_caveat_name. 4469 */ 4470 bool read_only_mode = 3; 4471 } 4472 4473 message InterceptFeedback { 4474 /* 4475 The error to return to the user. If this is non-empty, the incoming gRPC 4476 stream/request is aborted and the error is returned to the gRPC client. If 4477 this value is empty, it means the middleware accepts the stream/request/ 4478 response and the processing of it can continue. 4479 */ 4480 string error = 1; 4481 4482 /* 4483 A boolean indicating that the gRPC response should be replaced/overwritten. 4484 As its name suggests, this can only be used as a feedback to an intercepted 4485 response RPC message and is ignored for feedback on any other message. This 4486 boolean is needed because in protobuf an empty message is serialized as a 4487 0-length or nil byte slice and we wouldn't be able to distinguish between 4488 an empty replacement message and the "don't replace anything" case. 4489 */ 4490 bool replace_response = 2; 4491 4492 /* 4493 If the replace_response field is set to true, this field must contain the 4494 binary serialized gRPC response message in the protobuf format. 4495 */ 4496 bytes replacement_serialized = 3; 4497 }