github.com/decred/dcrlnd@v0.7.6/lnrpc/walletrpc/walletkit.proto (about) 1 syntax = "proto3"; 2 3 import "lightning.proto"; 4 import "signrpc/signer.proto"; 5 6 package walletrpc; 7 8 option go_package = "github.com/decred/dcrlnd/lnrpc/walletrpc"; 9 10 // WalletKit is a service that gives access to the core functionalities of the 11 // daemon's wallet. 12 service WalletKit { 13 /* 14 ListUnspent returns a list of all utxos spendable by the wallet with a 15 number of confirmations between the specified minimum and maximum. 16 */ 17 rpc ListUnspent (ListUnspentRequest) returns (ListUnspentResponse); 18 19 /* 20 LeaseOutput locks an output to the given ID, preventing it from being 21 available for any future coin selection attempts. The absolute time of the 22 lock's expiration is returned. The expiration of the lock can be extended by 23 successive invocations of this RPC. Outputs can be unlocked before their 24 expiration through `ReleaseOutput`. 25 */ 26 rpc LeaseOutput (LeaseOutputRequest) returns (LeaseOutputResponse); 27 28 /* 29 ReleaseOutput unlocks an output, allowing it to be available for coin 30 selection if it remains unspent. The ID should match the one used to 31 originally lock the output. 32 */ 33 rpc ReleaseOutput (ReleaseOutputRequest) returns (ReleaseOutputResponse); 34 35 /* 36 ListLeases lists all currently locked utxos. 37 */ 38 rpc ListLeases (ListLeasesRequest) returns (ListLeasesResponse); 39 40 /* 41 DeriveNextKey attempts to derive the *next* key within the key family 42 (account in BIP43) specified. This method should return the next external 43 child within this branch. 44 */ 45 rpc DeriveNextKey (KeyReq) returns (signrpc.KeyDescriptor); 46 47 /* 48 DeriveKey attempts to derive an arbitrary key specified by the passed 49 KeyLocator. 50 */ 51 rpc DeriveKey (signrpc.KeyLocator) returns (signrpc.KeyDescriptor); 52 53 /* 54 NextAddr returns the next unused address within the wallet. 55 */ 56 rpc NextAddr (AddrRequest) returns (AddrResponse); 57 58 /* 59 ListAccounts retrieves all accounts belonging to the wallet by default. A 60 name filter can be provided to filter through all of the wallet accounts 61 and return only those matching. 62 */ 63 rpc ListAccounts (ListAccountsRequest) returns (ListAccountsResponse); 64 65 /* 66 ImportAccount imports an account backed by an account extended public key. 67 68 NOTE: Events (deposits/spends) for keys derived from an account will only be 69 detected by lnd if they happen after the import. Rescans to detect past 70 events will be supported later on. 71 */ 72 rpc ImportAccount (ImportAccountRequest) returns (ImportAccountResponse); 73 74 /* 75 ImportPublicKey imports a public key as watch-only into the wallet. 76 77 NOTE: Events (deposits/spends) for a key will only be detected by lnd if 78 they happen after the import. Rescans to detect past events will be 79 supported later on. 80 */ 81 rpc ImportPublicKey (ImportPublicKeyRequest) 82 returns (ImportPublicKeyResponse); 83 84 /* 85 PublishTransaction attempts to publish the passed transaction to the 86 network. Once this returns without an error, the wallet will continually 87 attempt to re-broadcast the transaction on start up, until it enters the 88 chain. 89 */ 90 rpc PublishTransaction (Transaction) returns (PublishResponse); 91 92 /* 93 SendOutputs is similar to the existing sendmany call in Bitcoind, and 94 allows the caller to create a transaction that sends to several outputs at 95 once. This is ideal when wanting to batch create a set of transactions. 96 */ 97 rpc SendOutputs (SendOutputsRequest) returns (SendOutputsResponse); 98 99 /* 100 EstimateFee attempts to query the internal fee estimator of the wallet to 101 determine the fee (in sat/kw) to attach to a transaction in order to 102 achieve the confirmation target. 103 */ 104 rpc EstimateFee (EstimateFeeRequest) returns (EstimateFeeResponse); 105 106 /* 107 PendingSweeps returns lists of on-chain outputs that lnd is currently 108 attempting to sweep within its central batching engine. Outputs with similar 109 fee rates are batched together in order to sweep them within a single 110 transaction. 111 112 NOTE: Some of the fields within PendingSweepsRequest are not guaranteed to 113 remain supported. This is an advanced API that depends on the internals of 114 the UtxoSweeper, so things may change. 115 */ 116 rpc PendingSweeps (PendingSweepsRequest) returns (PendingSweepsResponse); 117 118 /* 119 BumpFee bumps the fee of an arbitrary input within a transaction. This RPC 120 takes a different approach than bitcoind's bumpfee command. lnd has a 121 central batching engine in which inputs with similar fee rates are batched 122 together to save on transaction fees. Due to this, we cannot rely on 123 bumping the fee on a specific transaction, since transactions can change at 124 any point with the addition of new inputs. The list of inputs that 125 currently exist within lnd's central batching engine can be retrieved 126 through the PendingSweeps RPC. 127 128 When bumping the fee of an input that currently exists within lnd's central 129 batching engine, a higher fee transaction will be created that replaces the 130 lower fee transaction through the Replace-By-Fee (RBF) policy. If it 131 132 This RPC also serves useful when wanting to perform a Child-Pays-For-Parent 133 (CPFP), where the child transaction pays for its parent's fee. This can be 134 done by specifying an outpoint within the low fee transaction that is under 135 the control of the wallet. 136 137 The fee preference can be expressed either as a specific fee rate or a delta 138 of blocks in which the output should be swept on-chain within. If a fee 139 preference is not explicitly specified, then an error is returned. 140 141 Note that this RPC currently doesn't perform any validation checks on the 142 fee preference being provided. For now, the responsibility of ensuring that 143 the new fee preference is sufficient is delegated to the user. 144 */ 145 rpc BumpFee (BumpFeeRequest) returns (BumpFeeResponse); 146 147 /* 148 ListSweeps returns a list of the sweep transactions our node has produced. 149 Note that these sweeps may not be confirmed yet, as we record sweeps on 150 broadcast, not confirmation. 151 */ 152 rpc ListSweeps (ListSweepsRequest) returns (ListSweepsResponse); 153 154 /* 155 DeriveNextAccount generates the next account of the wallet. 156 */ 157 rpc DeriveNextAccount (DeriveNextAccountRequest) 158 returns (DeriveNextAccountResponse); 159 160 /* 161 ExportPrivateKey exports a private key that is derived from a wallet 162 address. 163 */ 164 rpc ExportPrivateKey (ExportPrivateKeyRequest) 165 returns (ExportPrivateKeyResponse); 166 167 /* 168 RescanWallet performs an on-chain rescan for wallet transactions. 169 */ 170 rpc RescanWallet (RescanWalletRequest) 171 returns (stream RescanWalletResponse); 172 173 /* 174 SpendUTXOs performs a custom on-chain spend of UTXOs. 175 */ 176 rpc SpendUTXOs (SpendUTXOsRequest) returns (SpendUTXOsResponse); 177 178 /* 179 GetWalletTx returns information about an existing wallet transaction. 180 */ 181 rpc GetWalletTx (GetWalletTxRequest) returns (GetWalletTxResponse); 182 183 /* 184 LabelTransaction adds a label to a transaction. If the transaction already 185 has a label the call will fail unless the overwrite bool is set. This will 186 overwrite the exiting transaction label. Labels must not be empty, and 187 cannot exceed 500 characters. 188 */ 189 rpc LabelTransaction (LabelTransactionRequest) 190 returns (LabelTransactionResponse); 191 192 /* 193 FundPsbt creates a fully populated PSBT that contains enough inputs to fund 194 the outputs specified in the template. There are two ways of specifying a 195 template: Either by passing in a PSBT with at least one output declared or 196 by passing in a raw TxTemplate message. 197 198 If there are no inputs specified in the template, coin selection is 199 performed automatically. If the template does contain any inputs, it is 200 assumed that full coin selection happened externally and no additional 201 inputs are added. If the specified inputs aren't enough to fund the outputs 202 with the given fee rate, an error is returned. 203 204 After either selecting or verifying the inputs, all input UTXOs are locked 205 with an internal app ID. 206 207 NOTE: If this method returns without an error, it is the caller's 208 responsibility to either spend the locked UTXOs (by finalizing and then 209 publishing the transaction) or to unlock/release the locked UTXOs in case of 210 an error on the caller's side. 211 */ 212 rpc FundPsbt (FundPsbtRequest) returns (FundPsbtResponse); 213 214 /* 215 SignPsbt expects a partial transaction with all inputs and outputs fully 216 declared and tries to sign all unsigned inputs that have all required fields 217 (UTXO information, BIP32 derivation information, witness or sig scripts) 218 set. 219 If no error is returned, the PSBT is ready to be given to the next signer or 220 to be finalized if lnd was the last signer. 221 222 NOTE: This RPC only signs inputs (and only those it can sign), it does not 223 perform any other tasks (such as coin selection, UTXO locking or 224 input/output/fee value validation, PSBT finalization). Any input that is 225 incomplete will be skipped. 226 */ 227 rpc SignPsbt (SignPsbtRequest) returns (SignPsbtResponse); 228 229 /* 230 FinalizePsbt expects a partial transaction with all inputs and outputs fully 231 declared and tries to sign all inputs that belong to the wallet. Lnd must be 232 the last signer of the transaction. That means, if there are any unsigned 233 non-witness inputs or inputs without UTXO information attached or inputs 234 without witness data that do not belong to lnd's wallet, this method will 235 fail. If no error is returned, the PSBT is ready to be extracted and the 236 final TX within to be broadcast. 237 238 NOTE: This method does NOT publish the transaction once finalized. It is the 239 caller's responsibility to either publish the transaction on success or 240 unlock/release any locked UTXOs in case of an error in this method. 241 */ 242 rpc FinalizePsbt (FinalizePsbtRequest) returns (FinalizePsbtResponse); 243 } 244 245 message ListUnspentRequest { 246 // The minimum number of confirmations to be included. 247 int32 min_confs = 1; 248 249 // The maximum number of confirmations to be included. 250 int32 max_confs = 2; 251 252 // An optional filter to only include outputs belonging to an account. 253 string account = 3; 254 } 255 256 message ListUnspentResponse { 257 // A list of utxos satisfying the specified number of confirmations. 258 repeated lnrpc.Utxo utxos = 1; 259 } 260 261 message LeaseOutputRequest { 262 /* 263 An ID of 32 random bytes that must be unique for each distinct application 264 using this RPC which will be used to bound the output lease to. 265 */ 266 bytes id = 1; 267 268 // The identifying outpoint of the output being leased. 269 lnrpc.OutPoint outpoint = 2; 270 271 // The time in seconds before the lock expires. If set to zero, the default 272 // lock duration is used. 273 uint64 expiration_seconds = 3; 274 } 275 276 message LeaseOutputResponse { 277 /* 278 The absolute expiration of the output lease represented as a unix timestamp. 279 */ 280 uint64 expiration = 1; 281 } 282 283 message ReleaseOutputRequest { 284 // The unique ID that was used to lock the output. 285 bytes id = 1; 286 287 // The identifying outpoint of the output being released. 288 lnrpc.OutPoint outpoint = 2; 289 } 290 291 message ReleaseOutputResponse { 292 } 293 294 message KeyReq { 295 /* 296 Is the key finger print of the root pubkey that this request is targeting. 297 This allows the WalletKit to possibly serve out keys for multiple HD chains 298 via public derivation. 299 */ 300 int32 key_finger_print = 1; 301 302 /* 303 The target key family to derive a key from. In other contexts, this is 304 known as the "account". 305 */ 306 int32 key_family = 2; 307 } 308 309 message AddrRequest { 310 /* 311 The name of the account to retrieve the next address of. If empty, the 312 default wallet account is used. 313 */ 314 string account = 1; 315 316 /* 317 The type of address to derive. 318 */ 319 AddressType type = 2; 320 321 /* 322 Whether a change address should be derived. 323 */ 324 bool change = 3; 325 } 326 message AddrResponse { 327 /* 328 The address encoded using a bech32 format. 329 */ 330 string addr = 1; 331 } 332 333 enum AddressType { 334 UNKNOWN = 0; 335 WITNESS_PUBKEY_HASH = 1; 336 NESTED_WITNESS_PUBKEY_HASH = 2; 337 HYBRID_NESTED_WITNESS_PUBKEY_HASH = 3; 338 } 339 message Account { 340 // The name used to identify the account. 341 string name = 1; 342 343 /* 344 The type of addresses the account supports. 345 AddressType | External Branch | Internal Branch 346 --------------------------------------------------------------------- 347 WITNESS_PUBKEY_HASH | P2WPKH | P2WPKH 348 NESTED_WITNESS_PUBKEY_HASH | NP2WPKH | NP2WPKH 349 HYBRID_NESTED_WITNESS_PUBKEY_HASH | NP2WPKH | P2WPKH 350 */ 351 AddressType address_type = 2; 352 353 /* 354 The public key backing the account that all keys are derived from 355 represented as an extended key. This will always be empty for the default 356 imported account in which single public keys are imported into. 357 */ 358 string extended_public_key = 3; 359 360 /* 361 The fingerprint of the root key from which the account public key was 362 derived from. This will always be zero for the default imported account in 363 which single public keys are imported into. The bytes are in big-endian 364 order. 365 */ 366 bytes master_key_fingerprint = 4; 367 368 /* 369 The derivation path corresponding to the account public key. This will 370 always be empty for the default imported account in which single public keys 371 are imported into. 372 */ 373 string derivation_path = 5; 374 375 /* 376 The number of keys derived from the external branch of the account public 377 key. This will always be zero for the default imported account in which 378 single public keys are imported into. 379 */ 380 uint32 external_key_count = 6; 381 382 /* 383 The number of keys derived from the internal branch of the account public 384 key. This will always be zero for the default imported account in which 385 single public keys are imported into. 386 */ 387 uint32 internal_key_count = 7; 388 389 // Whether the wallet stores private keys for the account. 390 bool watch_only = 8; 391 } 392 message ListAccountsRequest { 393 // An optional filter to only return accounts matching this name. 394 string name = 1; 395 396 // An optional filter to only return accounts matching this address type. 397 AddressType address_type = 2; 398 } 399 message ListAccountsResponse { 400 repeated Account accounts = 1; 401 } 402 403 message ImportAccountRequest { 404 // A name to identify the account with. 405 string name = 1; 406 407 /* 408 A public key that corresponds to a wallet account represented as an extended 409 key. It must conform to a derivation path of the form 410 m/purpose'/coin_type'/account'. 411 */ 412 string extended_public_key = 2; 413 414 /* 415 The fingerprint of the root key (also known as the key with derivation path 416 m/) from which the account public key was derived from. This may be required 417 by some hardware wallets for proper identification and signing. The bytes 418 must be in big-endian order. 419 */ 420 bytes master_key_fingerprint = 3; 421 422 /* 423 An address type is only required when the extended account public key has a 424 legacy version (xpub, tpub, etc.), such that the wallet cannot detect what 425 address scheme it belongs to. 426 */ 427 AddressType address_type = 4; 428 429 /* 430 Whether a dry run should be attempted when importing the account. This 431 serves as a way to confirm whether the account is being imported correctly 432 by returning the first N addresses for the external and internal branches of 433 the account. If these addresses match as expected, then it should be safe to 434 import the account as is. 435 */ 436 bool dry_run = 5; 437 } 438 message ImportAccountResponse { 439 // The details of the imported account. 440 Account account = 1; 441 442 /* 443 The first N addresses that belong to the external branch of the account. 444 The external branch is typically used for external non-change addresses. 445 These are only returned if a dry run was specified within the request. 446 */ 447 repeated string dry_run_external_addrs = 2; 448 449 /* 450 The first N addresses that belong to the internal branch of the account. 451 The internal branch is typically used for change addresses. These are only 452 returned if a dry run was specified within the request. 453 */ 454 repeated string dry_run_internal_addrs = 3; 455 } 456 457 message ImportPublicKeyRequest { 458 // A compressed public key represented as raw bytes. 459 bytes public_key = 1; 460 461 // The type of address that will be generated from the public key. 462 AddressType address_type = 2; 463 } 464 message ImportPublicKeyResponse { 465 } 466 467 message Transaction { 468 /* 469 The raw serialized transaction. 470 */ 471 bytes tx_hex = 1; 472 473 /* 474 An optional label to save with the transaction. Limited to 500 characters. 475 */ 476 string label = 2; 477 } 478 message PublishResponse { 479 /* 480 If blank, then no error occurred and the transaction was successfully 481 published. If not the empty string, then a string representation of the 482 broadcast error. 483 484 TODO(roasbeef): map to a proper enum type 485 */ 486 string publish_error = 1; 487 } 488 489 message SendOutputsRequest { 490 /* 491 The number of atoms per kilobyte that should be used when crafting 492 this transaction. 493 */ 494 int64 atoms_per_kb = 1; 495 496 /* 497 A slice of the outputs that should be created in the transaction produced. 498 */ 499 repeated signrpc.TxOut outputs = 2; 500 501 // An optional label for the transaction, limited to 500 characters. 502 string label = 3; 503 504 // The account from which to send funds. If empty, funds are sent from the 505 // default account. 506 string account = 100; 507 508 // The minimum number of confirmations each one of your outputs used for 509 // the transaction must satisfy. 510 int32 min_confs = 4; 511 512 // Whether unconfirmed outputs should be used as inputs for the transaction. 513 bool spend_unconfirmed = 5; 514 } 515 message SendOutputsResponse { 516 /* 517 The serialized transaction sent out on the network. 518 */ 519 bytes raw_tx = 1; 520 } 521 522 message EstimateFeeRequest { 523 /* 524 The number of confirmations to shoot for when estimating the fee. 525 */ 526 int32 conf_target = 1; 527 } 528 message EstimateFeeResponse { 529 /* 530 The amount of atoms per kilobyte that should be used in order to reach the 531 confirmation target in the request. 532 */ 533 int64 atoms_per_kb = 1; 534 } 535 536 enum WitnessType { 537 UNKNOWN_WITNESS = 0; 538 539 /* 540 A witness that allows us to spend the output of a commitment transaction 541 after a relative lock-time lockout. 542 */ 543 COMMITMENT_TIME_LOCK = 1; 544 545 /* 546 A witness that allows us to spend a settled no-delay output immediately on a 547 counterparty's commitment transaction. 548 */ 549 COMMITMENT_NO_DELAY = 2; 550 551 /* 552 A witness that allows us to sweep the settled output of a malicious 553 counterparty's who broadcasts a revoked commitment transaction. 554 */ 555 COMMITMENT_REVOKE = 3; 556 557 /* 558 A witness that allows us to sweep an HTLC which we offered to the remote 559 party in the case that they broadcast a revoked commitment state. 560 */ 561 HTLC_OFFERED_REVOKE = 4; 562 563 /* 564 A witness that allows us to sweep an HTLC output sent to us in the case that 565 the remote party broadcasts a revoked commitment state. 566 */ 567 HTLC_ACCEPTED_REVOKE = 5; 568 569 /* 570 A witness that allows us to sweep an HTLC output that we extended to a 571 party, but was never fulfilled. This HTLC output isn't directly on the 572 commitment transaction, but is the result of a confirmed second-level HTLC 573 transaction. As a result, we can only spend this after a CSV delay. 574 */ 575 HTLC_OFFERED_TIMEOUT_SECOND_LEVEL = 6; 576 577 /* 578 A witness that allows us to sweep an HTLC output that was offered to us, and 579 for which we have a payment preimage. This HTLC output isn't directly on our 580 commitment transaction, but is the result of confirmed second-level HTLC 581 transaction. As a result, we can only spend this after a CSV delay. 582 */ 583 HTLC_ACCEPTED_SUCCESS_SECOND_LEVEL = 7; 584 585 /* 586 A witness that allows us to sweep an HTLC that we offered to the remote 587 party which lies in the commitment transaction of the remote party. We can 588 spend this output after the absolute CLTV timeout of the HTLC as passed. 589 */ 590 HTLC_OFFERED_REMOTE_TIMEOUT = 8; 591 592 /* 593 A witness that allows us to sweep an HTLC that was offered to us by the 594 remote party. We use this witness in the case that the remote party goes to 595 chain, and we know the pre-image to the HTLC. We can sweep this without any 596 additional timeout. 597 */ 598 HTLC_ACCEPTED_REMOTE_SUCCESS = 9; 599 600 /* 601 A witness that allows us to sweep an HTLC from the remote party's commitment 602 transaction in the case that the broadcast a revoked commitment, but then 603 also immediately attempt to go to the second level to claim the HTLC. 604 */ 605 HTLC_SECOND_LEVEL_REVOKE = 10; 606 607 /* 608 A witness type that allows us to spend a regular p2wkh output that's sent to 609 an output which is under complete control of the backing wallet. 610 */ 611 WITNESS_KEY_HASH = 11; 612 613 /* 614 A witness type that allows us to sweep an output that sends to a nested P2SH 615 script that pays to a key solely under our control. 616 */ 617 NESTED_WITNESS_KEY_HASH = 12; 618 619 /* 620 A witness type that allows us to spend our anchor on the commitment 621 transaction. 622 */ 623 COMMITMENT_ANCHOR = 13; 624 625 /* 626 A witness type that allows us to sweep an output that sends to a P2PKH 627 script. 628 */ 629 PUBKEY_HASH = 128; 630 } 631 632 message PendingSweep { 633 // The outpoint of the output we're attempting to sweep. 634 lnrpc.OutPoint outpoint = 1; 635 636 // The witness type of the output we're attempting to sweep. 637 WitnessType witness_type = 2; 638 639 // The value of the output we're attempting to sweep. 640 uint32 amount_atoms = 3; 641 642 /* 643 The fee rate we'll use to sweep the output. The fee rate is only determined 644 once a sweeping transaction for the output is created, so it's possible for 645 this to be 0 before this. 646 */ 647 uint32 atoms_per_byte = 4; 648 649 // The number of broadcast attempts we've made to sweep the output. 650 uint32 broadcast_attempts = 5; 651 652 /* 653 The next height of the chain at which we'll attempt to broadcast the 654 sweep transaction of the output. 655 */ 656 uint32 next_broadcast_height = 6; 657 658 // The requested confirmation target for this output. 659 uint32 requested_conf_target = 8; 660 661 // The requested fee rate, expressed in atoms/byte, for this output. 662 uint32 requested_atoms_per_byte = 9; 663 664 // Upstream, this is used for the sat_per_vbyte field. 665 reserved 10; 666 667 // Upstream, this is used for the requested_sat_per_vbyte field. 668 reserved 11; 669 670 /* 671 Whether this input must be force-swept. This means that it is swept even 672 if it has a negative yield. 673 */ 674 bool force = 7; 675 } 676 677 message PendingSweepsRequest { 678 } 679 680 message PendingSweepsResponse { 681 /* 682 The set of outputs currently being swept by lnd's central batching engine. 683 */ 684 repeated PendingSweep pending_sweeps = 1; 685 } 686 687 message BumpFeeRequest { 688 // The input we're attempting to bump the fee of. 689 lnrpc.OutPoint outpoint = 1; 690 691 // The target number of blocks that the input should be spent within. 692 uint32 target_conf = 2; 693 694 /* 695 The fee rate, expressed in atoms/byte, that should be used to spend the 696 input with. 697 */ 698 uint32 atoms_per_byte = 3; 699 700 /* 701 Whether this input must be force-swept. This means that it is swept even 702 if it has a negative yield. 703 */ 704 bool force = 4; 705 706 // Upstream, this is used for the sat_per_vbyte field. 707 reserved 5; 708 } 709 710 message BumpFeeResponse { 711 } 712 713 message ListSweepsRequest { 714 /* 715 Retrieve the full sweep transaction details. If false, only the sweep txids 716 will be returned. Note that some sweeps that LND publishes will have been 717 replaced-by-fee, so will not be included in this output. 718 */ 719 bool verbose = 1; 720 } 721 722 message ListSweepsResponse { 723 message TransactionIDs { 724 /* 725 Reversed, hex-encoded string representing the transaction ids of the 726 sweeps that our node has broadcast. Note that these transactions may 727 not have confirmed yet, we record sweeps on broadcast, not confirmation. 728 */ 729 repeated string transaction_ids = 1; 730 } 731 732 oneof sweeps { 733 lnrpc.TransactionDetails transaction_details = 1; 734 TransactionIDs transaction_ids = 2; 735 } 736 } 737 738 message DeriveNextAccountRequest { 739 // The name for the new account. 740 string name = 1; 741 } 742 743 message DeriveNextAccountResponse { 744 } 745 746 message ExportPrivateKeyRequest { 747 // The public address for which to export the private key. 748 string address = 1; 749 } 750 751 message ExportPrivateKeyResponse { 752 // The private key in WIF format. 753 string wif = 1; 754 } 755 756 message RescanWalletRequest { 757 // The height where to begin the rescan process; 758 int32 begin_height = 1; 759 } 760 761 message RescanWalletResponse { 762 // The height up to which the wallet was rescanned through. 763 int32 scanned_through_height = 1; 764 } 765 766 message SpendUTXOsRequest { 767 message UTXOAndKey { 768 // The transaction has of the UTXO outpoint. 769 bytes txid = 1; 770 // The transaction index. 771 uint32 index = 2; 772 // The transaction tree. 773 uint32 tree = 3; 774 // The private key that corresponds to the address in the utxo. 775 string private_key_wif = 4; 776 // The height hint of where to look for the UTXO on the utxo set. 777 uint32 height_hint = 5; 778 // The address in the UTXO. 779 string address = 6; 780 } 781 message Output { 782 // The address to send to. 783 string address = 1; 784 // The amount to send. 785 int64 amount = 2; 786 } 787 788 // The inputs/utxos to spend. 789 repeated UTXOAndKey utxos = 1; 790 791 // The output to send to. If there's any non-dust change left unsent, then 792 // that change is sent back to the wallet. 793 repeated Output outputs = 2; 794 } 795 796 message SpendUTXOsResponse { 797 bytes txid = 1; 798 bytes raw_tx = 2; 799 } 800 801 message GetWalletTxRequest { 802 bytes txid = 1; 803 } 804 805 message GetWalletTxResponse { 806 bytes raw_tx = 1; 807 int32 confirmations = 2; 808 bytes block_hash = 3; 809 } 810 811 message LabelTransactionRequest { 812 // The txid of the transaction to label. 813 bytes txid = 1; 814 815 // The label to add to the transaction, limited to 500 characters. 816 string label = 2; 817 818 // Whether to overwrite the existing label, if it is present. 819 bool overwrite = 3; 820 } 821 822 message LabelTransactionResponse { 823 } 824 825 message FundPsbtRequest { 826 oneof template { 827 /* 828 Use an existing PSBT packet as the template for the funded PSBT. 829 830 The packet must contain at least one non-dust output. If one or more 831 inputs are specified, no coin selection is performed. In that case every 832 input must be an UTXO known to the wallet that has not been locked 833 before. The sum of all inputs must be sufficiently greater than the sum 834 of all outputs to pay a miner fee with the specified fee rate. A change 835 output is added to the PSBT if necessary. 836 */ 837 bytes psbt = 1; 838 839 /* 840 Use the outputs and optional inputs from this raw template. 841 */ 842 TxTemplate raw = 2; 843 } 844 845 oneof fees { 846 /* 847 The target number of blocks that the transaction should be confirmed in. 848 */ 849 uint32 target_conf = 3; 850 851 /* 852 The fee rate, expressed in atoms/byte, that should be used to spend the 853 input with. 854 */ 855 uint64 atoms_per_byte = 4; 856 } 857 858 /* 859 The name of the account to fund the PSBT with. If empty, the default wallet 860 account is used. 861 */ 862 string account = 5; 863 864 // The minimum number of confirmations each one of your outputs used for 865 // the transaction must satisfy. 866 int32 min_confs = 6; 867 868 // Whether unconfirmed outputs should be used as inputs for the transaction. 869 bool spend_unconfirmed = 7; 870 } 871 message FundPsbtResponse { 872 /* 873 The funded but not yet signed PSBT packet. 874 */ 875 bytes funded_psbt = 1; 876 877 /* 878 The index of the added change output or -1 if no change was left over. 879 */ 880 int32 change_output_index = 2; 881 882 /* 883 The list of lock leases that were acquired for the inputs in the funded PSBT 884 packet. 885 */ 886 repeated UtxoLease locked_utxos = 3; 887 } 888 889 message TxTemplate { 890 /* 891 An optional list of inputs to use. Every input must be an UTXO known to the 892 wallet that has not been locked before. The sum of all inputs must be 893 sufficiently greater than the sum of all outputs to pay a miner fee with the 894 fee rate specified in the parent message. 895 896 If no inputs are specified, coin selection will be performed instead and 897 inputs of sufficient value will be added to the resulting PSBT. 898 */ 899 repeated lnrpc.OutPoint inputs = 1; 900 901 /* 902 A map of all addresses and the amounts to send to in the funded PSBT. 903 */ 904 map<string, uint64> outputs = 2; 905 } 906 907 message UtxoLease { 908 /* 909 A 32 byte random ID that identifies the lease. 910 */ 911 bytes id = 1; 912 913 // The identifying outpoint of the output being leased. 914 lnrpc.OutPoint outpoint = 2; 915 916 /* 917 The absolute expiration of the output lease represented as a unix timestamp. 918 */ 919 uint64 expiration = 3; 920 } 921 922 message SignPsbtRequest { 923 /* 924 The PSBT that should be signed. The PSBT must contain all required inputs, 925 outputs, UTXO data and custom fields required to identify the signing key. 926 */ 927 bytes funded_psbt = 1; 928 } 929 930 message SignPsbtResponse { 931 // The signed transaction in PSBT format. 932 bytes signed_psbt = 1; 933 } 934 935 message FinalizePsbtRequest { 936 /* 937 A PSBT that should be signed and finalized. The PSBT must contain all 938 required inputs, outputs, UTXO data and partial signatures of all other 939 signers. 940 */ 941 bytes funded_psbt = 1; 942 } 943 message FinalizePsbtResponse { 944 // The fully signed and finalized transaction in PSBT format. 945 bytes signed_psbt = 1; 946 947 // The fully signed and finalized transaction in the raw wire format. 948 bytes raw_final_tx = 2; 949 } 950 951 message ListLeasesRequest { 952 } 953 954 message ListLeasesResponse { 955 // The list of currently leased utxos. 956 repeated UtxoLease locked_utxos = 1; 957 }